cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping of [0..n] to [0..1]

sinaei
Contributor
0 Kudos

Dear Experts,

Hope you are fine,

I have a problem, I need to map a field that is more than one, to the field that is just one, it is not possible to create a node with [0..n], so I want to know if there is any way I can do the mapping?

Thank a lot,

Sin

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182412
Active Contributor
0 Kudos

Hi Sin,

How do you want to map these multiple values from source payload to target??

  • do you want to send only the first value to the target??
  • Or do you want to send all the values to the target field by separating them comma??

Regards,

Praveen.

sinaei
Contributor
0 Kudos

Hello Praveen,

Thank fpor you reply,

I want to send all the values to the taret fields.

Do you know how can I do it?

Regards

Sin

former_member182412
Active Contributor
0 Kudos

HI

Use below UDF:

Execution Type: All Values Of Context


public void joinList(String[] list, ResultList result, Container container) throws StreamTransformationException{

String join = "";

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

if (i!= 0)

     join = join +";"+ list[i];

else

     join = join + list[i];

}

result.addValue(join);

}

Use removeContext before UDF.

Regards,

Praveen.

sinaei
Contributor
0 Kudos

Thank a lot Praveen,

But the problem is I am on HCI and I dont think I can use UDF...

Do you have any idea?

Regards

Sin

former_member182412
Active Contributor
0 Kudos

Hi

Try with groovy scripts in HCI.

User Defined Function in SAP HCI | SCN

Regards,

Praveen.

sinaei
Contributor
0 Kudos

Hi,

thank a lot for all your help

Regards

Sin

sinaei
Contributor
0 Kudos

Hi again Praveen,

I have another quetion hope you can help me about this,
I could get all the values if my target field,

But I have another problem. below you can see my idoc,

I have [0..n] E1KNVVM field, eachh of them have one TDID, and [0..n] TDLINE.

now I can send Z027, Z028, Z029 in my target, but I need to send the TDLine of each TDID to the target,

for example my targer should be like this:

PER QUALSIASI PROBLEMA IN FASE DI CONSEGNA CONTATTARE IL SIG. QUINTO AL N. 335/1989139 SI CHIUSO MARTEDI

Do you have any idea what exactly should I have to do?

Many Thanks

Sin

nitindeshpande
Active Contributor
0 Kudos

Hi Sin,

It should go into the same target field as that of TDID?

Regards,

Nitin

sinaei
Contributor
0 Kudos

Hi Nitin,

Yes, I want to gather all the TDID to one target field.

Regards,

Sep

nitindeshpande
Active Contributor
0 Kudos

Hi Sin,

I meant, currently you are successfully sending the data of all the TDID fields into one target field consider field1 like below -

field1 = Z027, Z028, Z029

Do you want to send the data of TDLine into the same field? Below is the thing you are expecting or you want it in another field say field2?

field 1 = Z027, Z028, Z029 PER QUALSIASI PROBLEMA IN FASE DI CONSEGNA CONTATTARE IL SIG. QUINTO AL N. 335/1989139 SI CHIUSO MARTEDI

Regards,

Nitin

sinaei
Contributor
0 Kudos

Hello Nitin,

Thanks a lot for your response,

I want this result

field 1 =PER QUALSIASI PROBLEMA IN FASE DI CONSEGNA CONTATTARE IL SIG. QUINTO AL N. 335/1989139 SI CHIUSO MARTEDI


Do you know how can I achieve it?

Many thanks

Sin


sinaei
Contributor
0 Kudos

Hi Nitin,

Just for let you know that aslo this is enough for me,
if I can merge just all the TDLINE of Z027( is not always in the first position) to one of my target values, and TDLINEs of Z028 in one of my other target values,...

Regard,

Sin