J_1B_NF_DOCUMENT_READ Está função faz a leitura dos dados de uma determinada nota fiscal, onde é informado o numero do documento fiscal “DOCNUM” e é retornado as estruturas:
J_1BNFDOC = Cabeçalhos da nota fiscal
J_1BNFNAD = Parceiros da nota fiscal
J_1BNFLIN = Itens da nota fiscal
J_1BNFSTX = Impostos da nota fiscal por itens
J_1BNFFTX = Mensagens de Header da nota fiscal
J_1BNFREF = Notas Fiscais referentes a Header de mensagens
Template: CALL FUNCTION ‘J_1B_NF_DOCUMENT_READ’
EXPORTING
DOC_NUMBER =
IMPORTING
DOC_HEADER =
TABLES
DOC_PARTNER =
DOC_ITEM =
DOC_ITEM_TAX =
DOC_HEADER_MSG =
DOC_REFER_MSG =
DOC_OT_PARTNER =
EXCEPTIONS
DOCUMENT_NOT_FOUND = 1
DOCUM_LOCK = 2
OTHERS = 3.
EXPORTING
DOC_NUMBER =
IMPORTING
DOC_HEADER =
TABLES
DOC_PARTNER =
DOC_ITEM =
DOC_ITEM_TAX =
DOC_HEADER_MSG =
DOC_REFER_MSG =
DOC_OT_PARTNER =
EXCEPTIONS
DOCUMENT_NOT_FOUND = 1
DOCUM_LOCK = 2
OTHERS = 3.
Entrada: DOC_NUMBER = J_1BNFDOC-DOCNUM
Saídas:
DOC_HEADER = J_1BNFDOC
DOC_PARTNER = J_1BNFNAD
DOC_ITEM = J_1BNFLIN
DOC_ITEM_TAX = J_1BNFSTX
DOC_HEADER_MSG = J_1BNFFTX
DOC_REFER_MSG = J_1BNFREF
Exemplo: DATA: BEGIN OF WK_HEADER.
INCLUDE STRUCTURE J_1BNFDOC.DATA: END OF WK_HEADER.DATA: BEGIN OF WK_HEADER_ADD.
INCLUDE STRUCTURE J_1BINDOC.DATA: END OF WK_HEADER_ADD.DATA: BEGIN OF WK_PARTNER OCCURS 0.
INCLUDE STRUCTURE J_1BNFNAD.DATA: END OF WK_PARTNER.DATA: BEGIN OF WK_ITEM OCCURS 0.
INCLUDE STRUCTURE J_1BNFLIN.DATA: END OF WK_ITEM.DATA: BEGIN OF WK_ITEM_TAX OCCURS 0.
INCLUDE STRUCTURE J_1BNFSTX.DATA: END OF WK_ITEM_TAX.DATA: BEGIN OF WK_ITEM_ADD OCCURS 0.
INCLUDE STRUCTURE J_1BINLIN.DATA: END OF WK_ITEM_ADD.DATA: BEGIN OF WK_HEADER_MSG OCCURS 0.
INCLUDE STRUCTURE J_1BNFFTX.DATA: END OF WK_HEADER_MSG.DATA: BEGIN OF WK_REFER_MSG OCCURS 0.
INCLUDE STRUCTURE J_1BNFREF.DATA: END OF WK_REFER_MSG.
INCLUDE STRUCTURE J_1BNFDOC.DATA: END OF WK_HEADER.DATA: BEGIN OF WK_HEADER_ADD.
INCLUDE STRUCTURE J_1BINDOC.DATA: END OF WK_HEADER_ADD.DATA: BEGIN OF WK_PARTNER OCCURS 0.
INCLUDE STRUCTURE J_1BNFNAD.DATA: END OF WK_PARTNER.DATA: BEGIN OF WK_ITEM OCCURS 0.
INCLUDE STRUCTURE J_1BNFLIN.DATA: END OF WK_ITEM.DATA: BEGIN OF WK_ITEM_TAX OCCURS 0.
INCLUDE STRUCTURE J_1BNFSTX.DATA: END OF WK_ITEM_TAX.DATA: BEGIN OF WK_ITEM_ADD OCCURS 0.
INCLUDE STRUCTURE J_1BINLIN.DATA: END OF WK_ITEM_ADD.DATA: BEGIN OF WK_HEADER_MSG OCCURS 0.
INCLUDE STRUCTURE J_1BNFFTX.DATA: END OF WK_HEADER_MSG.DATA: BEGIN OF WK_REFER_MSG OCCURS 0.
INCLUDE STRUCTURE J_1BNFREF.DATA: END OF WK_REFER_MSG.
CALL FUNCTION ‘J_1B_NF_DOCUMENT_READ’
EXPORTING
DOC_NUMBER = ‘890’
IMPORTING
DOC_HEADER = WK_HEADER
TABLES
DOC_PARTNER = WK_PARTNER
DOC_ITEM = WK_ITEM
DOC_ITEM_TAX = WK_ITEM_TAX
DOC_HEADER_MSG = WK_HEADER_MSG
DOC_REFER_MSG = WK_REFER_MSG
EXCEPTIONS
DOCUMENT_NOT_FOUND = 1
DOCUM_LOCK = 2
OTHERS = 3.WRITE: / WK_HEADER-DOCNUM, WK_HEADER-NFTYPE,
WK_HEADER-DOCTYP, WK_HEADER-DIRECT,
WK_HEADER-DOCDAT.
EXPORTING
DOC_NUMBER = ‘890’
IMPORTING
DOC_HEADER = WK_HEADER
TABLES
DOC_PARTNER = WK_PARTNER
DOC_ITEM = WK_ITEM
DOC_ITEM_TAX = WK_ITEM_TAX
DOC_HEADER_MSG = WK_HEADER_MSG
DOC_REFER_MSG = WK_REFER_MSG
EXCEPTIONS
DOCUMENT_NOT_FOUND = 1
DOCUM_LOCK = 2
OTHERS = 3.WRITE: / WK_HEADER-DOCNUM, WK_HEADER-NFTYPE,
WK_HEADER-DOCTYP, WK_HEADER-DIRECT,
WK_HEADER-DOCDAT.
SKIP.LOOP AT WK_ITEM.
WRITE: / WK_ITEM-DOCNUM, WK_ITEM-ITMNUM, WK_ITEM-MATNR,
WK_ITEM-BWKEY, WK_ITEM-BWTAR, WK_ITEM-CHARG,
WK_ITEM-MATKL, WK_ITEM-MAKTX.ENDLOOP.
WK_ITEM-BWKEY, WK_ITEM-BWTAR, WK_ITEM-CHARG,
WK_ITEM-MATKL, WK_ITEM-MAKTX.ENDLOOP.
Nenhum comentário:
Postar um comentário
Observação: somente um membro deste blog pode postar um comentário.