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 resolve these errors in BAPI_ACC_DOCUMENT_POST

Former Member
0 Likes
4,119

Hi all,

I have a requirement to post in F-28.For that I have coded BAPI_ACC_DOCUMENT_POST with code attached as below.

I am getting following errors,

Error in document: BKPFF $ AHDCLNT130

FI/CO interface: Line item entered several times

I have passed only one record to the BAPI,the internal tables also have one records when checked through debugging.

Code for BAPI :

CLEAR : DOCUMENTHEADER,ACCOUNTGL,ACCOUNTRECEIVABLE,CURRENCYAMOUNT.
   REFRESH : ACCOUNTGL[],ACCOUNTRECEIVABLE[],CURRENCYAMOUNT[].
   DOCUMENTHEADER-OBJ_TYPE = OBJ_TYP.
   DOCUMENTHEADER-OBJ_KEY = OBJ_KEY.
   DOCUMENTHEADER-OBJ_SYS = OBJ_SYS.
   DOCUMENTHEADER-HEADER_TXT = DOCTXT.
   DOCUMENTHEADER-USERNAME = SY-UNAME.
   DOCUMENTHEADER-COMP_CODE = IT_ALL-PROJECT.
   DOCUMENTHEADER-DOC_DATE = DOCDT.
   DOCUMENTHEADER-PSTNG_DATE = POSTDT.
   DOCUMENTHEADER-FISC_YEAR = POSTDT(4).
   DOCUMENTHEADER-DOC_TYPE = 'DZ'.
   DOCUMENTHEADER-AC_DOC_NO = IT_ALL-VBELN.
   DOCUMENTHEADER-REF_DOC_NO = IT_ALL-CHQNO.

* ACCOUNTGL-ITEMNO_ACC = '0000000001'.
   ACCOUNTGL-GL_ACCOUNT = BANKGL.
   ACCOUNTGL-ITEM_TEXT = BANKTXT.
   ACCOUNTGL-BUS_AREA = 'R001'.
   ACCOUNTGL-ACCT_TYPE = 'D'.
   ACCOUNTGL-CUSTOMER = IT_ALL-KUNNR.
   APPEND ACCOUNTGL.

   ACCOUNTRECEIVABLE-CUSTOMER = IT_ALL-KUNNR.
   APPEND ACCOUNTRECEIVABLE.

CURRENCYAMOUNT-ITEMNO_ACC = '0000000001'.
   CURRENCYAMOUNT-CURRENCY = CURR.
   CURRENCYAMOUNT-AMT_DOCCUR = IT_ALL-RECA.
   APPEND CURRENCYAMOUNT.

   CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
     EXPORTING
       DOCUMENTHEADER    = DOCUMENTHEADER
*     CUSTOMERCPD       =
*     CONTRACTHEADER    =
     IMPORTING
       OBJ_TYPE          = OBJ_TYP
       OBJ_KEY           = OBJ_KEY
       OBJ_SYS           = OBJ_SYS
     TABLES
       ACCOUNTGL         = ACCOUNTGL
       ACCOUNTRECEIVABLE = ACCOUNTRECEIVABLE
*     ACCOUNTPAYABLE    =
*     ACCOUNTTAX        =
       CURRENCYAMOUNT    = CURRENCYAMOUNT
*     CRITERIA          =
*     VALUEFIELD        =
*     EXTENSION1        =
       RETURN            = RETURN
*     PAYMENTCARD       =
*     CONTRACTITEM      =
*     EXTENSION2        =
*     REALESTATE        =
*     ACCOUNTWT         =
     .

   CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*   EXPORTING
*     WAIT          =
    IMPORTING
      RETURN        = RETURN.

Please guide

5 REPLIES 5
Read only

former_member201275
Active Contributor
0 Likes
1,508

Maybe there is still data in the Header i.e. after 'APPEND ACCOUNTGL.' insert command 'CLEAR ACCOUNTGL.' to clear out the header data. Do the same for the other 2 itabs.

Read only

AnoopMayamkote
Participant
0 Likes
1,508

what error you are getting in the return internal table..??

Read only

amitkumar24
Explorer
0 Likes
1,508

Hi Pratik,

Enter line item details for customer as line item 2. Enter the currency amount for that item too.

-Regards,

Amit

Read only

0 Likes
1,508

Hi Amit,

i did as per ur suggestion now error has changed to

Account 24100200 in company code 9000 is not a reconciliation account

I am passing this gl as bank gl, according to my functional the bank gl need not be reco acnt.

and the error Error in document: BKPFF $ AHDCLNT130 still persists.

Read only

Former Member
0 Likes
1,508

Hi

The first thing is this BAPI is not for payment

Max