cancel
Showing results for 
Search instead for 
Did you mean: 

UDF required

Former Member
0 Kudos

Hi,

I am doing IDOC to XML...I have a condition here

I have a field called A and B

condition here is

If a=01 then B or if A=02 then B i used one oneasmany condition here,Its throwing an error..

can some one get me an UDF to write this condition

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Duplicate you subtree in the source side... -> right click and select duplicate node

Then in the UDF create 4 paramameters

a1 pointing to A in node 1

b1 pointing to B in node 1

a2 pointing to A in node 2

b2 pointing to B in node 2

writee this UDF - ()

if (a1.equals("01"))

{

return b1;

}

else

{

if (a2.equals("02"))

{

return b2;

}

}

Arvind R

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

it's a little bit confusing:

> If a=01 then B or if A=02 then B

1) Is there a difference between a and A ?

2) Should it be in both cases B ?

Please clarify.

Regards

Patrick

Former Member
0 Kudos

Both the A's are same.....and in both the cases i need B...

I mean ,If a segment occurs twice, with A as 01...then it should take B from the same segment...

or it should take B from the other segment which has 02

Edited by: Harsha reddy on Oct 30, 2008 6:03 PM

Former Member
0 Kudos

Hi Harsha

Now if i look at UDF requirement. you said

I mean ,If a segment occurs twice, with A as 01...then it should take B from the same segment...

or it should take B from the other segment which has 02

Share your source structure then it will be more clear. if we can map using standard or UDF is the only solution.

Thanks

Gaurav

justin_santhanam
Active Contributor
0 Kudos

Harsha,

Why u are using OneAsMany, what is the actual reqmt?

raj.

Former Member
0 Kudos

i need to se that because, we need to replicate the segment here.I did it with if then condition ..it worked fine...now functional team came with deifferent requirement,so,I added If else condition....it throwing an error....

this is the error i get

Runtime exception during processing target field mapping /ns0:MT_A/A/. The message is: Exception:[com.sap.aii.mappingtool.tf3.IllegalInstanceException: Too few values in first queue in function useOneAsMany. It must have the same number of contexts as second queue.] in class com.sap.aii.mappingtool.flib3.NodeFunctions method useOneAsMany[com.sap.aii.mappingtool.flib3.If@631f54, , ]