Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
JonathanEemans
Active Contributor
26,730

Introduction


Standard SAP functionality allows parking accounting documents before finally posting these documents. Parking can be used to enter and store (in)complete documents in the SAP system, without carrying out extensive entry checks. These parked documents can be completed, checked and then posted at a later date.

When registering accounting documents via interface and not directly online in your SAP environment, the same business application programming interface (BAPI) is used as for posting accounting documents. This is BAPI_ACC_DOCUMENT_POST.

Some fields have to be filled with specific values to park accounting document via BAPI_ACC_DOCUMENT_POST. OSS note 2092366 explains how to park an accounting document using BAPI_ACC_DOCUMENT_POST.

 

Example program to park accounting document via BAPI_ACC_DOCUMENT_POST


I share with you a test program which parks an accounting document with vendor line using BAPI_ACC_DOCUMENT_POST. The fields to be changed to post in your SAP environment are marked with 'To be changed !'
!'*&---------------------------------------------------------------------*

*& Report ZTEST

*&---------------------------------------------------------------------*

*& Test program to park document using BAPI_ACC_DOCUMENT_POST

*&---------------------------------------------------------------------*

REPORT ZTEST.



* Work Areas

DATA: gs_documentheader TYPE bapiache09 ##NEEDED,

gs_accountpayable TYPE bapiacap09 ##NEEDED,

gs_currencyamount TYPE bapiaccr09 ##NEEDED,

gv_obj_key TYPE awkey ##NEEDED,

gs_err_tab TYPE bapi_msg ##NEEDED,

gs_return_format TYPE bapiret2 ##NEEDED.



* Tables

DATA: gt_documentheader TYPE STANDARD TABLE OF bapiache09 ##NEEDED,

gt_accountpayable TYPE STANDARD TABLE OF bapiacap09 ##NEEDED,

gt_currencyamount TYPE STANDARD TABLE OF bapiaccr09 ##NEEDED,

gt_return TYPE STANDARD TABLE OF bapiret2 ##NEEDED.



* Fill header structure

gs_documentheader-bus_act = 'RFBV'. "Business Transaction set as per SAP Note 2092366

gs_documentheader-username = sy-uname. "User name

gs_documentheader-header_txt = 'TEST'. "Document Header Text

gs_documentheader-comp_code = 'BEN0'. "Company Code - To be changed!

gs_documentheader-doc_date = sy-datum. "Document Date in Document

gs_documentheader-trans_date = sy-datum. "Translation Date

gs_documentheader-pstng_date = sy-datum. "Posting Date in the Document

gs_documentheader-doc_type = 'KR'. "Document Type - To be changed!

gs_documentheader-ref_doc_no = 'TEST'. "Reference

gs_documentheader-doc_status = '2'. "Document status set as per SAP Note 2092366



APPEND gs_documentheader TO gt_documentheader.



* Fill vendor structure

gs_accountpayable-itemno_acc = '0001'. "Accounting Document Line Item Number

gs_accountpayable-vendor_no = '0000895746'. "Account Number of Vendor or Creditor - To be changed!

gs_accountpayable-partner_bk = '0001'. "Partner Bank Type - To be changed!

gs_accountpayable-pmnttrms = '00AA'. "Terms of Payment Key - To be changed!

gs_accountpayable-pmnt_block = ''. "Payment block key

gs_accountpayable-pymt_meth = ''. "Payment method

gs_accountpayable-comp_code = 'BEN0'. "Company Code - To be changed!



APPEND gs_accountpayable TO gt_accountpayable.



* Fill amount structure



gs_currencyamount-itemno_acc = '0001'. "Accounting Document Line Item Number

gs_currencyamount-curr_type = '00'. "Currency Type and Valuation View

gs_currencyamount-currency = 'EUR'. "Currency Key

gs_currencyamount-amt_doccur = '1000.00'. "Amount



APPEND gs_currencyamount TO gt_currencyamount.



* Call BAPI to park the document



CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = gs_documentheader

IMPORTING

obj_key = gv_obj_key

TABLES

accountpayable = gt_accountpayable

currencyamount = gt_currencyamount

return = gt_return.



CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'. "Set flag for wait for so that commit happens successfully

 

Conclusion


BAPI_ACC_DOCUMENT_POST can be used to park accounting documents in SAP.

 

Useful reference


OSS note 2092366: https://launchpad.support.sap.com/#/notes/2092366
15 Comments
Labels in this area