cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping

Former Member
0 Kudos

Hi All,

I have a mapping requirement as

1.Target field 1

LIST/...../..../...../......./C_C080/D_3036

Source field

CustomerName

Mapping rule:First 35 characters of CustomerName sholud be mapped to the Target field 1

Target field 2

LIST/......../........./........./......../C_C080/D_3036_2

Source field

CustomerName

Mapping rule:Next 35 characters of CustomerName should be mapped to Target field 2

2.Target field

LIST/S_UNB/S_UNH/D_0062

No source field

Mapping rule:Unique sequence number of ORDERS messages within this transmission ( incremented by 1)

As far as ORDERS is concerned ,it is the constant value assigned to one of the Target fields that is LIST/S_UNB/D_0026

3.Target field

LIST/S_UNB/S_UNH/S_UNT/D_0062

No Source field

Mapping rule:Fixed mapping sequence number is equal to field 0062 in UNH,that is ,the mapping rule mentioned above in the second mapping requirement for the target field LIST/S_UNB/S_UNH/D_0062.

4.Target field

LIST/S_UNB/S_UNZ/D_0036

No source field

Mapping rule:Calculated in mapping: Number of messages in one interchange

Please help on these things.

Thanks in advance

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

answered

shweta_walaskar2
Contributor
0 Kudos

Hello Shweta,

Can you please be so kind to let us know how was this resolved?

Thanks.

Best Regards,

Shweta

shweta_walaskar2
Contributor
0 Kudos

Hello Shweta,

For 2 & 3,Please create following three UDFs

import com.sap.aii.mapping.api.*;

public String UNHCounter(Container container) throws StreamTransformationException{

try {

CounterBean be = CounterFactory.getCounterInstance();

return "" + be.nextCounter("COUNTER_UNH_ORDERS");

}

catch (Exception e) {

return "exception_in_UNHCounter" + e;

}

}

import com.sap.aii.mapping.api.*;

public String SetLocalVariable(String a, String b, Container container) throws StreamTransformationException{

/*Store value in local data container

a: mapping value and return parameter

b: name for stored value

*/

GlobalContainer myGlobalContainer;

myGlobalContainer = container.getGlobalContainer();

myGlobalContainer.setParameter(b.toUpperCase(), a);

return a;

}

import com.sap.aii.mapping.api.*;

public String GetLocalVariable(String a, Container container) throws StreamTransformationException{

/*Get value from local data container

a: name for stored value

*/

GlobalContainer myGlobalContainer;

myGlobalContainer = container.getGlobalContainer();

if (myGlobalContainer.getParameter(a) == null) {

return "";

}

else {

return (String)myGlobalContainer.getParameter(a.toUpperCase());

}

}

2.Target field

LIST/S_UNB/S_UNH/D_0062

Mapping logic:

UNHCounter(UDF)

\

SetLocalVariable(UDF)---> D_0062

/

UNHCounter(Constant)

3.Target field

LIST/S_UNB/S_UNH/S_UNT/D_0062

Mapping logic:

UNHCounter(Constant)---> GetLocalVariable ---> D_0062

4.Target field

LIST/S_UNB/S_UNZ/D_0036

You can map any dummy value (ex- #messages) ,this field is calculated automatically after conversion

Please let us know if this helps.

Best Regards,

Shweta Kulkarni

rajasekhar_reddy14
Active Contributor
0 Kudos

use substring function to achive 1 & 2 mapping logics.

4&3 not clear.

Regards,

Raj

Former Member
0 Kudos

Hi Raja Shekhar,

Thanks for the quick reply.

use substring function to achive 1 & 2 mapping logics.

Means,the substing should have hte value form 0 to 34 or 1 to 35?

How can this mapping implemented useing the substing ?

2.Target field 
LIST/S_UNB/S_UNH/D_0062

No source field

Mapping rule:Unique sequence number of ORDERS messages within this transmission ( incremented by 1)

As far as ORDERS is concerned ,it is the constant value assigned to one of the Target fields that is LIST/S_UNB/D_0026

As far as 3 is concerned,I think it is the fixed mapping with the value mentioned in the second mapping that I mentioned that is for LIST/S_UNB/S_UNH/D_0062

Please help me on this.

Thanks in advance

rajasekhar_reddy14
Active Contributor
0 Kudos

sunstring 0 to 34 , will return first 35 characters.

reaming requirement description not clear...but it seems very simple logic.

Regards,

Raj