Code: Alles auswählen.
ls_documentheader-doc_date = '20230209'. "Belegdatum
ls_documentheader-doc_type = 'SP'. "Belegart
ls_documentheader-comp_code = '1000'. "Buchungskreis
ls_documentheader-pstng_date = '20230209'. "Buchungsdatum
ls_documentheader-header_txt = '*text'. "Belegkopftext
ls_documentheader-username = sy-uname. "User
ls_documentheader-bus_act = 'RFBU'.
ls_documentheader-obj_type = 'BKPFF'. "Referenzvorgang
ls_documentheader-obj_sys = 'FK0CLNT300'.
"Sachkontenzeile 1
ls_accountgl-itemno_acc = 1.
ls_accountgl-gl_account = wrk_xitm40_key-konto1. "Sachkonto
ls_accountgl-comp_code = wrk_xitm40_key-buchungskreis.
ls_accountgl-item_text = wrk_xitm40_key-text1. "Positionstext
ls_accountgl-tax_code = wrk_xitm40_key-steuerkennzeichen1.
ls_accountgl-wbs_element = wrk_xitm40_key-psp_element1.
ls_accountgl-orderid = wrk_xitm40_key-innenauftrag1. "Auftragsnummer
*ls_accountgl-cmmt_item = 'TTECH'. "Finanzstelle
ls_accountgl-alloc_nmbr = wrk_xitm40_key-zuordnung1.
ls_accountgl-costcenter = wrk_xitm40_key-kostenstelle1. "Kostenstelle
ls_accountgl-value_date = wrk_xitm40_key-valutadatum1. "Valutadatum
*ls_accountgl-fund = '0125'. "Finanzposition
ls_accountgl-trade_id = wrk_xitm40_key-partnergesellschaft1.
APPEND ls_accountgl TO lt_accountgl.
CLEAR ls_accountgl.
ls_currencyamount-itemno_acc = 1.
ls_currencyamount-currency = wrk_xitm40_key-waehrung.
ls_currencyamount-amt_doccur = wrk_xitm40_key-betrag1.
APPEND ls_currencyamount TO lt_currencyamount.
CLEAR ls_currencyamount.
"Sachkontenzeile 2
ls_accountgl-itemno_acc = 2. "Positionsnummer
ls_accountgl-gl_account = wrk_xitm40_key-konto2. "Sachkonto
ls_accountgl-comp_code = wrk_xitm40_key-buchungskreis.
ls_accountgl-item_text = wrk_xitm40_key-text2. "Positionstext
ls_accountgl-tax_code = wrk_xitm40_key-steuerkennzeichen2.
ls_accountgl-wbs_element = wrk_xitm40_key-psp_element2.
ls_accountgl-orderid = wrk_xitm40_key-innenauftrag2. "Auftragsnummer
*ls_accountgl-cmmt_item = 'TTECH'. "Finanzstelle
ls_accountgl-alloc_nmbr = wrk_xitm40_key-zuordnung2.
ls_accountgl-costcenter = wrk_xitm40_key-kostenstelle2. "Kostenstelle
ls_accountgl-value_date = wrk_xitm40_key-valutadatum2. "Valutadatum
*ls_accountgl-fund = '0125'. "Finanzposition
ls_accountgl-trade_id = wrk_xitm40_key-partnergesellschaft2.
APPEND ls_accountgl TO lt_accountgl.
CLEAR ls_accountgl.
"in dieser Struktur wird nur itemno_acc & business_entity befüllt
ls_realestate-itemno_acc = 2.
ls_realestate-business_entity = 4000.
*ls_realestate-building = wrk_xitm40_key-gebaeude2.
*ls_realestate-property = wrk_xitm40_key-grundstueck2.
*ls_realestate-rental_object = wrk_xitm40_key-mietobjekt2.
*ls_realestate-flow_type = wrk_xitm40_key-bewegungsart2.
APPEND ls_realestate TO Lt_REALESTATE.
CLEAR ls_realestate.
ls_currencyamount-itemno_acc = 2.
ls_currencyamount-currency = wrk_xitm40_key-waehrung.
ls_currencyamount-amt_doccur = wrk_xitm40_key-betrag2 * -1.
APPEND ls_currencyamount TO lt_currencyamount.
CLEAR ls_currencyamount.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
contractheader = ls_contractheader
customercpd = ls_customercpd
documentheader = ls_documentheader
IMPORTING
obj_key = lv_obj_key
obj_sys = lv_obj_sys
obj_type = lv_obj_type
TABLES
accountgl = lt_accountgl
accountpayable = lt_accountpayable
accountreceivable = lt_accountreceivable
accounttax = lt_accounttax
accountwt = lt_accountwt
contractitem = lt_contractitem
criteria = lt_criteria
currencyamount = lt_currencyamount
realestate = lt_realestate
return = lt_return
valuefield = lt_valuefield
EXCEPTIONS
error_message = 1.
Code: Alles auswählen.
ls_realestate-business_entity = |{ ld_entity_ohne_nullen alpha = in }|.