cancel
Showing results for 
Search instead for 
Did you mean: 

Message mapping problem.

Former Member
0 Kudos

Hi All,

I needed help on Message Mapping:

I have the following source and target structures:

MATMAS05 MATMAS05

Idoc (occurance1:1) Idoc(occ1:1)

-EMARAM (occurance1:n) EMARAM (occ:1:1)

I want the Idoc node to get generated as many times as the Emaram node.

In the source file, the Emaram node gets repeated for multiple materials,with just one Idoc Header node .

eg:

- <MATMAS05>

- <IDOC BEGIN="">

- <E1MARAM SEGMENT="">

<MATNR>PSCM-matsync1</MATNR>

<MTART>Spare parts</MTART>

<MBRSH>Mechanical engineering</MBRSH>

<MEINS>each</MEINS>

- <E1MAKTM SEGMENT="">

<MAKTX>TEST1</MAKTX>

</E1MAKTM>

</E1MARAM>

- <E1MARAM SEGMENT=""> <i>>>Material no:2</i>

<MATNR>PSCM-matsync2</MATNR>

<MTART>Raw materials</MTART>

<MBRSH>Mechanical engineering</MBRSH>

<MEINS>each</MEINS>

- <E1MAKTM SEGMENT="">

<MAKTX>TEST2</MAKTX>

</E1MAKTM>

</E1MARAM>

</IDOC>

</MATMAS05>

Thus I have mapped Idoc->Idoc at the same time the emaram node needs to mapped to the idoc node..

Can anyone please suggest me a soloution.

Should I use a split by value or a user defined function for the same.?

Thanks,

Accepted Solutions (0)

Answers (5)

Answers (5)

RKothari
Contributor
0 Kudos

Hi,

If you want to generate idoc node as many time as the EMARAM occur than i would suggest to use UDF . You must know first, How many times the field EMARAM appeared, so store its count in a Vector, and based on that count generate the Resultset . Use SplitByValue function to get the individual EMARAM in each context. This output must be mapped to the Target-Idoc.

1. Count EMARAM.

2. Split each EMARAM, to get each field's value in seperate context.

3. Map the output to target-Idoc.

Regards,

Rahul

Former Member
0 Kudos

Hi Rahul,

Thanks for the response, but could you please elaborate on the solution..

how do i write my udf?..

if i write a udf to count the emaram's, - then for every segment when this udf gets generated, the integer value-count goes back to default..

and if i can store this value , where could i store the same, also based upon this value,how can i map my Target doc node to it?

Source struct:

matmas05

idoc

begin

Edi_dc40

emaram

>segment(of emaram)

.

.

.

Target Srtuct:

matmas05

idoc

begin

edi_dc40

emaram

>segment(of emaram)

.

.

.

if i map emaram to Idoc the source Idoc header and edidc is not mapped , even if it is, not does not get generated..

Any help is appreciable..!

Thanks,

Gautami.

Former Member
0 Kudos

Hi Vijaya,

My Senderinterface is File, which has the same structure as that of the idoc, hence I have taken an external def. for the message and a file adaper. But the file contains many records for material and teh emaram gets repeated hence.

Regards,

Gautami.

Former Member
0 Kudos

Hi Gautami ,

Did you map EMARAM node to Target Node ?

If you test locally in test tab what is the output ?

Nanda

Former Member
0 Kudos

Hi G.S,

>>My Senderinterface is File, which has the same structure as that of the idoc

Are you using XML file directly as input? coz.. this is <b>not possible in FCC</b>...

If you are using XML file as input and it has the same structure as the IDOC, then one to one mapping should be sufficent..

Regards,

Jai Shankar.

Former Member
0 Kudos

Hi,

Since my source is idoc->Emaram and target too is idoc->Emaram, if i map the Emaram of source to target to idoc, the parent node of target idoc does not get generated and the nodes below that upto emaram,

Idoc1-----> Idoc2

EDIDC1--->EDIDC2

Emaram1----->Emaram2

If Emaram--->Idoc2 is mapped, Edidc does not get generated.\, inspite of:

EDIDC2-->EDIDC2

Emaram1--->Idoc2

Constant/blank---->Emaram2..

Thanks,

Gautami.

Former Member
0 Kudos

Hi ,

In your case you need to map EMARAM node of source IDOc to IDOC node of target message .

EMARAM node on source message is 1:N so there is no need to check the existence of node .

You should map EMARAM node at IDOC context level to the Target IDOC .You can use Split by value for each node .

Nanda

Message was edited by:

Nanda kishore Reddy Narapu Reddy

Former Member
0 Kudos

Hi,

Look at michal's weblog.

/people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change

Thanks,

TUhin

Former Member
0 Kudos

Hi,

If your sender and receiver are the same IDoc why do u need mapping?

Is there something I have missed.

Regards

Vijaya