‎2020 Sep 21 3:32 PM
I need to add a custom field that does not require between the structures.
give me an example of even a trivial code of how to implement extension structures etc. to pass the field name and value?
‎2020 Sep 21 4:43 PM
Calling report should look something like this for any of the Accounting document update BAPIs:
REPORT YACCT_DOC_UPDATE.
DATA ls_header TYPE bapiache08.
DATA lt_glaccount TYPE STANDARD TABLE OF bapiacgl08.
DATA lt_currency TYPE STANDARD TABLE OF bapiaccr08.
DATA lt_ext TYPE STANDARD TABLE OF bapiextc.
DATA lt_return TYPE STANDARD TABLE OF bapiret2.
* This is copied from an old project. Use any values that make sense to you
lt_ext = VALUE #(
field1 = |{ bkpf-mblnr WIDTH = 10 }{ bkpf-mjahr }{ bkpf-zeile }|
field2 = '0000000005'
field3 = 'YACCT_DOC_UPDATE'
field4 = |{ ekpo-mwskz WIDTH = 2 }{ ekpo-txjcd WIDTH = 16 }| ).
CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
EXPORTING
documentheader = ls_header
TABLES
accountgl = lt_glaccount
currencyamount = lt_currency
extension1 = lt_ext
return = lt_return.LOOP AT extension ASSIGNING FIELD-SYMBOL(<ext>)
WHERE field2 EQ '0000000005'AND field3 EQ 'YACCT_DOC_UPDATE'.
LOOP AT t_accit ASSIGNING FIELD-SYMBOL(<accit>) FROM 5 TO 5.
<accit>-mwskz = <ext>-field4+00(02). "Tax on sales/purchases code
<accit>-txjcd = <ext>-field4+02(15). "Tax Jurisdiction
ENDLOOP.
ENDLOOP.This should be enough to get you started.
‎2020 Sep 23 10:51 AM
I did not understand the procedure well. I need to add the value of the ZTERM field of the BSEG table, but after running the bapi it does not populate the field
‎2020 Sep 25 6:14 PM
I see there is a field ACCIT-ZTERM in structure accit, so the code added to include ZXACCU15 should be:
LOOP AT extension ASSIGNING FIELD-SYMBOL(<ext>)
WHERE field1 EQ 'KEY1'
AND field2 EQ 'KEY2'.
AND field3 EQ 'KEY3'.
LOOP AT t_accit ASSIGNING FIELD-SYMBOL(<accit>).
<accit>-zterm =<ext>-field4.
ENDLOOP.
ENDLOOP.I am using "KEY" values in the first three fields of the EXTENSION record to safely identify the passed values from any other use of this table. If you do not have ABAP resources available the solution proposed by "gaurav.karkara3" may be a better idea.
‎2020 Sep 21 5:39 PM
Most relevant to what you are looking for. Check this.
Gaurav