1 · D3_CODSource product. SB1->B1_COD in the example.
AdvPL GuideMATA261 via MsExecAuto · estrutura posicional de aLinhaReference guide for developing the MATA261 ExecAuto call in AdvPL, with attention to the positional aLinha structure.
This page documents routine MATA261 from an AdvPL development perspective: how to prepare the structure sent to MsExecAuto, which positions compose aLinha and which cautions matter when validating the automatic routine contract. In versions later than the historical 11.8 sample, aLinha is positional: every value must remain in the exact position expected by the routine, including empty positions. The goal is to serve as a programming reference guide; functional Protheus process explanations may be linked from a dedicated site in the future.
MATA261 via MsExecAuto · estrutura posicional de aLinha1 · D3_CODSource product. SB1->B1_COD in the example.
2 · D3_DESCRISource product description.
3 · D3_UMSource unit of measure.
4 · D3_LOCALSource warehouse. 07 in the example.
5 · D3_LOCALIZSource location. Keep the position even when empty.
6 · D3_CODDestination product. The same code as the source in the example.
7 · D3_DESCRIDestination product description.
8 · D3_UMDestination unit of measure.
9 · D3_LOCALDestination warehouse. 11 in the example.
10 · D3_LOCALIZDestination location. Keep the position even when empty.
11 · D3_NUMSERISerial number when applicable.
12 · D3_LOTECTLSource control lot.
13 · D3_NUMLOTESource lot/sub-lot according to the control used.
14 · D3_DTVALIDSource expiration date. Use CTOD("") when not applicable.
15 · D3_POTENCIPotency. Zero in the example.
16 · D3_QUANTTransferred quantity. aDados[nX][2] in the example.
17 · D3_QTSEGUMSecond-unit quantity. Zero in the example.
18 · D3_ESTORNOReversal indicator/information.
19 · D3_NUMSEQSequence number related to the movement.
20 · D3_LOTECTLControl lot in the destination section. This repeated position is intentional.
21 · D3_DTVALIDExpiration date in the destination section. Use CTOD("") when not applicable.
22 · D3_ITEMGRDGrid item when applicable.
23 · D3_OBSERVAMovement note. OVHL in the example.
This page documents the item-row structure; return values and error handling depend on the MsExecAuto flow used by the caller.
Local aLine := {}
AAdd(aLine, SB1->B1_COD) // D3_COD - source
AAdd(aLine, SB1->B1_DESC) // D3_DESCRI - source
AAdd(aLine, SB1->B1_UM) // D3_UM - source
AAdd(aLine, "07") // D3_LOCAL - source
AAdd(aLine, "") // D3_LOCALIZ - source
AAdd(aLine, SB1->B1_COD) // D3_COD - destination
AAdd(aLine, SB1->B1_DESC) // D3_DESCRI - destination
AAdd(aLine, SB1->B1_UM) // D3_UM - destination
AAdd(aLine, "11") // D3_LOCAL - destination
AAdd(aLine, "") // D3_LOCALIZ - destination
AAdd(aLine, "") // D3_NUMSERI
AAdd(aLine, "") // D3_LOTECTL - source
AAdd(aLine, "") // D3_NUMLOTE - source
AAdd(aLine, CTOD("")) // D3_DTVALID - source
AAdd(aLine, 0) // D3_POTENCI
AAdd(aLine, aData[nX][2]) // D3_QUANT
AAdd(aLine, 0) // D3_QTSEGUM
AAdd(aLine, "") // D3_ESTORNO
AAdd(aLine, "") // D3_NUMSEQ
AAdd(aLine, "") // D3_LOTECTL - destination
AAdd(aLine, CTOD("")) // D3_DTVALID - destination
AAdd(aLine, "") // D3_ITEMGRD
AAdd(aLine, "OVHL") // D3_OBSERVAThe row contains 23 positions and transfers the product from warehouse 07 to 11.
// Referência histórica: estrutura identificada por campo
// { "D3_COD", <valor>, Nil }
//
// Versões posteriores deste guia: estrutura posicional
// AAdd(aLinha, <valor-da-posicao-1>)
// AAdd(aLinha, <valor-da-posicao-2>)
// ...The legacy field-identified format and the later positional format are different contracts.
© 2026 Usina.BR. All rights reserved. TOTVS, Protheus, Microsiga and their respective logos are trademarks of their owners. AdvPL Guide is independent and uses limited, attributed excerpts justified by educational purposes. See the Terms of Use. Terms of Use
Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.