Produtos Relacionados
A tabela MGB faz parte do sistema ERP Protheus da TOTVS e é utilizada para produtos relacionados.
Ela pertence ao dicionário de dados do Protheus (SX2) e armazena informações essenciais utilizadas em processos como cadastros, movimentações e integrações do sistema.
A tabela MGB possui diversos campos (SX3), cada um com regras específicas como tipo, tamanho e validações, além de índices (SIX) que otimizam a performance das consultas.
Nesta página você pode consultar a estrutura completa da tabela MGB, incluindo todos os campos e índices relacionados.
| Propriedade | Valor |
|---|---|
| X2_CHAVE | MGB |
| X2_PATH | \DATA\ |
| X2_ARQUIVO | MGB990 |
| X2_NOME | Produtos Relacionados |
| X2_NOMESPA | Producto relacionado |
| X2_NOMEENG | Related Products |
| X2_ROTINA | - |
| X2_MODO | C |
| X2_MODOUN | C |
| X2_MODOEMP | C |
| X2_DELET | 0 |
| X2_TTS | - |
| X2_UNICO | MGB_FILIAL+MGB_CODREG+MGB_IDPROD+MGB_CODPRO |
| X2_PYME | S |
| X2_MODULO | 12 |
| X2_DISPLAY | - |
| X2_SYSOBJ | - |
| X2_USROBJ | - |
| X2_POSLGT | 1 |
| X2_CLOB | 2 |
| X2_AUTREC | 2 |
| X2_TAMFIL | 2 |
| X2_TAMUN | 0 |
| X2_TAMEMP | 0 |
| X2_STAMP | 2 |
| X2_INSDT | 2 |
| D_E_L_E_T_ | - |
| R_E_C_N_O_ | 6436 |
| R_E_C_D_E_L_ | 0 |
| X3_ARQUIVO | X3_ORDEM | X3_CAMPO | X3_TIPO | X3_TAMANHO | X3_DECIMAL | X3_TITULO | X3_TITSPA | X3_TITENG | X3_DESCRIC | X3_DESCSPA | X3_DESCENG | X3_PICTURE | X3_VALID | X3_USADO | X3_RELACAO | X3_F3 | X3_NIVEL | X3_RESERV | X3_CHECK | X3_TRIGGER | X3_PROPRI | X3_BROWSE | X3_VISUAL | X3_CONTEXT | X3_OBRIGAT | X3_VLDUSER | X3_CBOX | X3_CBOXSPA | X3_CBOXENG | X3_PICTVAR | X3_WHEN | X3_INIBRW | X3_GRPSXG | X3_FOLDER | X3_PYME | X3_CONDSQL | X3_CHKSQL | X3_IDXSRV | X3_ORTOGRA | X3_IDXFLD | X3_TELA | X3_PICBRV | X3_AGRUP | X3_POSLGT | X3_MODAL | X3_CHKSUM | X3_ADDSUM | D_E_L_E_T_ | R_E_C_N_O_ | R_E_C_D_E_L_ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| MGB | 01 | MGB_FILIAL | C | 2 | 0 | Filial | Sucursal | Branch | Filial do Sistema | Sucursal del sistema | System Branch | - | - | x x x x x x x x x x x x x x x | - | - | 1 | - | - | - | - | - | A | R | - | - | - | - | - | - | - | - | 033 | - | S | - | - | S | - | N | - | - | - | 1 | 2 | - | - | - | 102467 | 0 |
| MGB | 02 | MGB_CODREG | C | 6 | 0 | Cod Regra | Cod Regla | Code Rule | Codigo Regra | Codigo regla | Rule Code | @! | - | x x x x x x x x x x x x x x x | - | - | 1 | - | - | - | - | - | A | R | - | - | - | - | - | - | - | - | - | - | S | - | - | S | - | N | - | - | - | 1 | 2 | - | - | - | 102468 | 0 |
| MGB | 03 | MGB_IDPROD | C | 6 | 0 | Id Produto | Id Producto | Product ID | Id Referencial do Protudo | Id Referencial del Produc | Product Reference ID | @! | - | x x x x x x x x x x x x x x x | - | LOJ004 | 1 | x | - | - | - | - | A | R | - | - | - | - | - | - | - | - | - | - | S | - | - | S | - | N | - | - | - | 1 | 2 | - | - | - | 102469 | 0 |
| MGB | 04 | MGB_CODPRO | C | 15 | 0 | Produto | Producto | Product | Codigo do Produto | Codigo del producto | Product Code | @! | Vazio() .OR. ExistCpo('SB1') | x x x x x x x x x x x x x x x x | - | SB1 | 1 | x | - | S | - | - | A | R | - | - | - | - | - | - | - | - | 030 | - | S | - | - | N | - | N | - | - | - | 1 | 2 | - | - | - | 102470 | 0 |
| MGB | 05 | MGB_DESPRO | C | 50 | 0 | Descricao | Descripc | Description | Descricao do Produto | Descripcion del producto | Product Description | @! | IF(!INCLUI, POSICIONE('SB1',1,XFILIAL('SB1') + MGB->MGB_CODPRO, 'B1_DESC'), '' ) | x x x x x x x x x x x x x x x x | - | - | 1 | x | - | - | - | - | V | V | - | - | - | - | - | - | - | - | 171 | - | S | - | - | S | - | N | - | - | - | 1 | 2 | - | - | - | 102471 | 0 |
| MGB | 06 | MGB_QTDPRO | N | 6 | 2 | Qtd Venda | Ctd Venta | Sales Qty | Quantidade de Venda | Cantidad de venta | Sales Quantity | @E 999.99 | NaoVazio() | x x x x x x x x x x x x x x x x | - | - | 1 | x | - | - | - | - | A | R | - | - | - | - | - | - | - | - | - | - | S | - | - | S | - | N | - | - | - | 1 | 2 | - | - | - | 102472 | 0 |
| MGB | 07 | MGB_DESCPR | N | 7 | 2 | Perc. Desc. | Porc. Desc. | Disc. Perc. | Percentual de desconto | Porcentaje de descuento | Discount Percentage | @E 9,999.99 | Positivo() | x x x x x x x x x x x x x x x x | - | - | 1 | x | - | - | - | - | A | R | - | - | - | - | - | - | - | - | - | - | S | - | - | S | - | N | - | - | - | 1 | 2 | - | - | - | 102473 | 0 |
| MGB | 08 | MGB_DESCVL | N | 7 | 2 | Val. Desc. | Val. Desc. | Disc. Vl. | Valor do Desconto | Valor del descuento | Discount Value | @E 9,999.99 | - | x x x x x x x x x x x x x x x x | - | - | 1 | x | - | - | - | - | A | R | - | - | - | - | - | - | - | - | - | - | S | - | - | S | - | N | - | - | - | 1 | 2 | - | - | - | 102474 | 0 |
| INDICE | ORDEM | CHAVE | DESCRICAO | DESCSPA | DESCENG | PROPRI | F3 | NICKNAME | SHOWPESQ | IX_VIRTUAL | IX_VIRCUST | D_E_L_E_T_ | R_E_C_N_O_ | R_E_C_D_E_L_ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| MGB | 1 | MGB_FILIAL+MGB_CODREG+MGB_IDPROD | Cod Regra + Id Produto | Cod Regla + Id Producto | Code Rule + Product ID | S | - | - | S | 2 | 3 | - | 14725 | 0 |
| MGB | 2 | MGB_FILIAL+MGB_CODREG+MGB_CODPRO | Cod Regra + Produto | Cod Regla + Producto | Code Rule + Product | S | - | - | S | 2 | 3 | - | 14726 | 0 |
Ela é utilizada para produtos relacionados dentro do sistema ERP Protheus.
Nesta página você pode visualizar todos os campos, incluindo tipo, tamanho e validações.
Os índices são estruturas que melhoram a performance de busca e acesso aos dados dentro do Protheus.
Modelo de query gerado automaticamente com base na estrutura da tabela.
SELECT
MGB_FILIAL,
MGB_CODREG,
MGB_IDPROD,
MGB_CODPRO,
MGB_DESPRO,
MGB_QTDPRO,
MGB_DESCPR,
MGB_DESCVL
FROM MGB
WHERE
D_E_L_E_T_ = ' '
AND MGB_FILIAL = 'VALOR'
AND MGB_CODREG = 'VALOR'
AND MGB_IDPROD = 'VALOR'
AND MGB_CODPRO = 'VALOR'
AND MGB_DESPRO = 'VALOR'
AND MGB_QTDPRO = 0
AND MGB_DESCPR = 0
AND MGB_DESCVL = 0