09-19-2014 10:15 AM
Hi Experts,
I need to update payment reference for GL accounts using BAPI 'BAPI_ACC_DOCUMENT_POST',
but i didnt find a field KIDNO in ACCOUNTGL.
Kindly help.
Regards,
Sami
09-19-2014 10:22 AM
Hi
You can use the extensions (EXTENSION1 or EXTENSION2):
- ENTENSION1 has to be managed by BTE RWBAPI01
- EXTENSION2 has to be managed by BADI ACC_DOCUMENT (method CHANGE)
Max
09-19-2014 10:25 AM
09-19-2014 10:32 AM
Hi,
For ACCOUNTRECEIVABLE,it is available but for ACCOUNTGL I need.
09-19-2014 10:47 AM
Hi
If a field is not available in the BAPI structure you need to use the extension in order to transfer it by yourself
Max
09-19-2014 10:52 AM
Hi,
In extension2 of BAPI_ACC_DOCUMENT_POST ,to which field I need to pass payment reference.
09-19-2014 11:11 AM
Hi
You need to create a your own structure where you insert the link with items and the values of missing fields.
The link will be the item number:
DATA: BEGIN OF MY_STRUCT,
ITEMNO_ACC TYPE POSNR_ACC,
KIDNO TYPE BSEG-KIDNO,
..........................................................
END OF MY_STRUCT.
but it should be better to define the structure in dictionary too
While you fill the data of GL item, you fill the extension2 too:
MY_STRUCT-ITEMNO_ACC = ACCOUNTGL-ITEMNO_ACC.
MY_STRUCT-KIDNO = <kidno>.
EXTENSION2-STRUCTURE = 'MY_STRUCT'.
EXTENSION2+30 = MY_STRUCT.
APPEND EXTENSION2.
So you can get the data from your structure and move them in accounting document by BADI
METHOD CHANGE.
DATA: L_EXTENSION2 TYPE BAPIPAREX.
DATA: L_ACCIT TYPE ACCIT.
LOOP AT C_EXTENSION2 INTO L_EXTENSION2
CASE L_EXTENSION2-STRUCTURE,
WHEN 'MY_STRUCT'.
MOVE L_EXTENSION2+30 TO MY_STRUCT.
READ TABLE C_ACCIT INTO L_ACCIT WITH KEY POSNR = MY_STRUCT-ITEMNO_ACC.
MOVE MY_STRUCT-KIDNO TO L_ACCIT-KIDNO.
..................................................................................
ENDMETHOD.
Max
09-19-2014 11:24 AM
Please check the documentation of the BAPI which clearly explains how to use EXTENSION parameters
09-19-2014 12:21 PM
Hi,
From your code..
Can you confirm 'C_ACCIT' is of what type and its corresponding table name in BAPI ...
09-19-2014 1:11 PM
If you use EXTENSIONI2, you need to implement the BADI ACC_DCOUMENT, method CHANGE
C_ACCIT is the a parameter of that method, here there are all items will posted in the document, the ACCIT has all fields of BSEG: you have to transfer the values of your additional fields from extension
I mean C_ACCIT have all items from:
ACCOUNTGL
ACCOUNTRECEIVABLE
ACCOUNTPAYABLE
ACCOUNTTAX
Max
09-19-2014 1:14 PM
07-06-2015 7:53 AM
Dear Max,
I have the similar request but to populate field BSEG-QBSHB, which is not in the ACCIT structure, so cannot be passed through exension1 or extension2. any idea to populated this field?
For detail, please refer to my recent question: http://scn.sap.com/message/16075074#16075074
Many thanks and best Rewards.
Yuansheng