Skip to Content
author's profile photo Former Member
Former Member

PI 7.11: IDoc Message mapping

Hi there,

I'm currently working on a graphical message mapping using IDoc HRMD_A06 as source structure (HR master data transferred via PFAL).

In my result structure I have to fill a field CostCenter with the following logic:

If field KOSTL (cost center) is filled in node E1P0315, map this field to CostCenter in result structure, otherwise take KOSTL of node E1P0001.

The end date (ENDDA) has to be '99991231' in each case.

This is how the result structure looks like:

<e>                       [1...1]
  <CostCenter>            [1...1]

This is the simplified source structure:

  <E1PITYP SEGMENT="1">                        [0...n]
     <E1P0001 SEGMENT="1">                     [0...n]
       <INFTY>0001</INFTY>                     [0...1]
       <ENDDA>99991231</ENDDA>                 [0...1]
       <KOSTL>0000012345</KOSTL>               [0...1]
  <E1PITYP SEGMENT="1">                        [0...n]
    <E1P0315 SEGMENT="1">                      [0...n]
      <INFTY>0315</INFTY>                      [0...1]
      <ENDDA>99991231</ENDDA>                  [0...1]
      <KOSTL>0000024001</KOSTL>                [0...1]

How can I do the check if field KOSTL of node E1P0315 is null?

I've tried an existence check for the whole node (E1P0315->exists), but then it fails, because all E1PITYP nodes are processed.

I hope my problem is clear to you.

Would it be better to use another mapping type?

As I'm an ABAP developer, I would of course prefer some lines of code to this graphical drag&drop thing.

Thanks in advance!

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 12, 2011 at 07:33 PM


    I think you can use mapWithDefault function.


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 12, 2011 at 10:34 PM

    Yes, use of mapWithDefault function would help you.

    pseudo logic

    KOSTL->Mapwithdefault ->equals (String function and compare with "" value) ->(if without else ) ->pass the value KOSTL to output

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Cheers, guys!

      I did it now like that:

      Click on the image to enlarge it!

      The logic is as following (ABAP Pseudo-code 😉 ):

      IF 0315_KOSTL and 0315_ENDDA are populated.
        IF 0315_ENDDA equals '99991231'.
          map 0315_KOSTL to Cost_Center.
        IF 0001_KOSTL and 0001_ENDDA are populated.
          IF 0001_ENDDA equals '99991231'.
            map 0001_KOSTL to Cost_Center.

      Is that a good way to do that mapping?

      Do I also have to use the removeContexts function or is it ok like that?

      Could I also do that with an ABAP mapping program?

      Thanks in advance!

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.