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: 

BAPI_ACC_DOCUMENT_POST - Document numbers

Former Member
0 Kudos

Hello,

I am using BAPI_ACC_DOCUMENT_POST to post documents in a program. After the documents are posted I want to display the list of document numbers that are posted.

I checked the return table but it doesn't contain document numbers. Only "Document posted successfully" message.

Is there way to get these posted document numbers (BELNR) after posting with BAPI_ACC_DOCUMENT_POST?

thanks

1 ACCEPTED SOLUTION

Former Member

Hi

This is the code I've used to find out the numebr of the posted document:

LOOP AT RETURN.
       IF RETURN-ID     = 'RW' AND RETURN-NUMBER = '605'.
         DOC_NEW-BELNR = RETURN-MESSAGE_V2(10).
         DOC_NEW-BUKRS = RETURN-MESSAGE_V2+10(4).
         DOC_NEW-GJAHR = RETURN-MESSAGE_V2+14(4).
       ENDIF.
    ENDLOOP.

Max

4 REPLIES 4

Former Member

Hi

This is the code I've used to find out the numebr of the posted document:

LOOP AT RETURN.
       IF RETURN-ID     = 'RW' AND RETURN-NUMBER = '605'.
         DOC_NEW-BELNR = RETURN-MESSAGE_V2(10).
         DOC_NEW-BUKRS = RETURN-MESSAGE_V2+10(4).
         DOC_NEW-GJAHR = RETURN-MESSAGE_V2+14(4).
       ENDIF.
    ENDLOOP.

Max

0 Kudos

excellent!

thanks a lot

0 Kudos

hi,

I am also using the same bapi for generating a FI document.

Bapi returns a success message but the document is not visible in FB03.

Plz let me know what else needs to be done.

I have a called a FM BAP_TRANSACTION_COMMIT after the FM BAPI_ACC_DOCUMENT_POST.

So logically i think i am doing the right thing, but its not working

I have gone through lot of threads on the sdn but couldn't find a one which could help me.

Plz suggest.

Regards,

Vinod.

0 Kudos

May be this is little late to answer .. but still it will be better for clarity.

First of all accouting document will be generated only after commit of the BAPI i.e. call BAPI_TRANSACTION_COMMIT after BAPI_ACC_DOCUMENT_POST.

Second to check the accounting document number generated from BAPI

When filling the BAPI interface, leave the following fields empty if the FI document number is to be the reference document number for the posting:

o DOCUMENTHEADER: OBJ_TYPE, OBJ_KEY and OBJ_SYS

o DOCUMENTHEADER and ACCOUNTGL: AC_DOC_NO

o ACCOUNT_GL: STAT_CON, AC_DOC_NO

In the importing paramters

IMPORTING

obj_type = l_type

obj_key = l_key

obj_sys = l_sys

The first 10 character of l_key will contain the FI document number