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

Need help using BAPI_ACC_DOCUMENT_POST

Former Member
0 Likes
566

Hello experts...

I'm finding hard to accomplish the folowing case..

I want to make a payment and use that payment to clear AR accounts... as follow:

-1 Payment to...

-Clear (compansate) 1:n Open AR Accounts

-If there is a difference in amount (Payment vs ARs).. create Resudial Item

I'm using BAPI_ACC_DOCUMENT_POST, but since I'm no ABAPer so I'ts getting really hard for me to understand how to fill the BAPI in order to accomplish the scenario I explained. I would be calling the BAPI from the Portal (EP7) in a WebDynpro App (JAVA), so far I can get customer's open Items and select which ones I want to clear but the thing gets really hard when filling the BAPI as I have no prior experience using that function.

Could you guys PLEASE give me some guidance on how to fill the BAPI, for this case -Stablish payment::Clear ARs::Create Residual Item if needed- examples would be great.

Thanks in advance...

2 REPLIES 2
Read only

Former Member
0 Likes
487

Hi Valencia,

To execute the same you need to fill the BAPI structure with the required input as follows.

wal_header-bus_act = wal_file_data-bus_act.

wal_header-username = sy-uname.

wal_header-comp_code = wal_file_data-comp_code.

wal_header-doc_date = wal_file_data-doc_date.

wal_header-pstng_date = wal_file_data-pstng_date.

wal_header-fisc_year = wal_file_data-fisc_year.

wal_header-fis_period = wal_file_data-fis_period.

wal_header-doc_type = wal_file_data-doc_type.

wal_head-bus_act = wal_header-bus_act.

wal_head-username = wal_header-username.

wal_head-comp_code = wal_header-comp_code.

wal_head-doc_date = wal_header-doc_date.

wal_head-pstng_date = wal_header-pstng_date.

wal_head-fisc_year = wal_header-fisc_year.

wal_head-fis_period = wal_header-fis_period.

wal_head-doc_type = wal_header-doc_type.

endif.

wal_gl_acc-itemno_acc = wal_item_no.

wal_gl_acc-gl_account = wal_file_data-gl_account.

append wal_gl_acc to ptl_gl_acc.

wal_currency-itemno_acc = wal_item_no.

wal_currency-currency = wal_file_data-currency.

wal_currency-amt_doccur = wal_file_data-amt_doccur.

append wal_currency to ptl_currency.

And then pass these structure to BAPI as shown

call function 'BAPI_ACC_DOCUMENT_POST'

exporting

documentheader = wal_header

tables

accountgl = ptl_gl_acc

currencyamount = ptl_currency

return = ptl_return1.

Where Bapi will return the document was posted or not in RETURN Table.

Thanks

Sudharshan

Read only

Former Member
0 Likes
487

Hi,

Open BAPI_ACC_DOCUMENT_POST through SE37 and display the Function Module documentation.You will get the significance of each parameters used in this BAPI.

Since this BAPI is to be called from Webdynpro JAVA.A Model has to be created for calling this BAPI.The Netweaver developer will know how to pass value's to this Function module from Web Dynpro.

I hope this helps.

Thanks!

Harry