Skip to Content
Technical Articles
Author's profile photo Appala Naidu Uppada

Cloud Integration- Working with Number Ranges

Introduction:

SAP Cloud Integration offers Number Ranges to insert unique sequence numbers as part of the inbound or outbound messages. This is one of the highly recommended requirement in EDI message processing. A number sequence is created to help the trading partners to detect and avoid duplicate, missing or out of sequence interchange transmissions.

From July 2018 release of Cloud Integration, Number Ranges are available for consumption for all customers. Earlier, Number Ranges were available only with Enterprise licensed tenants.

In this blog, I will explain in detail on how to configure and consume Number Ranges with few examples of EDI inbound and outbound messages.

Configuring Number Ranges:

To configure Number Ranges, navigate to Monitor->Manage Stores->Number Ranges as shown in the below screenshot.

 

Usecase 1: Using Number Ranges in an EDI outbound scenario:

       Consider an outbound scenario where you receive an IDoc from the ERP and convert it to an ANSI X12 message. Finally sending the converted EDI document to a trading partner. Let’s call the partner as “ABC Industries”.

Consider you have a requirement to generate a new Interchange Control Number each time you are sending an ANSI X12 message.

Create a Number Range:

       Let’s create a Number Range for generating a unique Interchange Control Number, each time an IDoc is converted to an ANSI X12 message.

In this example, I created a Number Range called “ABCIndustries_ICN_IDocToX12” with a field length of 9 (As per ANSI X12 message standard the Interchange Control Number ISA12 field should always be of 9 characters) as shown the below diagram.

 

NOTE:  Interchange Control Number in ANSI X12

Create a Header of Type Number Range in the Integration Flow:

You can consume the Number Ranges in a content modifier as shown in the below diagram. Here I selected the type of the header as “Number Range” and used the number range that I created before ( i.e, ABCIndustries_ICN_IDocToX12 )  as the value .

NOTE:  You can also consume the number ranges in exchange properties as well.

This header will always generate a new unique value each time the integration flow is executed and the next Interchange Control Number is incremented by 1.

Usecase 2: Using Number Ranges with a Correlation:

a) Consider an inbound scenario where you receive a Bulk EDI document with multiple messages ( e.g: 850 ) .Now, you want to maintain the same Interchange Control Number value for all split individual messages. To achieve this requirement, I would declare the header value in the content modifier as

                  ABCIndustries_ICN_X12ToIDoc:${header.SAP_EDI_Interchange_Control_Number}

b)  Let’s consider another scenario, where an AS2 sender adapter retries sending messages to the receiver due to processing failures. In such cases, you do not want to increment the Number Range value for each retry, then declare the value of the header as

               ABCIndustries_ICN_X12ToIDoc:${header. SAP_MessageProcessingLogID}

 Summary:

    We learnt about creating and using Number Ranges in different EDI scenarios. Though the examples show the cases related to EDI message processing, you can use the number ranges wherever you need to generate unique sequence number in your integration scenario.

Assigned tags

      11 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Naresh Dasika
      Naresh Dasika

      Thanks for the Blog Appala Naidu.

      I couldn't see the same option "Number range" on my CPI tenant which is of version 2.41.9.

      Author's profile photo Appala Naidu Uppada
      Appala Naidu Uppada
      Blog Post Author

      Hello Naresh,

      Are you talking about Content Modifier ?

      If yes, please use Web UI to see the option.

      Thanks,

      Appala

      Author's profile photo Naresh Dasika
      Naresh Dasika

      I was asking about the "Number Range" tile under Monitoring tab.

      Author's profile photo Appala Naidu Uppada
      Appala Naidu Uppada
      Blog Post Author

      Hello Naresh,

      It should be there under Manage Stores.

      Please re-check.

      Thanks,

      Appala

      Author's profile photo Naresh Dasika
      Naresh Dasika

      Now I could see. Thanks.

      Author's profile photo Pierre HUGOT
      Pierre HUGOT

      Hi,

      Number range is nice and easy to use at header level, but how could we use it in a mapping (as customer function if required) to get a new number for each item  for exemple ?

      I have a requirement to generate a number which should be unique, and number range might be the best solution.

      Any suggestion is welcome.

      Thanks.

      Pierre

      Author's profile photo Appala Naidu Uppada
      Appala Naidu Uppada
      Blog Post Author

      Hello Pierre,

      As of now, we do not have such function available.We would add this functionality in the near future.

      Meanwhile, you can create a custom function in mapping to consume the header from content modifier.

      Thanks,

      Appala

      Author's profile photo Pierre HUGOT
      Pierre HUGOT

      Hi Appala

       

      Thanks fo your quick reply. In fact the trick to use the header is not really applicable in my case as I may need many numbers during the mapping (depends on message content) so it can't be one header value...

      I just hope this near futur is not too far.

      Regards,

      Pierre

      Author's profile photo Maxime Gillet
      Maxime Gillet

      Hello there,

      How to I use number range in a message mapping? for example to generation multiple unique invoice request ID in ByDesign?

      Thanks

      Author's profile photo Harish KINTALI
      Harish KINTALI

      Dear Community Members,

      In case you are not aware of the possibility to handle number ranges from groovy directly, refer this  link

      import com.sap.it.api.ITApiFactory;
      import com.sap.it.api.nrc.NumberRangeConfigurationService;
      import com.sap.it.api.nrc.exception.NumberRangeConfigException;

      Author's profile photo Ömer Kirdas
      Ömer Kirdas

      do number ranges also work when two processes in parallel access the same number range? How is it decided which process gets the next value?