cancel
Showing results for 
Search instead for 
Did you mean: 

Problems in mapping [IDOC to EDI]

Former Member
0 Kudos

Hi experts,

I am facing a problem I could not resolve so far. My scenario is an Idoc to an EDI format.

In my IDOC I have a segment (E1EDP01) that contains another segment (E1EDP02). E1EDP02 contains the data that interests me. The problem is that the occurence of E1EDP01 is 0...99999 and E1EDP02 is 0..25.

It means that for each segment of E1EDP01 that appears, according to the value of a field in E1EDP02, I have to map the values of E1EDP02 in a specific target segment.

For example, I can have:

E1EDP01

>>E1EDP02

>>>>QUALF 012

>>>>BELNR BELNR012

>>E1EDP02

>>>>QUALF 087

>>>>BELNR BELNR087

>>E1EDP02

>>>>QUALF 088

>>>>BELNR BELNR088

>>E1EDP02

>>>>QUALF 089

>>>>BELNR BELNR089

If QUALF = 012, then BELNR has to go to a specific target field. If QUALF = 087, then BELNR has to go to another specific target field, and so on...

The problem is that E1EDP01 can appear several times, ie:

E1EDP01

>>E1EDP02

>>>>QUALF 012

>>>>BELNR BELNR012

>>E1EDP02

>>>>QUALF 087

>>>>BELNR BELNR087

>>E1EDP02

>>>>QUALF 088

>>>>BELNR BELNR088

>>E1EDP02

>>>>QUALF 089

>>>>BELNR BELNR089

E1EDP01

>>E1EDP02

>>>>QUALF 012

>>>>BELNR BELNR012bis

>>E1EDP02

>>>>QUALF 087

>>>>BELNR BELNR087bis

>>E1EDP02

>>>>QUALF 088

>>>>BELNR BELNR088bis

>>E1EDP02

>>>>QUALF 089

>>>>BELNR BELNR089bis

E1EDP01

>>E1EDP02

>>>>QUALF 012

>>>>BELNR BELNR012ter

>>E1EDP02

>>>>QUALF 087

>>>>BELNR BELNR087ter

>>E1EDP02

>>>>QUALF 088

>>>>BELNR BELNR088ter

>>E1EDP02

>>>>QUALF 089

>>>>BELNR BELNR089ter

Every time QUALF takes these value I have to create a specific target segment that contains the value of BELNR. In this example above, I would have 12 target semgnents created.

I could not find how so far,

any help would be greaatly appreciated

Best regards,

Jamal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi!

Thanks a lot guys for your help.

So far, I managed to have the rights statements, but still not the good values in it.

I tried to put a condition if BELNR blank but it did not work, I still have a shift in my contexts, the case when QUALF = 001 is that BELNR does not exist, look what I get when I display queue of my if ocndition for the value '012':

http://www.flickr.com/photos/30317046@N05/2845012735/

I can't manage to get the right values

thanks again,

kind regards

Former Member
0 Kudos

I did a test mappig with your requirement and it is working.

I am including the screenshots here...

Map the root node above ID as per this mapping:

http://farm4.static.flickr.com/3014/2846111812_db261a9f28_o.jpg

Field mapping to ID:

The contexts of all BELNR, QUALF should be made to E1EDP01 in the following mapping:

http://farm4.static.flickr.com/3115/2846111918_3e6f8b047b_o.jpg

It is working with the above mapping.

Regards,

venkat.

Answers (10)

Answers (10)

Former Member
0 Kudos

Thanks a lot venkat and sarvesh, I did exactly what you told me and played with contexts, splitbyvalues etc... and it works perfectly fine, THANKS A MILLION!!!

Best regards, i'll let you know if it dumps p

Former Member
0 Kudos

Hi Svaresh,

thanks a lot for your help.

I forgot to precise that there is a case where the field BELNR does not exist in the concerned segment E1EDP02, it is when QUALF = 001 but I don't have to deal with this value.

To sum up, so far I've duplicated the target DocumentReference 4 times (1 per type of QUALF)

Now I have as target :

InvoiceDME 1..1

>Invoice 0..1

>>InvoiceLine 0..unbounded

>>>DocumentReference 0..unbounded

>>>>Type (mapped to constant = 'invoice for 012')

>>>>ID

>>>DocumentReference 0..unbounded

>>>>Type (mapped to constant = 'invoice for 087')

>>>>ID

>>>DocumentReference 0..unbounded

>>>>Type (mapped to constant = 'invoice for 088')

>>>>ID

>>>DocumentReference 0..unbounded

>>>>Type (mapped to constant = 'invoice for 089')

>>>>ID

Thanks to you I manage to create as many good segments as I want.

The problem is that I still dont get the right values in ID since when in my target QUALF = 001, the field BENLR does not exist which create a shift in the values.

To be clearer, as example I have:

IDOC

>E1EDP01

>>E1EDP02

>>>QUALF = 001

>>E1EDP02

>>>QUALF = 012

>>>BELNR = BELNR012

>>E1EDP02

>>>QUALF = 087

>>>BELNR = BELNR087

>E1EDP01

>>E1EDP02

>>>QUALF = 001

>>E1EDP02

>>>QUALF = 012

>>>BELNR = BELNR012bis

>>E1EDP02

>>>QUALF = 087

>>>BELNR = BELNR087bis

>>E1EDP02

>>>QUALF = 088

>>>BELNR = BELNR088

It creates my statements but with the wrong ID value:

when I display queue of my "if then" condition in the ID field for '012', i get:

http://www.flickr.com/photos/30317046@N05/

Do you know how can I correct that?

Thanks a lot,

Kind regards

Former Member
0 Kudos

Hi,

After looking to your mapping from the given link, I think you can achieve this by adding SplitByValue std function just after if condition.

One more think before mapping the BELNR you put one more if condition to check if BELNR is blank then you pass some constant value, reason for this is, it will create an context with that value rather creating a suppressed context (as it is creating now).

I hope this will solve your problem.

Regards,

Sarvesh

Former Member
0 Kudos

Hi

Place RemoveContexts and SplitByValue after if.

THis would solve

This will basically to remove SUPPRESS out of the Queue.

Regards,

Venkat.

Former Member
0 Kudos

I forgot to precise that it is the field 'ID' that must contains the value of BELNR according to QUALF.

Regards,

Jamal

Former Member
0 Kudos

Hi,

To achieve this you need to create one fixed value table. Fixed Value table can be found under standard function. In this fixed value table define all your QUALF (012, 087, 088, 089) in first column and in second column put 1 as a result for all.

Now you need to first map DocumentRefrence in order to create "DocumentRefrence" segment as many times as the number of QUALF comes. (In your case it is 5)

Mapping will be like this..

QUALF (right click & change the context to E1EDP01)-----> FixedValue -


> EqualS (1) -


> if (then map 1) -


> DocumentRefrence

(the above mapping will create 5 segments, 2 in first & 3 in second context)

Now map the BELNR to ID based on your QUALF values.

do like this and let me know if it helps you..

Regards,

Sarvesh

Former Member
0 Kudos

Thanks,

my target structure is actually big, it is a DME format used for invoices.

I can describe you the target fields:

InvoiceDME 1..1

>>Invoice 0..1

>>>>InvoiceLine 0..unbounded

>>>>>>>>DocumentReference 0..unbounded

>>>>>>>>>>>>Type optional

>>>>>>>>>>>>DocumentID 0..1

>>>>>>>>>>>>>>>>ID 1..1

I have four 'Types' of DocumentReference. Each type corresponds to a value of QUALF.

For example, if I have :

QUALF = 012

QUALF = 087

and in the next segment

QUALF = 012

QUALF = 087

QUALF = 088

I must have as output 5 occurences of DocumentReference, including two of 'type' 012, two of 'type' 087, and one of 'type' 088.

Thanks again for your help,

Best regards,

Jamal

Former Member
0 Kudos

So far still nothing

Either I have empty target fields, either I have the wrong values

any inputs?

Kind regards,

Jamal

Former Member
0 Kudos

HI,

See it's all about context and nothing else. You have to just play with context and you will get your results. You also need to have understanding of some std functions like Reomve context, CollpseContext, SplitByValue & trim function.

Send me your target structure along with occurence. I will try to find the solution for you.

Regards,

Sarvesh

Former Member
0 Kudos

The thing is that I dont map E1EDP01 and E1EDP02, I only map the field in E1EDP02

Former Member
0 Kudos

Yes you are right..

Have you got any succuess.

Former Member
0 Kudos

Hi sarvesh,

I didnt understand what you meant by

First of make the context of E1EDP01 to IDOC (if not).

Then make the context of E1EDP02 to E1EDP01 (if not).

and change the context of QUALF & other fields to E1EDP02 (if not).

Could you be a bit more explicit?

THanks a lots,

Kind regards

Former Member
0 Kudos

Double click on target E1EDP01 and then in mapping, source field right click -


> context, check if the context is same as I explained in my reply above. Similarly do for the rest of the fields/segments.

Former Member
0 Kudos

Thanks,

I tried with the if condition but it did not work. I have an empty field as result.

I put the QUALF context to E1EDP01 and the BELNR context to IDOC

To be more precise, as target I have a segment DocumentReference that contains the field ID in which the value of BELNR should be mapped according to the values of QUALF.

When I display queue for the ID field for the condition 012, I have:

SUPPRESS

[]

[BELNR value for 087]

[]

[]grey

[]

SUPPRESS

[]grey

[]dark

thanks for your help, I cant get out of it!

Former Member
0 Kudos

Hi,

Do like this...

First of make the context of E1EDP01 to IDOC (if not).

Then make the context of E1EDP02 to E1EDP01 (if not).

and change the context of QUALF & other fields to E1EDP02 (if not).

Now do the mapping with "if" std function & use "text--->trim" std function just before target field.

source -


> if condition -


> trim -


> Traget.

Regards,

Sarvesh

Former Member
0 Kudos

Hi,

You need to play with Context Changes whiel mapping these kind of multiple occurance fields.

For Qualifier check you need to pass the blank value if the condition failed. for e.g.

If QUALF = 012, then BELNR has to go to a specific target field. If its not 012, then pass constant [] to that field.

similarly add the condition to the field having condition If QUALF = 087.

this constant [] is required because the failure of condition will supress that field. But you have multiple E1EDP01segments so you can't allow to supress otherwise, the values will get mixed up.

Thanks

Swarup

former_member194786
Active Contributor
0 Kudos

Hi,

Its quite simple i guess. You just move the context of the field BELNR to the level higher than that of field E1EDP01. All the values will be mapped to the corresponding field. Use the If else condition along with it.

Regards,

Sanjeev.