Usually number range objects in b2b addon are used to count the sent messages one after another.
However it is possible by implementing SAP note 2035054, like found in this blog here: NRO access from mapping (ESR), to use the number range objects as a counter within SAP PO.
Let’s say we want do not have the possibility to use a lookup function to ECC or other systems and we need to implement a counter variable accessed and updated within our mappings.
So here is my solution for this by using the number range objects.
For this we will use the combination of the user defined function getNROWithName to fetch the current counter value – and for updating the counter value we will use the user defined function getNROWithName.
The UDF getNROWithName will not update the counter value.
Within the QTY segment we want to populate the field D_6060 with the accumulated already delivered quantity. Further we want to update the value of this counter.
For accomplishing this we need to implement the function getNROwithName. Afterwards we update the counter value with the UDF updateNumberRangeObject.
The UDF getNROWithName reads the current counter value from the NRO and writes it into the field D_6060.
First, the current counter value is fetched and the current delivery quantity for this value is added (upper tree in the illustration). Then, this updated value is used to update the NRO.
Update of the values / Logging of this specific NRO
Within the log of the Number Range Object (NRO) Maintenance you can investigate the behavior of the last calls of this NRO.
- This solution will be implemented relatively quickly.
- After a complete restart of the PO, the old value is still included – unlike other replication methods.
- We stay in the same system (PO) without lookups in other systems.
- This is a business logic implementation within the middleware. This solution is for the department poorly controllable and maintainable.
- If the mapping fails it will still update the NRO value.
- Ideally, the IDoc has the appropriate value (user enhancement / user exit).