How to Restore SAP Number Range Object?

SAP ABAP Tips and Tricks
Share on Facebook5Share on LinkedIn5Tweet about this on TwitterShare on Google+2
Please Share!!

SAP Number Range Object and Maintenance

Context: God forbidden, if there is a Production outage due to Database corruption, and your DB Admin team is not able to restore the system fully then a good amount of data would be lost. You may need to prevent the system from generating duplicate Orders/Deliveries/Invoices etc.

In such situations (like outage in production/inconsistency in a system due to DB corruption etc.)  you may not be able to recover data till the time the system went down or inconsistency was found and  you want to restore the number range objects in the system to avoid duplicate numbers being generated and sent to customers or to downstream systems.

Check the number range object definition in transaction SNRO/SNUM.

SAP Number Range

Navigate to Customizing and check the Buffering option.

Buffering option

sap tips and tricks

Also Read: Very different external debugging command /next user =  username

Depending on the possible values of the buffer field (P/X/S/BLANK); we will have following cases.

Case 1: If the buffering option is ‘P’ (Local Buffer)

  • Run the SAP standard ‘NK_REORGANIZE’ in ‘Test’ mode first and if things look good then run it in ‘Production’ mode.

NK_REORGANIZE

To run this report fill the mandatory field ‘Object’ as the number range object. If needed we can use  Sub-object, Interval, To Year and Instance (Application server instances) to limit the updates. To re-organize the whole number range object itself; we can only run with the name of the number range object.  Upon execution, the program will DELETE the entries from table ‘NRIV_LOKAL’ and few entries from this table will be restored in table ‘NRIV_RESTE’ for reference.

Case 2: If the buffering option is ‘S’ (Parallel Buffering)

  • Run the SAP standard ‘NK_REORGANIZE’ in ‘Test’ mode first and if things look good then run it in ‘Production’ mode.

Parallel Buffering

To run this report follow the same approach as described in point # 1 above. Upon execution, the program will DELETE the entries from table ‘NRIVSHADOW’ and few entries from this table will be restored in table ‘NRIV_DOCU’ for non-assigned internal numbers.

Case 3: If the buffering option is ‘X’ (Main Memory Buffering)

  • We need to run transaction SM56 to clear the buffer.

Main Memory Buffering

Number Range Buffer

To view the existing number range buffer for such number range objects where Main Memory Buffering (‘X’) is selected follow the following navigation in t-code SM56.

SAP ABAP Training Free

outage of Production System

If needed change the ‘NRLEVEL’ of the number range objects which are impacted in SNRO, manually. If a mass change is required, a custom program can be written to advance the number ‘NRLEVEL’ to the desired by calling FM ‘NUMBER_GET_NEXT’.

Also Read: Back door entry into SAP Tables

Recommendations: In many production systems we are still using old customizing configuration i.e.  ‘P’ – Local Buffering for few number range objects. In this scenario, SAP is updating all buffered entries in table NRIV_LOKAL – Local NRIV for multiprocessor machines (This tables entries are dependent on SAP Application Instance and Dialog process). SAP is no more supporting Local Buffering.

SAP is recommending to use  ‘S’ – Parallel Buffering. So when ‘S’ – Parallel Buffering, is activated, entries are stored in the table NRIVSHADOW – Local NRIV for multiprocessor machines.

Interested in ABAP for SAP HANA? Create your first program in HANA ABAP.

We put a lot of effort in conceptualizing, testing and writing each and every article. If you could pass this link to at least 5 colleagues/friends who you think would benefit from our post, it would be a great favor to our team. We want our articles to reach to as many audiences as possible so that everyone would benefit and our team would remain motivated and our work does not get lost in this huge ocean of the internet.

Please, please share our post in your professional and social media and introduce your friends/colleagues/co-workers to our blog page.

Share on Facebook5Share on LinkedIn5Tweet about this on TwitterShare on Google+2
Please Share!!

About the Author

Chinmaya Das
Chinmaya Das
Qualification: M.Tech from IIT Kharagpur, India. SAP ABAP Experience since 2006. Find more about him on LinkedIn.

Be the first to comment on "How to Restore SAP Number Range Object?"

Please help us improve. Please Shout Often & Loud!!