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: 

Document Numbers & BAPI's

Former Member
0 Kudos

Hi,

I'm using various BAPI's to perform functions such as to park an invoice when no purchase order is available.

If I do not change the document number when creating a new entry, the system "dumps", because the document number is already in the database.

What is the best way to ensure I have a unique document number before calling the BAPI, should I just create an internal table based on findinf the document number I am trying to insert, or is there a function available which does this already?

Thanks...

7 REPLIES 7

christian_wohlfahrt
Active Contributor
0 Kudos

Hi Sims,

you should use number ranges. I would advise an internal number range, then SAP handles number assignment automatically.

If internal number ranges can't be assigned, define your own number range (SNRO) and use function module NUMBER_GET_NEXT to get unique numbers.

Regards,

Christian

0 Kudos

Hi,

can't use number ranges, the customer is passing in the document number they would like to use, and then it is up to me to check if it is unique or pass back an error message

0 Kudos

Hi,

have you checked out BAPI_DOCUMENT_EXISTENCECHECK?

-Mikko

Sorry this was applicable to DMS only after checking it out.. I'd go with external number ranges where you can have your own document numbers if they are just included in the range you define. You should get an error message if the number has already been reserved.

Message was edited by: Mikko Mäki-Rahkola

Message was edited by: Mikko Mäki-Rahkola

0 Kudos

Hi,

if you should change the number, then number ranges are an option.

If you should raise an error, then a simple select will give you your answer. But then no document will be created, that's the result of ERROR message.

Regards,

Christian

0 Kudos

Hi tried the BAPI, not really sure which document type I should be using for Parked invoices, tried a few , which did not work.

0 Kudos

Hi Sims,

my mistake, sorry. The BAPI was only for DMS documents as I stated before.

If not finding any bapi's and the table lookup is not an option, I'd go with the external number ranges.

-Mikko

0 Kudos

Hi,

table select is not an option? Isn't RBKP holding the data?

By the way: if you should raise a message and still book the document, then use the external number range in this exception cases.

Regards,

Christian