Application Development 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: 

didn't get any reference document number after posting the bapi but getting successfully posted

0 Kudos
708

I am uploading the data through bapi_Acc_document_post. for fb60. I got the succcess messsgae "posted succcessfulIy" . but here the question is :data not updated in table. and I didn't get any reference document number(BELNR) after getting the success message.plz help on this urjent. I called bapi_transcation_commit. tried all the possibilities. will the bapi doesn't work or bdc will work??

6 REPLIES 6

ponrajasekharan
Participant
0 Kudos
511

Hi vinay_krishna

Call CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' after Bapi

Regards ,

Ponrajasekharan.

0 Kudos
511

Hi ponrajasekharan,

I did that, I called bapi_transcation_commit after the bapi

I am getting this message : " document posted successfully". I checked bapi_transcation_commit in debug mode also. still data not updated.I am not getting any BELNR no. I checked in SM13 also.

0 Kudos
511

Hi ,

Try this and Check for return messages .

 call function 'BAPI_TRANSACTION_COMMIT' 
exporting
wait = 'X'.

0 Kudos
511

Hi ponrajasekharan, I tried that. As I am getting sucess message " document posted successfully". In return message. data is not updated in table and i didn't get any refermce doc. no(belnr) created. message.

here is my code

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
DOCUMENTHEADER = LS_DOCHEADER
* CUSTOMERCPD =
* CONTRACTHEADER =
IMPORTING
OBJ_TYPE = LV_OBJTYP
OBJ_KEY = LV_OBJKEY
OBJ_SYS = LV_OBJSYS
TABLES
ACCOUNTGL = LT_GLACCT
* ACCOUNTRECEIVABLE =
ACCOUNTPAYABLE = LT_ACTPAY
* ACCOUNTTAX =
CURRENCYAMOUNT = LT_CURRAMT
* CRITERIA =
* VALUEFIELD =
* EXTENSION1 =
RETURN = LT_RETURN
* PAYMENTCARD =
* CONTRACTITEM =
* EXTENSION2 =
* REALESTATE =
* ACCOUNTWT =
.


IF LS_DOCHEADER IS NOT INITIAL.


READ TABLE LT_RETURN WITH KEY TYPE = 'S' INTO LS_RETURN.
IF SY-SUBRC = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
WRITE / : 'SUCCESS - ' , LS_RETURN-MESSAGE, LS_RETURN-PARAMETER..
CLEAR LS_RETURN.
ELSE.
LOOP AT LT_RETURN INTO LS_RETURN.
IF LS_RETURN-TYPE = 'A' OR LS_RETURN-TYPE = 'E'.
WRITE / : 'FAIL - ' , LS_RETURN-MESSAGE, LS_RETURN-PARAMETER, LS_RETURN-ROW .
ENDIF.
ENDLOOP.
ENDIF.

0 Kudos
511

Hi Vinay Krisha

Check this thread ,https://answers.sap.com/answers/9158422/view.html

From the thread it may be helpful for this .

Check the values being returned by BAPI in OBJ_TYPE, OBJ_KEY, OBJ_SYS parameters. You are checking the correct values in OBJ_KEY in FB03 with correct year and company code. The OBJ_SYS is the system in which you are checking the document. Check whether there is any update termination occured in SM13. Also try giving wait = X in BAPI_TRANSACTION_COMMIT.

raymond_giuseppi
Active Contributor
0 Kudos
511

Did you

  • Use WAIT option in BAPI_TRANSACTION _COMMIT.
  • Loop in the RETURN table for a 605(RW) or 638(RW) type S message.
  • Read BKPF with the keys provided by the message parameters (AWTYP, AWKEY, AWSYS)

NB:

  • If you get AWTYP = 'BKPFF' then AWKEY will already be concatenation of BELNR, BUKRS and GJAHR so you aren't actually required to read BKPF. (In this case the WAIT option is not required for COMMIT)
  • If BKPF record not found you could use a WAIT UP TO 1 SECONDS but don't trigger a loop that could trigger performance problems.