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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
*&———————————————————————* *& 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. |