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

Former Member
0 Kudos

Hi,

I have assigned a document number range to a sales document type. But I do a lot of simulations of creation of sales orders, contracts etc. They are assigned numbers but are not saved. But the document number is lost. Is there any way, I can renew the document number and assign the same document number to a different new contract or a sales order.

Regards,

Vijay

12 REPLIES 12

Former Member
0 Kudos

Hi Vijay,

enter transaction SNRO and choose the object you want to change. Then, in "Change status" you may want to change the actual number of assigned document number.

Or, in the transaction you entered to assign document range to document type (that is, VN01), go to "Change status" and proceed as above.

I hope it helps. BR,

Alvaro

Message was edited by: Alvaro Vidal-Abarca

andreas_mann3
Active Contributor
0 Kudos

No, you can only reset the number(only internals) with

SNRO - interval - change current number

0 Kudos

If I reassign the contract numbers, would it just ignore the contract numbers already assigned to other contracts, or would it give an error.

0 Kudos

exactly Max, I didn't do a BAPI COMMIT. So now how do I retrieve those lost numbers to use them.

0 Kudos

Any help on this guys?

Regards,

Vijay

0 Kudos

Resetting of the current number in the range can be done using transaction SNRO..Enter the number range object and click on the "Number Ranges" button and then inside click on the "Change Status" button...you can reset the current number here...

However, be careful of doing this and make sure there aren't any documents in the system with the values above the number you are resetting it to....

0 Kudos

what would happen then if there are documents larger than the number that I set it to?

Regards,

Vijay

0 Kudos

then it would cause a problem when the number range hits a number with a document number already existing in the DB to cause key violation...

for ex: take this instance...

- you lost the number 5 becuase of the commit not being made...

- meanwhile some body saved documents online with numbers 6,7,8

- now you are resetting the number range back to 5...

- when document 5 is created no problem...however when the numbers 6,7,8 are used in subsequent save document attempts(could be online/bapi etc...) it is going to fail...

hope i am clear...

0 Kudos

yes renjith, but then it should definitely fail shouldn't it. we won't want to override the document numebrs 6,7,8. Would it try the next number till it keeps failing. Say in our instance, it tries to create 6, 7, 8 and then 9. Then doc number 9 would be successfully created wouldn't it. Or will there be some other problems.

Regards,

Vijay

0 Kudos

i think (i am 99% sure...) the system does not retry if posting fails(with 6,7,8...)...

thanks,

Renjith

Former Member
0 Kudos

Hi

How have you simulated the creation of order?

If you use the BAPI without to do a commit, the document isn't stored and the number is lost.

Max

Former Member
0 Kudos

The system won't keep trying until it finds the next successful document number. When it fails to create a sales document due to key violations, you could then go set the current number to the next unused document number via SNRO. You could always check into table VBAK and see what is the lastest sales document number saved, and use that to save the current number in SNRO transaction.