Skip to Content

B2B Add-on NRO(Number range Object) usage in file name construction

Apr 18, 2017 at 05:34 PM


avatar image


My interface is Proxy(xml)->PI->SFTP(EDIFACT).

I would like to use the sequential number generated by NRO to construct the filename(Ex; EDI_DELFOR_<NRO unique sequential Number>). So i have implemented dynamic configuration UDF in mapping along with required NRO module in receiver file channel but not able to get unique sequential number to filename, rather I am getting a constant value as $B2B_UEBNRTestNRO$B2B_END_UEBNR.

I am able to get a sequential number in file if i mapp this($B2B_UEBNRTestNRO$B2B_END_UEBNR) to one of the field in target structure.


FileName UDF:

public String FileName(String a, Container container) throws StreamTransformationException




DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION); DynamicConfigurationKey key = DynamicConfigurationKey.create("" , "FileName"); conf.put(key,a); return a;


catch (Exception e)


String exception = e.toString();

return exception;

} }

nro.jpg (33.1 kB)
filename.jpg (16.8 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Manoj K Apr 20, 2017 at 06:16 AM


The reason why you are getting value as constant $B2B_UEBNRTestNRO$B2B_END_UEBNR because you are passing the value EDI_DELFOR_$B2B_UEBNRTestNRO$B2B_END_UEBNR as a header level constant and not in the payload , TransmissionNumberModule check only the values in the payload and not at header level hence the value is not replaced with counter.

But when you pass $B2B_UEBNRTestNRO$B2B_END_UEBNR in one of the target filed the this is replaced with the counter as this is present in the target payload.

So if you still want to implement NRO for the filename counter then you need to call the NRO via java api in the mapping level and the increment the value in that case you don't need TransmissionNumberModule.

Check this Blog on how to access NRO API via java at mapping level:

Note to test this you have to run interface from runtime , local ESR test gives error.


Show 8 Share
10 |10000 characters needed characters left characters exceeded

Hello Manoj,

Thank you for your reply.I am using dynamic file name UDF along with $B2B_UEBNRTestNRO$B2B_END_UEBNR in mapping and mapped to root node of target structure. I understand from my message processing logs that Dynamic file name UDF would be called as part of standard "CallSAPAdapter" module that is after NRO module has been executed. So this is why it's not filled with NRO counter value.

You are right, NRO module works for payload only because we need to call NRO module in first place and then standard "CallSAPAdapter" module call at end.

But without going to JAVA API, i am looking for the other options like 1) call NRO module in sender channel and pass it to dynamic UDF 2) Mapp $B2B_UEBNRTestNRO$B2B_END_UEBNR to one of the fields in target structure and variable substitution to resolve this.

I have this thread from other discussions but i am not quite clear what Vishnu Prasad is saying.



To be frank i don't understand the significance of adding NRO module in sender channel ? what is the usage of adding it to sender channel ?

i don't see any other option then using API , you cant go for variable substitution because you have EdifactConverterModule which converts XML to Plain file then after this your variable substitution executes which obviously fails as data is no more in xml format.


Got it manoj. Thank you so much for your detailed explanation.

Ok, i will follow the same approach to call API from mapping using UDF. Let me get the clarity from you what i suppose to do for this.

1) Import the extracted from the PIB2BCONTENT.SCA to the ESR.

2) Use "getNROKey" UDF and mapp like this way below in picture:-

TestNRO is the name of the NRO.

3) So that getNROKey UDF would call TestNRO during mapping and then pass the NRO counter value to Dynamic UDF "FileName" at runtime ?

I do not want to update any NRO value from here during mapping execution. I would like to leave that work to NRO module that i am going to provide in receiver channel. I have to use this NRO module in receiver channel because some of the payload values would need to replace with this NRO counter.

So i hope the UDF "getNROKey" is appropriate just to get the current value inside mapping and then NRO module in file receiver channel also would get the same current value while replacing the payload values.


udf.jpg (21.9 kB)

I don't remember the exact UDF name and currently i don't have B2B Addon in my system, but as per the blog you need to use getNROwithName (To get the current value of NRO) and updateNumberRangeObject (To update the NRO with next counter).

Or else you may use getAndUpdateNumberRangeObjectWithName too. Go through the attached PDF Document in SAP Note 2035054 which may be helpful for you to understand NRO UDF's.

And note as you are accessing API at mapping level the NRO gets updated at mapping level only ( but only in runtime execution) which is before your NRO module execution.




Hello Manoj,

>>And note as you are accessing API at mapping level the NRO gets updated at mapping level only ( but only in runtime execution) which is before your NRO module execution.

Does it mean that if i execute the interface, at mapping level it would be updated once and at NRO module execution it would be updated one more time?

Example: Lets assume that the current value is 10 and interface is executed, then from mapping NRO API would be called to get the current value as 10 and update it as 11. Next NRO module would be called and it will get 11 as current value and would be updated as 12. If this is the case it would be problem in my business use case as i need to get the same number for file name portion and payload.



No the particular NRO variable which you are accessig via api will be updated at mapping execution only it wont be updated at Module level again.

But those left out NRO variable which u r not accessing via api will be updated at module level.


Hello Manoj,

I have the jar file from PIB2BCONTENT.SCA and imported to my custom SWCV of namespace. But i am confused how to set the dependency with this imported archive in function library.

Below lines from SAP Note : 2035054


The extracted ‘.jar’ file ( from the ‘PIB2BCONTENT.SCA’ archive should beimported into the repository as an “Imported Archives” object.A newly or an existing function library should be used with this new imported archive as a dependency.


Show more comments