cancel
Showing results for 
Search instead for 
Did you mean: 

UDF required For Loop

former_member1275317
Participant
0 Kudos

HI Friends

I need a UDF to iterate the loop with Number of Formids in the given file.

Actual process is i need to do some steps in BPM based on form ids coming from third party(webservices)

If formd count is 4 then need to iterate the loop 4 times every time next form need to send for BPM flow

1 st iteration --fromid1

2nd iteration--- Formid2.....and so on..

can anyone please help me on this into this

Regards,

Deep

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

u can use std function

formid-->removecontext---->target field.

or udf you can use as


for(int i =0; i<formid.length;i++)
{
result.addValue(formid<i>);
}

Former Member
0 Kudos

How does the form id comes from the third party?Do you have to read a text file?

former_member1275317
Participant
0 Kudos

this is XML file reponse from Webserives

File should be like this

< List>........................................................ 0 to unbounded

<formid>1234</formid>

<Guiid>sadf34</guid>

</List>

Regards,

Deeps

santhosh_kumarv
Active Contributor
0 Kudos

select the UDF type as Queue.. following is the code to loop at element occurance

for(int i =0; i<formid.length;i++)
{
//ur code here
}

http://help.sap.com/saphelp_erp2004/helpdata/en/b1/83a09f668320419dbe00a741e0fe6a/content.htm

~SaNv...

former_member1275317
Participant
0 Kudos

Santhosh, thanks for your reply..

i guess, your logic will not return new form id on every iteration.

Loop count should be FormId number of times and in every time iteration formID has to be changed..

For Example..

<List>

<FormId>1234</FormId>

<Guid>asdfefas2312</Guid>

</List>

<List>

<FormId>4342</FormId>

<Guid>hgasdf3453</Guid>

</List>

<List>

<FormId>3543</FormId>

<Guid>fsdrawe4532</Guid>

</List>

on first iteration formid has to be sent as 1234

second iteration formid has to be sent as 4342

......

till number form of ids..

Regards,

Deeps

santhosh_kumarv
Active Contributor
0 Kudos

>>i guess, your logic will not return new form id on every iteration.

did u try....? I have given code to only loop @ formid.... refer the help page also....

>>Loop count should be FormId number of times and in every time iteration formID has to be changed..

for(int i =0; i<formid.length;i++) - this would loop as many time as formid is in the source file

result.addValue(formid<i>); - will add all the i'th occurance to target..

this is ur UDF..

for(int i =0; i<formid.length;i++)
{
result.addValue(formid<i>);
}

~SaNv...

jyothi_anagani
Active Contributor
0 Kudos

Hi sandeep,

Can you please explain your requirement properly...If you want to get the same Formid like what you have explained below..


on first iteration formid has to be sent as 1234
second iteration formid has to be sent as 4342

For this no need of UDF. You can achieve this using Standard Functions suggested by Kubra.

Thanks