cancel
Showing results for 
Search instead for 
Did you mean: 

File to IDoc mapping

former_member312864
Active Participant
0 Kudos

Hi ,

I have a scenario in which I need to map few item fields to IDOC segments in the following manner:

The Source file has header, item and tender and inside item node there are 3 discount fields. The discount needs
to be mapped to discount segment fields of IDOC.

If all the discount fields have values in them, then for each discount field one discount segment is to be
populated (4 segments of discount).

Likewise if multiple items are there with multiple discount fields in them, then those many segments should be created item wise.

Source structure

Header

…….

Item

  Discount1    DSC1(value)

  Doscount2   DSC2

  Discount3    DSC3

Item

   Discount1   DSC1

   Doscount2   DSC2

   Discount3   DSC3

Tender

……

Target--- Target will have 6 discount segments, 3 segments for each item.

Target Structure

LINEITEM (item1)

            SEQNO    1

LINEITEM (item2)

             SEQNO    2

DISCOUNTSEGMENT(for item1)

                SEQNO    1

              DISCOUNTTYPECODE    DSC1

DISCOUNTSEGMENT(for item1)

                SEQNO    1

              DISCOUNTTYPECODE    DSC2

DISCOUNTSEGMENT(for item1)

              SEQNO    1

              DISCOUNTTYPECODE    DSC3

DISCOUNTSEGMENT(for item2)

              SEQNO    2

             DISCOUNTTYPECODE   DSC1

DISCOUNTSEGMENT(for item2)

            SEQNO    2

              DISCOUNTTYPECODE   DSC2

DISCOUNTSEGMENT(for item2)

             SEQNO    2

            DISCOUNTTYPECODE   DSC3

How to achieve above requirement.

Thanks

Sarojkanta

Accepted Solutions (1)

Accepted Solutions (1)

former_member184681
Active Contributor
0 Kudos

Hi Sarojkanta,

Right-click on your discount segment in the target structure of the mapping, and choose "Duplicate Subtree". Do it twice, since you need a total of 3 discounts for each item. Then, you can prepare independent mappings for each of those duplicated segments (just as if they were different segment types), so you can map discount 1 to the first copy of the segment, discount 2 to copy 2 and discount 3 to copy 3.

Regards,

Greg

former_member312864
Active Participant
0 Kudos

Hi Greg,

I tried to implement wht u sugested but while saving the mapping its skiping all the target structure.

Getting below error

--------------------------

    The source structure, target structure, or a function library has been

    changed or could not be found in the Enterprise Services Repository. The

    mapping definition contains elements or attributes that do not exist in

    the changed structure, or functions that were changed in a function

    library. The relevant entries will be deleted.

 

--------------------------

Do I need to change the XSD for IDoc or any more sugestion.

Thanks

Sarojkanta

former_member184681
Active Contributor
0 Kudos

There are two options:

1. You did not import the IDoc structure to ESR, or

2. Your IDoc definition only allows 1 occurrence of the Discount segment.

In case 1, simply import the structure. Or re-import it for safety. In case 2, you need to change the IDoc structure (if it's a custom one) or think about an extension (in case of standard IDoc, because then it doesn't support your requirement).

Regards,

Greg

Answers (0)