Skip to Content
Technical Articles

Tips – How to generate OTP via C4C absl

Introduction:

A random number generation in C4C usually used to be only UUID which contains alphanumeric characters. But, when we need to create a random number similar to OTP, we had to write either a lengthy logic. But recently SAP has made the PlatinumEngineerging namespace available for PDI developers using which we can generate a random number or in simple terms OTP

Using PlatinumEngineering namespace

We had a requirement where when an agent clicks on a button which should generate an OTP which has to be sent to the ERP system.

There was a post which Senz Evo had raised regarding the same, https://answers.sap.com/questions/12196302/generate-random-numbers.html

But the they were able to retrieve it with UUID and not for just numerical value for OTP.

When looking for alternative namespaces to find if they had any re-use libraries or any standard functions, I came upon the namespace called AP.PlatinumEngineering which had some objects and re-use libraries which have no proper documentation nor any proper blogs written,

Under the namespace, we have a standard re-use library called AddonSupport, which contains another submodule called GetRandomInteger.

 

The syntax for GetRandomInteger is given below:

for GetRandomInteger(lower value,upper value)

var lv_randomvaluesOTP = AddOnSupport.GetRandomInteger(10,1000);

On executing this we would receive a random numeric value between lower and upper value.

Issues which we can expect from this snippet:

It’s better to set the higher limit to a value less than 32 bit because it will result in a dump on execution.

Has anyone ever faced a similar issue and if so, how were you able to resolve it.?

Regards,
Sairam

/
Be the first to leave a comment
You must be Logged on to comment or reply to a post.