cancel
Showing results for 
Search instead for 
Did you mean: 

How to use BAPI_ACC_DOCUMENT_POST to Park

Former Member
0 Kudos

Hi,

We recently patched SAP Note Note 1282005 - Parking using the accounting interface.

We already have an existing customised program which calls BAPI_ACC_DOCUMENT_POST to post FI documents.

Anybody knows how we can park a document using BAPI_ACC_DOCUMENT_POST?

Is it a particular parameter to pass to the BAPI?  But I can't seem to find any.

Any advice?

Thanks.

Accepted Solutions (0)

Answers (3)

Answers (3)

carlos_mayka
Explorer
0 Kudos

You can park documents via BAPI_ACC_DOCUMENT_POST just sending the value 2 into the parameter doc_status in the header structure.

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

*& 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
raymond_giuseppi
Active Contributor
0 Kudos

You can use BAPI_ACC_DOCUMENT_POST, you need to set :

the status of the document to "parked" (the field T_ACCHD-STATUS_NEW is changed to 2 or 3) using an implementation of the Business Transaction Event (BTE) RWBAPI01 or of the BAdI AC_DOCUMENT

Regards,

Raymond

0 Kudos

Hi Raymond,

Thanks a lot for the input, its worked out..

Thanks & Regards,

Ayyappan.V

raymond_giuseppi
Active Contributor
0 Kudos

Be aware, that this is a temporary solution (until some upgrade of your system ?)  1951302 -  Document parking through BAPI_ACC_DOCUMENT_POST as of 12.05.2013... Seems somebody at SAP intends to close this door.


Regards,

Raymond

iklovski
Active Contributor
0 Kudos

But, there is equally a new note, which make this parking legit

2092366 - Parking with BAPI_ACC_DOCUMENT_POST

0 Kudos

Hi Eli,

Its very useful information, thanks a lot

Regards,

Ayyappan.V

0 Kudos

Hi Eli,

I tried to implement the note 2092366 but the implementation status of this note is set to 'Cannot be implemented'. Can you let me know how I can

implement this note.

Thanks & Regards,

Ayyappan.V

raymond_giuseppi
Active Contributor
0 Kudos

Only by upgrade to corresponding SP... 

raymond_giuseppi
Active Contributor
0 Kudos

Yes, I missed this one (But now we are sure that SAP suffers from Dissociative identity disorder )


Nevertheless, some adjustment could  be required?

iklovski
Active Contributor
0 Kudos

I believe, if you modify the structure as explained in the note and play with status, it might be sufficient. Though, I didn't try it yet.

iklovski
Active Contributor
0 Kudos

Yes, sounds worrying Maybe, watched too much 'Identity' picture

vkaushik82
Active Participant
0 Kudos

Hi Ayyappan/Raymond/Eli

Have you implemented this note.

We tried implementing Note 2092366 in our system to park the document, but while testing it is always posting and not parking the document even if passing doc-status as 2 or 3.

Do you know solution to this problem or any other pointers will be helpful.


Regards,

Vikrant

iklovski
Active Contributor
0 Kudos

You cannot implement the note, but only the whole package. We decided at our side to work with another BAPI ( BAPI_ACC_GL_POSTING_POST) with user-exists in order to park the document.

iklovski
Active Contributor
0 Kudos

Hi,

You cannot park a document with this BAPI. Instead, you can use BAPI_INCOMINGINVOICE_PARK.

Regards,


Eli