cancel
Showing results for 
Search instead for 
Did you mean: 

How to map multiple occurrences of a source field into a target field

Former Member
0 Kudos

Hi friends

I need multiple occurences of MATNR field, of idocs collected, to be concatenated into a single field on target side.

Warm Regards

Arjun Ghose

Accepted Solutions (0)

Answers (1)

Answers (1)

PriyankaAnagani
Active Contributor
0 Kudos

Hi Arjun,

You can achieve this with simple UDF and the execution type of it will be allvalues of a queue. Pass matrial as input to UDF and map it to target...

SourceMaterial>UDF>targetField

String material ="";

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

material = material + var1<i>; //var(i)

}

result.addVAlue(material);

Regards,

Priyanka

Former Member
0 Kudos

Hi Priyanka

The source field MATNR is coming multiple times because idocs are collected for a specific time interval .And the MATNR's of all these idocs will be concatenated into a single target field , will your UDF work in that case.My BPM scenario is collecting the idocs, I guess concatenating the MATNR's will also be part of BPM , or will it , please advise.

PriyankaAnagani
Active Contributor
0 Kudos

Hi Arjun,

As a part of BPM, you'll have transformation step ryt...in that step use the UDF in your message mapping it'll work.

Regards,

Priyanka

Former Member
0 Kudos

Hi Priyanka

In the scenario where I am collecting COND idocs for 30 minute intervals.

Also I have to concatenate all the MATNR values of all idocs collected in those 30 minutes into a single target field

Could you tell me where exactly I should use the transform step , is it going to be a separate transform step or the transform step that is already used for collecting the idocs ,I can send you my scenario if you give me your mail id or something

Warm Regards

Arjun Ghose

Former Member
0 Kudos

I can send to your company id if you want.

PriyankaAnagani
Active Contributor
0 Kudos

Hi,

In the same transformation step where you have message mapping ... write this logic within UDF and map it to the respective target element.

Regards,

Priyanka

Former Member
0 Kudos

Hi Priyanka

I am using the below code

String material ="";

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

{

material = material +MATNR<i>; //var(i)

}

result.addVAlue(material);

But I am getting the below errors:

Activation of the change list canceled Check result for Message Mapping COND_A_COND_A01_TO_File_PriceDataIntermediate_Warehouse | urn:bp:xi:dwn:lu:common:Logistics:100: Starting compilation Source code has syntax error: C:/usr/sap/IXV/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Map11a81744fef611e0a49b000000aa1a4a/source/com/sap/xi/tf/_COND_A_COND_A01_TO_File_PriceDataIntermediate_Warehouse_.java:123: array required, but java.lang.String found material = material +MATNR<i>; //var(i) ^ C:/usr/sap/IXV/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Map11a81744fef611e0a49b000000aa1a4a/source/com/sap/xi/tf/_COND_A_COND_A01_TO_File_PriceDataIntermediate_Warehouse_.java:126: cannot resolve symbol symbol : variable result location: class com.sap.xi.tf._COND_A_COND_A01_TO_File_PriceDataIntermediate_Warehouse_ result.addVAlue(material); ^ 2 errors

Edited by: GhoseArjun on Oct 25, 2011 12:57 PM

Former Member
0 Kudos

Hi GhoseArjun

Edit your user defined function and change the argument type to "Queue" instead of "Value".

The second error is a case issue.

Right code is result.addValue(material) instead of result.addVAlue(material).

Regards,

Giuseppe