Filling the LZB flag in the Idoc input INVOIC
In certain cases, it is necessary to set the LZB indicator in the IDoc input INVOIC.
The LZB indicator is a mandatory field. The LZB indicator can be filled in userexit EXIT_SAPLIEDI_102 (extension FEDI0001).
The following is an example of coding:
*&———————————————————————* *& Include ZXF06U07 *&———————————————————————* *“———————————————————————- *“*“Lokale Schnittstelle: *“ IMPORTING *“ VALUE(IDOC_CONTRL_INDEX) *“ EXPORTING *“ VALUE(I_FIMSG) LIKE FIMSG STRUCTURE FIMSG *“ TABLES *“ IDOC_CONTRL STRUCTURE EDIDC *“ IDOC_DATA STRUCTURE EDIDD *“ DOCUMENT_DATA STRUCTURE FTPOST1 *“ TAX_DATA STRUCTURE FTTAX *“ ADDITIONAL_DATA STRUCTURE FTPOST1 *“———————————————————————- * Deklarationen —————————————————- * DATA: lv_lzbkz TYPE bseg–lzbkz, lv_lifnr TYPE lifnr, lv_bukrs TYPE bukrs. DATA: ls_doc TYPE ftpost1. * Wenn der Rechnungseingang zu einer IV im anderen Buchungskreis über * das Idoc INVOICE FI gebucht wird, dann wird hier das LZB-KK gefüllt, * da es ein Mussfeld ist. READ TABLE document_data INTO ls_doc WITH KEY fnam = ‚BKPF-BLART‘. CHECK ls_doc–fval = ‚KR‘. READ TABLE document_data INTO ls_doc WITH KEY fnam = ‚RF05A-NEWKO‘. IF sy–subrc = 0. lv_lifnr = ls_doc–fval. ELSE. EXIT. ENDIF. READ TABLE document_data INTO ls_doc WITH KEY fnam = ‚RF05A-NEWBK‘. IF sy–subrc = 0. lv_bukrs = ls_doc–fval. ELSE. EXIT. ENDIF. IF lv_lifnr = ‚CC6060‘ AND „CH ( lv_bukrs = ‚1000‘ OR lv_bukrs = ‚6010‘ ). lv_lzbkz = ‚E ‚. ENDIF. IF lv_lifnr = ‚CC6070‘ AND „UK ( lv_bukrs = ‚1000‘ OR lv_bukrs = ‚5000‘ OR lv_bukrs = ‚6010‘ ). lv_lzbkz = ‚E ‚. ENDIF. IF lv_lifnr = ‚CC6080‘ AND „FR ( lv_bukrs = ‚1000‘ OR lv_bukrs = ‚6010‘ ). lv_lzbkz = ‚E ‚. ENDIF. IF lv_lzbkz = ‚E‘. READ TABLE document_data INTO ls_doc WITH KEY stype = ‚P‘ count = ‚000001‘. IF sy–subrc = 0. ls_doc–fnam = ‚BSEG-LZBKZ‘. ls_doc–fval = ‚E‘. INSERT ls_doc INTO document_data INDEX sy–tabix. ls_doc–fnam = ‚BSEG-LANDL‘. IF lv_lifnr = ‚CC6060‘. ls_doc–fval = ‚CH‘. ELSE. ls_doc–fval = ‚FR‘. ENDIF. INSERT ls_doc INTO document_data INDEX sy–tabix. ENDIF. ENDIF.