Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to transfer data to custom-field when calling BAPI_ACC_DOCUMENT_POST

former_member249594
Participant
0 Likes
3,429

Dear Experts,

I want to post the GL document through BAPI_ACC_DOCUMENT_POST but had met error messages because of some custom-fields.

In our FI document we add two custom field in the COBL ( .INCLUDE CI_COBL). When I create the GL doc through BAPI_ACC_DOCUMENT_POST I don't know how to transfer the data to this custom-fields. do you any example coding on this case? Or any can point me a direction?? Thanks in advance.

Best Regards

Joe

4 REPLIES 4
Read only

JozsefSzikszai
Active Contributor
0 Likes
1,659

hi Joe,

you have to transfer these fields through tables EXTENSION2. After you have to find a user exit where you have this data and you can modify your custom fields. Pls. check the call_customer_function form routine in the BAPI for finding a suitable exit.

hope this helps

ec

Read only

former_member249594
Participant
0 Likes
1,659

Hi Eric, Thanks for your response. After check the system, I fond that the two custom-fields was not added by BADI or customer function, but through Special Purpose Ledger in configeration(TCODE OXK3). So I am afraid that EXTENSION2 and EXTENSION1 is not meet my technical req. Other any suggestions?? Thanks.

Best Regards

Joe

Read only

Former Member
0 Likes
1,659

The fields must already exist on the FI interface definition structures: ACCIT

The general process for adding Customer fields to the BAPI structures is:

1. Do an SE11 on the BAPI structure(s) such as BAPIACAR09, BAPIACGL09 etc.

2. click on the u201CAppend structureu201D button, and enter the fields you want to add. Save and activate the changed BAPIAC* structure.

3. Do an SE11 on the appropriate related structure ACCBAPIFDn , where n=1 to 6. Note that for OSPI we used ACCBAPIFD5 for additional line item fields, although it looks like ACCBAPIFD1 would/should also work. Add the same fields you added in step 2. Make sure the field names are exactly the same in both the ACCBAPIFD* and BAPIAC* structures that youu2019ve changed.

4. Change your program code to fill the new fields in the BAPIAC* structure with the appropriate values. Eg. GS_BAPIACAR09-ZZBILIND = u2018PRu2019 prior to calling he ACC_DOCUMENT_CHECK/POST functions.

5. Do an SE18 for BADI ACC_DOCUMENT. Select the u201Cinterfaceu201D tab. Select the method FILL_ACCIT. Add parameter C_BAPI_ACCIT of type ACCBAPIFDn (the structure you changed in step 3). Save and activate.

6. Do an SE19. Create/modify an implementation for the ACC_DOCUMENT definition (from step 5). In method FILL_ACCIT, enter code to move the new fields from the C_BAPI_ACCIT structure to the C_ACCIT structure. Ex: c_accit-btype = c_bapi_accit-zzbilind.

7. Activate the BADI.

8. Test: You can set a break-point in FILL_ACCIT code (step 6).

Read only

0 Likes
1,659

Hello Lance.

Till point 4 everything was clear. But moving forward with point 5 is difficulty because there is no ACC_DOCUMENT BADI. I would be very appreciate for any hint.

Chris