cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping specific elements to generic elements

Former Member
0 Kudos

Hi,

I need to map source specific elements into target generic elements which are specialized with a "name" attribute.

I don't know how I can specify in the same time the "name" attribute's value ( “currency” or “edi_currency” or …) depending on the present source elements (CURCY, HWAER, KUNDEUINR) and copy this source element’s value as the target element’s value...

Thanks for your help

Adalbert

Ex:

Source:

<ORDERS05>

<IDOC>

<E1EDK01>

<CURCY>XXX</CURCY>

<HWAER>YYY</HWAER>

<KUNDEUINR>ZZZ</KUNDEUINR>

...

</E1EDK01>

</IDOC>

</ORDERS05>

Target:

<MYORDER>

<HEADER>

<PROP name="currency">XXX</PROP>

<PROP name="edi_currency">YYY</PROP>

<PROP name="vat_reg_nbr">ZZZ</PROP>

...

</HEADER>

</MYORDER>

Accepted Solutions (1)

Accepted Solutions (1)

claus_wallacher
Active Participant
0 Kudos

Hi Adalbert,

you can do your mapping very easy with standard graphical mapping features. There is no need for a user defined function. Just do the following:

1. Do the following mapping:

CURCY --> PROP
Constant[currency] -->@name

2. Duplicate the structure PROP (right mouse click and pick duplicate subtree and map the second occurrence of PROP as follows:

HWAER --> PROP
Constant[edi_currency] --> @name

3. Duplicate the structure PROP again and map the third occurrence as follows:

KUNDEUINR --> PROP
Constant[vat_reg_nbr] --> @name

Check also the following <a href="/people/claus.wallacher/blog/2006/08/15/duplicating-subtrees-and-numbering-them-using-the-graphical-mapping-tool">blog</a> on how to duplicate subtrees.

Regards,

Claus

Former Member
0 Kudos

Hi,

Thanks for your help.

I managed to do my mapping very easily with Claus's recommendation which was the simplest solution.

Keep posting:)

Adalbert

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi guys,

Thanks for your help.

I will test today and let you know.

Adalbert

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

Just taking the UDF idea suggested by Abhy, you can do this,

1. The input to the UDF will be a constant ( which will have one of the 3 values CURR , HWAER , KUNDEUINR ) as well as FIELD

In your UDF , check for the constant value , and send out the corresponding value for the attribute .

Mapping will be as follows,

<CURCY> ---

<HWAER> --- <PROP>

<KUNDEUINR>--

For the mapping of the ATTRIBUTE NAME,

<CURCY> ---

CONSTANT -- UDF

<HWAER> ---

CONSTANT -- UDF NAME

<KUNDEUINR>--

CONSTANT -- UDF

Regards,

Bhavesh

Regards,

Bhavesh

Former Member
0 Kudos

Hi Adalbert,

You can write a small UDF to achieve your requirement.

The input for the first UDF will be your "CURCY", "HWAER" and "KUNDEUINR"

if (CURCY.length>0)

return CURCY;

if (HWAER.length>0)

return HWAER;

if (KUNDEUINR.length>0)

return KUNDEUINR;

Use this UDF as the mapping program between "CURCY", "HWAER", "KUNDEUINR" and "PROP"

The input for the second UDF will be the same, but you will use it as a mapping program between your "CURCY", "HWAER", "KUNDEUINR" and attribute "name"

if (CURCY.length>0)

return "currency";

if (HWAER.length>0)

return "edi_currency";

if (KUNDEUINR.length>0)

return "vat_reg_nbr";

I hope it helps...

Regards,

Abhy

Message was edited by: Abhy Thomas