cancel
Showing results for 
Search instead for 
Did you mean: 

UDF for graphical mapping

Former Member
0 Kudos

Hi,

The following is my source structure :

Recordset 1..1 -> Idoc 1..unbounded -> Segment 1..1

<Recordset>

<Idoc>

<segment>abcdefgh</segment>

</Idoc>

<Idoc>

<segment>klmno</segment>

</Idoc>

.

.

.

</Recordset>

I have a requirement where in I have to pass the data from the various segments as an input to the RFC.Is there any UDF which I can use to concatenate the values from the different segments and map it to the input for the RFC.There can be many idocs under one Recordset and each idoc has one segment.

Appreciate if you could help.

Thanks in advance.

Induja

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Please use below TestUDF code

Here pass the input parameter as Segment ---> TestUDF ---> Target field

And select the cache parameter as queue



String temp = new String("");
for(int i = 0; i<a.length;i++)
{
temp = a<i> + temp;
}

result.addValue(temp);

Thanks

Swarup

Former Member
0 Kudos

Thanks for the reply Swarup.It worked:)

If I want to concatenate segments which start with a particular substring alone,will I be able to achieve it.Like for example,I only want to concatenate the segments which start with say 'abcd'.There are many segments within the recordset which start with this substring.I want to concatenate only those.Will I have to use the substring function to place a check.

Please could you give me your ideas on this.

Thanks and Regards,

Induja

Former Member
0 Kudos

Hi Induja,

You can use if statement to check the first 4 characters of all the segments.concatenate those segments which satisfy the above condition.Here is the code for the same..

String temp = new String("");

String string1 = "abcd";

for(int i = 0; i<a.length;i++)

{

if (string1.equals(a.substring(1,4)))

temp = a<i> + temp;

}

result.addValue(temp);

Regards,

Yuga

Former Member
0 Kudos

Thanks Yuga.

I am getting the following error 'cannot resolve symbol symbol : method substring (int,int)'.I have checked the check the spelling and capitalization of keywords and the variable's declaration.

Is there anything which I'm missing?

Thanks and Regards,

Induja

Former Member
0 Kudos

Hi Indu,

Its an array of values so try to put array of i in the place of a.

I hope that will work.

I will send you the code through mail.

Yuga

Former Member
0 Kudos

Hi,

Just use below code




String temp = new String("");
for(int i = 0; i<a.length;i++)
{
if((a<i>.substring(0,4)).equals("abcd"))
temp = a<i> + temp;

}
 
result.addValue(temp);

Thanks

Swarup

Answers (1)

Answers (1)

Former Member
0 Kudos

There is no standard UDF to concatenate values in a given context. You have to write a UDF for the same.