cancel
Showing results for 
Search instead for 
Did you mean: 

****Useone as many

Former Member
0 Kudos

Hi all,

The Idoc we are using is ORDCHG.

My requirement is if PARVW= we or LF or LS or Z1 or AG or EK then need to send name1 values

For this I wrote a java function

//write your code here

if(((inValue[0].equals("AG") || inValue[0].equals("EK") || inValue[0].equals("LF") inValue[0].equals("Z1") inValue[0].equals("WE") inValue[0].equals("LS")))

{

result.addValue(inValue[0]);

}else{

result.addValue("");

}}

for testing i used concat to combine both.

then name1->>>first parameter of use1asmany

second parameter if E1EDP01exists then E1EDp01 else constant[]

Third parameter if E1EDP01 exists then Posix else constant

up on executing this i have error

RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /ns0:MT_FILE_MUL/Recordset/Records/Del_To_name1. The message is: Exception:[com.sap.aii.mappingtool.tf3.IllegalInstanceException: Too many values in first queue in function useOneAsMany. It must have the same number of contexts as second queue.] in class

Please help.

Thanks,

Srinivasa

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I am not sure why you are using UDF for this when you can achieve this with standard functions.

Please use following mapping. I have created it for case PARVW = WE.

1. Use If then else

u2022 Input for If condition = PARVW --> map with default = Constant with value WE

u2022 Then pass name 1--> map with default

u2022 Else pass constant with blank value

2. Output of if then else --> remove context --> Sort (Property descending) --> collapse context --> Target field

This mapping will pass value of name 1 to target field, whenever the value of PARVW = WE in same segment occurrence.

Please modify it as per your requirement. Let us know if any issue.

Regards,

Gouri

Answers (1)

Answers (1)

KennethEriksen
Participant
0 Kudos

Hi,

I am not sure if I understand your requirement, but if you want to send Name1 for only the selected partner types, then you will end up with up to 4 instances of Name1 with all instances within the same context as your code is currently written.

I don't know your target message structure, but generally the useOneAsMany-function requires there to be the same number of contexts for all three inputs. In your case you would need to change the context (right-click on field and select the context above the current context) from line-item level to header level. This way you would get only one context with instances also for input2 and input3, in addition to your input1 (list of Name1 values) and the function should work.

Let me know how it works out for you.

Br,

Kenneth

Former Member
0 Kudos

I tried mapping name1 directly to parameter1 of useone as many the result is same.

The source field has occurance 0..1 and target has TO_Del_name also has 0..1.

second parameter E1EDP01 has 0 t0 99999.

third parameter POSIX has 0..1 .

Can you help me in mapping.

Former Member
0 Kudos

pass third field parameter also E1EDP01 only...

if there is any problem still then need to check the context and you need to select the appropriate context objects...

HTH

Rajesh

Former Member
0 Kudos

Hi Srini,

OneAsMany function first input should have only one input value and that shouldn't be empty.

Second and third input values contexts should be same. In your case the inputs should be E1EDP01.

Regards

Ramesh

Former Member
0 Kudos

Hi,

Try with this,

then name1->>>first parameter of use1asmany

second parameter if E1EDP01exists then E1EDp01 else constant[]

Third parameter if E1EDP01 exists then E1EDP01 else constant[]

Regards

Ivan