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.
Showing results for 
Search instead for 
Did you mean: 

BAPI_ACC_GL_POSTING_REV_POST not creating new document number

Former Member
0 Kudos

Dear Mr./Ms. Developer,

I created an accounting doc using BAPI_ACC_GL_POSTING_POST. The doc no. is generated by the BAPI (I entered $ as ref doc no.). Now I want to use BAPI_ACC_GL_POSTING_REV_POST to reverse the doc that I created, how do I make the BAPI generate a new doc no. based on the numbering range in the system rather than I have to enter one?




Active Contributor
0 Kudos

Hi Clarence,

I'm not sure, if I understand your problem, still some comments:

When creating a document with BAPI_ACC_GL_POSTING_POST, you don't need to fill the doc. no. - this will be done by SAP-system (based on number range).

But GL docs have to be linked into a document flow, therefore the preceding document number has to be filled. Have a look into documentation of the BAPI, jump to explanation of 'DOCUMENTHEADER'. There you will find some hints, how AWTYP and AWKEY have to be filled.

Afterwards call FM BAPI_TRANSACTION_COMMIT and you should have information of created document in RETURN parameter (of posting-bapi).

This you can use in further document creation as reference.



0 Kudos

I am having the same problem that Clarence had. If I hardcode the next sequential document number to parameter 'OBJ_KEY', the document posts perfectly. However, I cannot seem to get it to use the SAP assigned number. I would love to read documentation on this BAPI, but I only get a message that that documentation is not maintained in my logon language.

0 Kudos

Hello Chritian,

I have a problem when using this BAPI.

if my original document has a reversal date then the system will reverse that document

otherwise it will not reverse at all.

Do you have any ideas how it could happen? Is there another way to reverse a document without the reversal date by using the BAPI.


Thuy Nguyen

Former Member
0 Kudos

Hi Clarence,

Surprisingly, yesterday I was attempting to use BAPI_ACC_GL_POSTING_POST to upload the flat file through Idocs. The object key and object type field is mandatory to pass the idoc. I have tried many options but it does not work. You said you could do it by entering '$', could you please throw light on how you used it...


0 Kudos

Hello Sidhu,

1- you have to fill the documentheader ( header line of accounting document)

2- you have to fill the folowing tables

accountgl ( lines item )

currencyamount ( the amount and currency of the line item ).

and then call the BAPI.



documentheader = header


obj_type = type

obj_key = key

obj_sys = sys


accountgl = lines

currencyamount = curr

return = return

extension1 = extension.


Thuy Nguyen