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 'bapi_acc_document_post'.

Former Member
0 Kudos

hi all,

i'm creating credit memo request thru bapi 'bapi_acc_document_post'.

i'm getting success message for creation of cmr(it is also updating the table bkpf) but

i'm not able to get the document number for created document.

can ne 1 suggest me how to get document number thru bapi in this case.

thanx in advance

Manish

9 REPLIES 9

Former Member
0 Kudos

Hi,

Check if you are using Commit BAPI.

Regards,

Prashant.

former_member188685
Active Contributor
0 Kudos

are you using the exporting parameters

*"  EXPORTING
*"     VALUE(OBJ_TYPE) LIKE  BAPIACHE09-OBJ_TYPE
*"     VALUE(OBJ_KEY) LIKE  BAPIACHE09-OBJ_KEY      "check the object key
*"     VALUE(OBJ_SYS) LIKE  BAPIACHE09-OBJ_SYS

check the OBJ_KEY value.

Former Member
0 Kudos

Hi Vijay,

Thanks for your reply.

I am not getting what to pass in obj_key. Can you please suggest what should I pass in this parameter?

I have passed concatenatio of fiscal year and company code in it.

0 Kudos

Hi Manish,

Better declare a variable of type BAPIACHE09-OBJ_KEY from the FM, then pass it in the FM for the import parameter, obj_key, after executing the FM, the first 10 characters of the variable will give you the document number.

If you are facing problems, just try posting manually in the FM and supply the values in the program as you pass in the FM manually.

This will be a easy way to test the FM. Still more issues please let me know.

0 Kudos

Don't pass any values to them, if the BAPI success then it will return the Document number in l_key (it is a combination of document number and year).

data: l_type like gd_documentheader-obj_type,
        l_key  like gd_documentheader-obj_key,
        l_sys  like gd_documentheader-obj_sys.

    call function 'BAPI_ACC_DOCUMENT_POST'
      exporting
        documentheader    = wa_docheader
        customercpd       =   wa_pcd
        contractheader    = wa_fica_head
      importing
        obj_type          = l_type
        obj_key           = l_key
        obj_sys           = l_sys
      tables
        accountgl         = it_accountgl
        accountreceivable = it_accountreceivable
        accountpayable    = it_accountpayable
        accounttax        = it_accounttax
......

Former Member
0 Kudos

Hi Vijay,

Thanks for your reply.

I am not getting what to pass in obj_key. Can you please suggest what should I pass in this parameter?

I have passed concatenatio of fiscal year and company code in it.

0 Kudos

Hi,

Check this link

[]

Regards,

Surinder

Former Member
0 Kudos

Hi,

Please try with this:

Declare a variable like this:

V_OBJ_KEY type AWKEY.

Pass this to OBJ_KEY.

AWKEY (OBJ_KEY) Reference key

Source document number

The reference key is made up of:

u2022 AWREF Reference document number (10 digits)

Source document number

u2022 AWORG Reference organizational unit (10 digits)

Number range ID (if required)

When the document is being processed, the system checks whether a reference document number (first part of the reference key) has been transferred.

If an accounting document is posted via the interface in Accounting, the sending application transfers a unique reference. It consists of object key and object type. The object key consists of a reference document number and a reference organizational unit.

Example: 1000007899 00011996

Reference Reference organizational unit

document no. client and fiscal year

The object type contains a note on storing the original document.

u2022 AWTYP (OBJ_TYPE) Reference transaction

Sender ID

Regards,

Neenu Jose.

Former Member
0 Kudos

Hi,

Check this may be helpful.

[https://forums.sdn.sap.com/click.jspa?searchID=17223111&messageID=5909249]

[https://forums.sdn.sap.com/click.jspa?searchID=17223111&messageID=5926777]

Rhea.