cancel
Showing results for 
Search instead for 
Did you mean: 

mapping and context problem

Former Member
0 Kudos

Hi i am not being able to perform this mapping, the scenario is like this:

i need to create one LINE in the output for each E1PLOGI in the input when FLAG3 = 'S'

also as i don't understand completely the context theory i cant figure out in witch context to set the fields

My context is set like this

FLAG3 -> context = E1PLOGI

My logic is createif( FLAG3 = 'S' ) -> LINE

My xml test file have:

one E1PLOGI node without E1P0000

one E1PLOGI with E1P0000 node where FLAG3 = 'N'

one E1PLOGI completely OK

The result is that not even one LINE its created.

If only put one line ok it works ok, but if one line doesnt have an E1P0000 node or if FLAG3='S' then the next OK input lines it wont come out.

plase heeelp!

IN STRUCTURE

<Z_HRMD_A>

<IDOC BEGIN="1">

<EDI_DC40 SEGMENT="1">

<CREDAT>20080731</CREDAT>

</EDI_DC40>

<E1PLOGI SEGMENT="1">

<E1PITYP SEGMENT="1">

<E1P0000 SEGMENT="1">

<FLAG3>S</FLAG3>

</E1P0000>

</E1PITYP>

</E1PLOGI>

</IDOC>

</Z_HRMD_A>

Z_HRMD_A 1..1

IDOC 1..1

EDI_DC40 1..1

CREDAT 0..1

E1PLOGI 1..UNBOUNDED

E1PITYP 0..UNBOUNDED

E1P0000 0..UNBOUNDED

FLAG3 0..1

OUT STRUCTURE

<FILE_X>

<LINE>

<FIELD_1>

<FIELD_2>

<FIELD_3>

<FIELD_4>

</LINE>

</FILE_X>

FILE_X 1..1

LINE 0..UNBOUNDED

FIELD_X 0..1

Edited by: Mariano Billinghurst on Aug 4, 2008 6:05 PM

Edited by: Mariano Billinghurst on Aug 4, 2008 6:12 PM

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I did a java mapping to solve this problem

former_member187563
Contributor
0 Kudos

hi,

Createif will not generate node if its occurrence is mandator.

Try using mapwithdefault which is a node function.

Or try using exists function that will also create a node but with values true or false.

regards,

ujjwal kumar

Former Member
0 Kudos

Try

FLAG3 -> context = E1PLOGI

createif( FLAG3 = 'S' ) -> removeContext -->LINE

Thanks,

Beena.

Edited by: Beena Thekdi on Aug 4, 2008 6:54 PM

Former Member
0 Kudos

Here it is the mapping and the display of the queues in each step.

Mi test xml has

1-one E1EPILOGI without EP0000

2-one E1EPILOGI OK

3-one E1EPILOGI with FLAG3 = N

4-one E1EPILOGI OK

http://img297.imageshack.us/img297/3615/mappingandqueueswi0.jpg

beena with your solution it was creating two lines , one with 1 and one with 3.

Kumar i think with your solution i am much closer, but still doesnt work ok. Could you explain me why at the end of the queres everything says "supress"?

Regards.

Mariano.

Former Member
0 Kudos

Finally it works, here it is the link with the working mapping and the queues, still dont understand the queues.. jeje

http://img212.imageshack.us/img212/289/mappingandqueuesokaw4.jpg

regards

mariano,

henrique_pinto
Active Contributor
0 Kudos

The point is that within E1EPILOGI, you can have several E1PITYP tags, and within that you can have several E1P0000 tags. Hence, for it to properly work, you need to create an UDF that will go throug the entire FLAG3 context and check whether, for that E1EPILOGI tag, there is any FLAG3 = S.

By doing it like you're doing now, it'll create one tag in the target message for each FLAG3 = S, but I thought it was supposed to be created for each E1EPILOGI which contains FLAG3 = S.

Regards,

Henrique.

Former Member
0 Kudos

Henrique, thanks for yout answer, its like you say "it'll always check only the 1st occurrence of FLAG3", but i dont understand why,

If the context of FLAG3 is E1PLOGI, when this context changes to another E1PLOGI it shouldnt check again the FLAG3 ?

thanks.

mariano.

Former Member
0 Kudos

Add removecontext in if condition after checking the flag = S.

i.e. Flags/MapwithDefault(N)/Equals/removeContexts/if

Thanks,

Beena.

henrique_pinto
Active Contributor
0 Kudos

Sorry, I corrected the message.

It will not only check the 1st, but instead it will create N target tags for each E1EPILOGI, if there are N FLAG3 fields with 'S' inside that E1EPILOGI tag.

I understood that you needed 1 target tag for each E1EPILOGI and not N.

Regards,

Henrique.