cancel
Showing results for 
Search instead for 
Did you mean: 

Counter should start from first for each delivery

0 Kudos

Hi Experts,

Scenario: File to IDOC(DELVRY03)

We have a requirement that the field POSNR count should start from 900001 to 9000XX based on line items and this has to start from 900001 again for another delivery.

Earlier we have a rule "multiple deliveries in One IDOC", this case we used Counter funtion and it worked .

Counter => POSNR

Now the rule has changed "One IDOC for each Delivery", for this case we need to generate the counter from 900001 for each delivery.

Could you please let me know, can we get the logic from PI mapping fuctions? Or do we need to write an UDF?

Please do the helpful.

Regards,

Sunitha

Accepted Solutions (1)

Accepted Solutions (1)

former_member182412
Active Contributor
0 Kudos

Hi Sunitha,

Use Index function.

Regards,

Praveen.

0 Kudos

Thank you so much Praveen.

By using "index" and "splitByValue" function, now this is working.

Message was edited by: Sunitha Bai

Answers (2)

Answers (2)

manoj_khavatkopp
Active Contributor
0 Kudos

Sunitha,

Check if the below meets your requirement , assuming you POSNR filed or parent field has occurrence 0..99

UDF:

Inp:var1  Exec Type:All values of queue


int len = var1.length;

for(int i = 0; i<len; i++)

    {

     result.addValue(900000+i);

 

    }

Mapping: you may use split by each value after counter udf to appear value in next context

Output for 5 line Items :

Br,

Manoj

former_member186851
Active Contributor
0 Kudos

Hello Sunitha,

Is it like for every File the POSNR value should be incremented?

If yes,the below discussion should help you