cancel
Showing results for 
Search instead for 
Did you mean: 

How to Select one value from Context

Former Member
0 Kudos

Hi,

How to select only one value from one context.

this is my source structure.

S_SSG18

|

S_DTM

-


D_2005

D_2006

D_2007

Here S_DTM repeats so many times.. But I need to send data"D" when D_2005 is 159 else "L".

Here my problem is S_DTM repeats 2 times. 1st time it will "L" and 2nd time it is "D". But I need to send only "D" value.

regards,

Ansar.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Do you want that S_DTM should come only once?? Can you plz explain it? What is D & L.

Former Member
0 Kudos

HI,

Take the S_DTM value in one context.

write a for loop and inside that for loop compare the value with D_2005 is 159 and pass the result as D else L.

Thanks and Regards,

Chirag Gohil

Former Member
0 Kudos

Hi,

The result of "Display Queue" of target node..

-


L

-


L

-


L

-


L

-


L

D

-


L

D

-


L

D

-


Here some S_DTM cacme only once.. later it was 3- times repeated twice. Now I need to send only when ever it came at least one time "D" i need to send that node.

Expected Target Node to be filled like this...

-


L

-


L

-


L

-


L

-


D

-


D

-


D

-


regards

Ansar.

Former Member
0 Kudos

Hi,

Write:

Input value: a=S_DATA

b=D_DATA

For(i=0;i<a.length;i++)

{

if(b<i>.equals("159")

{

resilt.addValue("D");

}

else

{

result.addValue("L");

}

}

This will solve ur problem.

Thanks and Regards,

Chirag Gohil

Former Member
0 Kudos

Hi,

I writen one UDF for this..with the help of "count" function. which will count

S_DTM, when it is repeating more than once... It will take only that context which

is having D_2005 is "159" , at that time it will send "D" as output else it will

send "L".

regards

Ansar.

Former Member
0 Kudos

HI,

You can use with the count function as well but I have written the code in UDF which will do the same functionality as the count.

Can you please try the UDF which I have written and let me know the output.

Thanks and Regards.

Chirag Gohil

Former Member
0 Kudos

Hi Chirag,

Thx for UDF. It will give the same problem with this UDF, But I need to pick only "D" out so many value. Here My target is selecting at least one S_DTM segment when it repeated more than once with the condition true.

regards

Ansar.

Former Member
0 Kudos

HI Can you please give me the example of source value and target structure which you wanted.

Thanks and Regards,

Chirag Gohil

Former Member
0 Kudos

Hi chirag,

FYI...

-


int ct = Integer.parseInt(b[0]);

if ( ct > 1 )

{

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

{

if ( a<i>.equals("159") )

result.addValue(a<i>);

}

}

else

{

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

{

result.addValue(a<i>);

}

}

This function returns only one value from each context which is condition true...

Here a- S_DTM and b - Count, Returns only one value for each context. (The problem is returns 2 values in one context one is "L" and"D".; But requirement is get at leat one value from each context i.e "D",).

After this UDF there is check for "159", then one condition for "D" or "L", then result node.

And it is working fine...

regards

Ansar,

Former Member
0 Kudos

hi ansar,

This can be achieved by using "creatif" node function.

suppose if S_DTM == L then create required node

Check this links for more help on createif node function

sap.help

http://help.sap.com/saphelp_nw70/helpdata/en/d9/3033f96c79674f90e3ab8d101a595b/frameset.htm

blogs

/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii

/people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i

regards

Ramesh P