Message Mapping - Filter on parent element

Hi,
I'm using message mapping for mapping IDoc ORDERS05 to flat file.
This is the source structure :
ORDERS05  1..1
---- IDOC  1..1
     ---- E1EDKT1  0..99
          ---- TDID  0..1
          ---- TSSPRAS_ISO
          ---- E1EDKT2  0..9999999
               ---- TDLINE  0..1
and this is the target structure :
TCD 1..1
---- TCT  1..unbounded
     ---- TDID
     ---- TDSPRAS
     ---- TDLINE
Can anybody help me about how to do the mapping for having 1 TCT element for each
E1EDKT2 element with parent (E1EDKT1) having field TDID equals to the constant "ZALO" ?
For exemple:
<ORDERS05>
   <IDOC>
      <E1EDKT1>
         <TDID>ZALO</TDID>
         <TSSPRAS_ISO>tdspras1</TSSPRAS_ISO>
         <E1EDKT2>
            <TDLINE>tdline11</TDLINE>
         </E1EDKT2>
         <E1EDKT2>
            <TDLINE>tdline12</TDLINE>
         </E1EDKT2>
      </E1EDKT1>
      <E1EDKT1>
         <TDID>unused</TDID>
         <TSSPRAS_ISO>tdspras2</TSSPRAS_ISO>
         <E1EDKT2>
            <TDLINE>tdline2</TDLINE>
         </E1EDKT2>
      </E1EDKT1>
      <E1EDKT1>
         <TDID>ZALO</TDID>
         <TSSPRAS_ISO>tdspras3</TSSPRAS_ISO>
         <E1EDKT2>
            <TDLINE>tdline3</TDLINE>
         </E1EDKT2>
      </E1EDKT1>
   </IDOC>
</ORDERS05>
must result in :
<?xml version="1.0" encoding="UTF-8"?>
<TCD>
     <TCT>
          <TDID>ZALO</TDID>
          <TDSPRAS>tdspras1</TDSPRAS>
          <TDLINE>tdline11</TDLINE>
     </TCT>
     <TCT>
          <TDID>ZALO</TDID>
          <TDSPRAS>tdspras1</TDSPRAS>
          <TDLINE>tdline12</TDLINE>
     </TCT>
     <TCT>
          <TDID>ZALO</TDID>
          <TDSPRAS>tdspras3</TDSPRAS>
          <TDLINE>tdline3</TDLINE>
     </TCT>
</TCD>
Thanks in advance,
Laurence

Hi,
When implementing your solution, I get only 1 TCT per E1EDKT01 (and no more loop on E1EDKT02) and filter on "ZALO" TDID is not working.
<TCT>
     <TDID>ZALO</TDID>
     <TDSPRAS>tdspras1</TDSPRAS>
     <TDLINE>tdline11</TDLINE>
</TCT>
<TCT>
     <TDID>unused</TDID>
     <TDSPRAS>tdspras2</TDSPRAS>
     <TDLINE>tdline2</TDLINE>
</TCT>
<TCT>
     <TDID>ZALO</TDID>
     <TDSPRAS>tdspras3</TDSPRAS>
     <TDLINE>tdline3</TDLINE>
</TCT>
I have changed context of TDID to ORDERS05, and context of E1EDKT2 to ORDERS05 too.  Aren't thoses contexts correct?
Laurence

Similar Messages

  • Changing datatype, afterwards Message-Mapping cannot produce target element

    Hi,
    we use PI/700.
    I changed a working system by changing a datatype of an existing message (adding a new element). My interface mapping contains two mappings: an XSL-Mapping and afterwards a Message-Mapping.
    My interface mapping looks like this:
    Message-Type A ->
          XSL-Mapping ->
    Message-Type B ->
          Message-Mapping ->
    Message-Type B
    When I test each mapping alone everything works fine (with the new element I added).
    But if I test my interface mapping in IBD with both mappings together, I'll get an error:
    "Cannot produce target element /MT_EDM_OUTBOUND_LASTGANG_TO_SAP/LASTGANG/MASSEINHEIT. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd".
    Is it possible that XI has problems in refreshing the XSDs?
    I tried this:
    (1) I changed my Message-Mapping and now all elements are mapped 1:1 -> no success!
    (2) Later I changed my Message-Mapping and build in "exists" with "if" to check whether the element "MASSEINHEIT" is generated by the XSL-Mapping -> It doesn't exists (??? - WHY? - when I test it, everything works fine)
    (2) Afterwards I changed my interface mapping and take only the XSL-Mapping (without the following Message-Mapping) -> the element "MASSEINHEIT" exists now!
    I'm totally confused!
    Any ideas?
    Regards
    Wolfgang Hummel

    Hi,
    If you have made structural changes to the data type..such as number of fields have decreased/increased..or some new fld altogether, then you have to activate the datatype..goto message mapping and then re-do the mapping...but if you have made "typo" changes like names have been changed, etc..then i think it should be alrite..i have sometimes made changes to my datatype, but after activating it, i had to redo the mapping..that was it!...the rest would fall into place:) No changes had to be made in the interface mapping..
    Regards,
    Sushumna

  • BPM Message Mapping: "Cannot produce target element /ns1:BAPI...."

    Hi,
    A scenario File - BPM - BAPI call was developed, as described in blog 'RFC scenario using BPM' cfr. link
    /people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit
    The Mapping is as follows:
    MT_EDB_MATERIAL_REQ (1:1) --> BAPI_MATERIAL_EXISTENCE_CHECK (1:1)
    MATNR (1:1) -
    > MATERIAL (1:1)
    When executing the scenario, an error appears in the trace of SXMB_MONI, step 'Request Message Mapping'
    Cannot produce target element /ns1:BAPI_MATERIAL_EXISTENCECHECK. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd....
    I tried the following:
    1) import the XML-file into the testmapping: executed successfully
    File:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_EDB_MATERIAL_REQ xmlns:ns0="http://agfa.com/SD_EDB">
    <MATNR>15P6X</MATNR>
    </ns0:MT_EDB_MATERIAL_REQ>
    2) Removed the mapping on node level and left mapping only on element level (material): same error
    3) Activated the message mapping, interface mapping, determinations, etc again...:same error
    4) Removed the Interface Mapping and created it again: same error
    5) Compared the version ID of the Interface Mapping/message mapping in the Monitor trace with the version ID of the IR and saw that there was a difference.
    After the CPA full cache, SXI_CACHE full refresh and object refresh in the IB Administration, the differences remain, and also the error....
    Anybody an idea ?

    Hi
    >>>Cannot produce target element /ns1:BAPI_MATERIAL_EXISTENCECHECK. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd....
    The error clearly says that one of the occurrence value  for the target node mentioned is not coming from the source during mapping. The easiest way to solve the problem is as follows
    <b>
    First Execute the mapping as pointed out by "Raj" and the following steps.
    </b>
    1. Goto the Mapping Editor
    2. Double click on the target node that is causing the problem here BAPI_MATERIAL_EXISTENCECHECK.
    3.  Right click on the same node and select "DisplayQueue".
    4. View the Queue.
    5. YOu will find "Suppress" entries, which means a value is expected but no value is coming in.
    6.Go from right to left and check each node in the mapping and you will be able to trace where the suppress node comes from and take appropriate action
    regards
    krishna

  • Error in message mapping - Cannot produce target element

    As one step in my integration process, I am builing a very simple file to BPM integration (inbound MI async, outbound MI abstract).
    The source type and the target type are completely equal - I am only doing some modifications to some of the content.
    The type for both messages - source & target message - is an imported external definition (DTD), and hence no DT or MT are created.
    As a first step I am trying to fill the target message with the content from the source message (without any modifications to the content). However, when testing this in the message mapping area, I get an error message already when filling the first element, the 'root node'.
    The error message is as follows:
    Start of test
    Compilation of <MM name> successful
    Cannot produce target element <elementname>. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd Cannot produce target element <elementname>. . Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd
    End of test
    Any suggestions?
    Thanks,
    C

    Thanks,
    when creating the source message manually in the MM it worked - so nothing wrong with the mapping.
    I saved this file and compared with the "original file" - containing the content which I wanted to upload, and on which the xsd (external definition) was based - and there where some inconsistancies.
    I changed some values in the source XML which made it work, also when uploading the file from a drive.
    So, I will go back to the source system and try to get a better XML.
    Thanks for now!

  • Message-Mapping: nested Loops over Elements

    Hi Experts,
    I have problems with my Message-Mapping in the IR. I have a source and a target structure. In the following I will give you easy examples of these structures:
    <u>source structure:</u>
       <E1EDP01>
          <E1EDP19>
             <QUALF> ... </QUALF>
             <IDTNR> ... </IDTNR>
          </E1EDP19>
          <E1EDP19>
             <QUALF> ... </QUALF>
             <IDTNR> ... </IDTNR>
          </E1EDP19>
       </E1EDP01>
       <E1EDP01>
          <E1EDP19>
             <QUALF> ... </QUALF>
             <IDTNR> ... </IDTNR>
          </E1EDP19>
          <E1EDP19>
             <QUALF> ... </QUALF>
             <IDTNR> ... </IDTNR>
          </E1EDP19>
       </E1EDP01>
    <u>target structure:</u>
    <LineItem>
       <IDTNR></IDTNR>
    </LineItem>
    <LineItem>
       <IDTNR></IDTNR>
    </LineItem>
    That means:
    For every <E1EDP01> in the source structure I create one <LineItem> in the target structure. One E1EDP01-Element can contain more than one E1EDP19-Elements. I have to loop over these E1EDP19-Elements, because I have to locate the Element <QUALF> with a given (fixed) value. The Mapping should put the value from the Element <IDTNR> from the source structure - where the QUALF-Element has this given value - in the IDTNR-Element of the target structure.
    I tried it with a UDF, but only the first <IDTNR> in the target structure got filled.
    Thanks for your help
    Christopher

    Thank you,
    but how I can set the Elements IDTNR and QUALF to the context E1EDP01?
    In the splitByValue-Function do I need "each value"?
    best regards
    Christopher

  • Message mapping: Insert LineBreak into Element Value

    Hi everybody,
    we use a mapping for generating the content of an email body.
    I have to insert lineBreaks.
    How can I do this in message mapping?
    Regards Mario

    Mario,
    Your question is already answered.
    Did using \n helped you?
    You seem to have marked the thread as answered and didnt award points.
    So i feel anyone who has a similar issue and searches for this thread wont know which thing to do to solve the problem.
    This is one of the reasons why points system are there.
    Regards,
    Sumit
    ps: i know you are a big time contributor in sdn.  I think doing a little bit extra will help everyone.

  • How to find length of integer elements using message mapping

    Hi all,
             How can I find the number of digits in an element using message mapping
    XIer

    Satish,
               Cause I have to write the code for 100 elements, I have decided to have a AUDF with two inputs;
    1) for the element
    2) for the length of the data type (I am passing length using Constant message mapping func).
    Now when I change my UDF and try running it I get the following error:
    <b><i>Start of test
    Source code has syntax error:  /usr/sap/B06/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map0999e66045cf11dcc83b4ebcfc11da82/source/com/sap/xi/tf/_MM_Recordcount1_.java:160: operator >= cannot be applied to int,java.lang.String if(Element_Name.length()>=Element_Length) ^ /usr/sap/B06/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map0999e66045cf11dcc83b4ebcfc11da82/source/com/sap/xi/tf/_MM_Recordcount1_.java:166: operator <= cannot be applied to int,java.lang.String for(int i=Element_Name.length();i<=Element_Length;i++) ^ 2 errors</i></b>
    The code I have used is:
    public String Include_Space(String Element_Name,String Element_Length,Container container)
    {StringBuffer sb= new StringBuffer();
    if(Element_Name.length()>=Element_Length)
    return""Element_Name"";
    else
    for(int i=Element_Name.length();i<=Element_Length;i++)
    if(i==Element_Name.length())
    sb.append(Element_Name);
    else
    sb.append(" ");
    return ""sb.toString()"";
    Pls advice, where I am going wrong...
    XIer
    Message was edited by:
            XIer

  • Accessing Element's name in Message mapping

    Hi,
       I need to Access the Element's name in Message mapping (Using graphical tool or in user defined function).
    For Example:
    Element: <Company_Name>XYZ Co </Company_Name>
    I need to access the Element's name(i.e.)<b>"Company_Name"</b>. So that I can map it as
    <Element>Company_Name</Element>
    <Element_Value>XYZ Co </Element_Value>
    in the target message.
    Kindly provide your inputs.

    Hi Santhosh,
    I am not sure if this can be done using your Graphical Mapping, but this is possible using JAVA mapping. Your SAX and DOM parsers for JAVA mapping provides methods like getChildNodes, getElementName using which you can get the name of the element.
    Check this link for the methods available for Java Mapping,
    http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/parsers/package-summary.html
    I think the same can also be done using XSL mapping. Though, I am not sure what method should be used for the same.
    Hope this helps,
    Regards,
    Bhavesh

  • Message Mapping: Map value from the first element in a context in target el

    Hi experts,
    I have a problem with a message mapping in XI. I hope you can help me. At first I will give you a source and a target structure. Then I will explain the problem.
    <u>Source structure:</u>
    <E1EDP01>
       <E1EDPT1>
          <TDID> ... </TDID>
          <E1EDPT2>
             <TDLINE> ... </TDLINE>
          </E1EDPT2>
       </E1EDPT1>
    </E1EDP01>
    The structure can contain more than one E1EDP01-Elements, more than one E1EDPT1-Elements and more than one E1EDPT2-Elements.
    <u>target structure:</u>
    <LineItem>
       <vendmemo> ... </vendmemo>
    </LineItem>
    For every E1EDP01-Element my mapping creates one LineItem-Element in the target structure. To fill the element <vendmemo> the mapping should do the following steps:
    The mapping should search in E1EDP01 for a E1EDPT1 with the TDID = Z505. And from this E1EDPT1-Element (with the TDID=Z505) the mapping should take the value <TDLINE> from the first E1EDPT2-Element in the context of the E1EDPT1-Element (the E1EDPT1 with the TDID=Z505) and put this value in <vendmemo>.
    The mapping should do this action for every E1EDP01 -> so for every LineItem.
    I tried it with UDF but I didn't found a solution. Can anybody help me?
    best regards
    Christopher

    Hello experts,
    i was wrong ... my mapping isn't still working. I had created a test instance. and only for this test instance the mapping (see above) works.
    Can anybody help me? I'm trying the whole day but I can't find a solution. Here a second description of my problem:
    <u>Source Structure:</u>
    <E1EDP01>
       <E1EDPT1>
          <TDID> ... </TDID>
          <E1EDPT2>
             <TDLINE> ... </TDLINE>
          </E1EDPT2>
          <E1EDPT2>
             <TDLINE> ... </TDLINE>
          </E1EDPT2>
          <E1EDPT2>
             <TDLINE> ... </TDLINE>
          </E1EDPT2>
       </E1EDPT1>
    </E1EDP01>
    <E1EDP01>
       <E1EDPT1>
          <TDID> ... </TDID>
          <E1EDPT2>
             <TDLINE> ... </TDLINE>
          </E1EDPT2>
          <E1EDPT2>
             <TDLINE> ... </TDLINE>
          </E1EDPT2>
          <E1EDPT2>
             <TDLINE> ... </TDLINE>
          </E1EDPT2>
       </E1EDPT1>
    </E1EDP01>
    <u>Target Structure:</u>
    <LineItem>
       <vendmemo> ... </vendmemo>
    </LineItem>
    <LineItem>
       <vendmemo> ... </vendmemo>
    </LineItem>
    <u>Description of my Problem:</u>
    For each E1EDP01 in the source structure the mapping creates one LineItem in the target structure.
    The element "vendmemo" should be created in any case ... also if it will be empty.
    To fill the element "vendmemo" the mapping should search in E1EDP01 for a E1EDPT1 with the TDID=Z505. If there is an element E1EDPT1 with the TDID=Z505, the mapping should write the TDLINE from the first E1EDPT2 (under the element E1EDPT1 with the TDID=Z505) in the target field "vendmemo".
    The Problem is that TDLINE an TDID are not in the same context. I tried it with setting the context of both to E1EDP01. But it was not working ... have you any idea oder suggestion?
    Thank you very much
    best regards
    Christopher

  • Problem with Message-Mapping: Loop over Elements possible?

    Hi all,
    I want do create a Message-Mapping for an IDoc-to-File Scenario. In the Source Structure there are some Elements which can appear more than once (1..unbounded). I need a mechanism which loops over these elements and search for specified values. From the Element which contains an element with this specified value the mapping should write a value in the target structure.
    Here a simple example (source structure) for better understanding:
    <root>
       <invoice>
          <number> 10 </number>
          <sum> 200.00 </sum>
       </invoice>
       <invoice>
          <number> 20 </number>
          <sum> 150.00 </sum>
       </invoice>
       <invoice>
          <number> 30 </number>
          <sum> 120.00 </sum>
       </invoice>
    </root>
    Now the duty of the Mapping should be to search in the elements <invoice> for the number 30. And then the sum of the invoice with the number 30 should be written in a field of the target structure.
    I tried it out with a constant togehter with an equalsS-function and an ifWithoutElse-function, but it is working only then, if the invoice with the number 30 has the first position in the root context.
    Can anybody help me? Thanks
    With kind regards
    Christopher

    Hi,
    Write a UDF to sum the required values and map to target node.
    See while writing the UDF select the type as queue.
    number -- removecontext-UDF targetnode
    sum----removecontext--/
    number abd sum or the two inputs
    in UDF
    int nsum = 0;
    for(int i;i < number.length;i++){
      if number(i).equals("30") then
         nsum = nsum + valueOf(sum(i));
    result.addValue(nsum); // convert the nsum into string
    Regsrds
    Chilla

  • Get the value of Container element in message mapping

    Hi,
    Is it possible to read the value of container elements(bpm) in a UDF defined in message mapping. If yes, please tell me how?
    Thanks and regards,
    Siji

    Siji,
    Refer thread - Creating the container Object In Java Mapping
    Regards,
    Geetha

  • Element/ Node supression in message mapping

    Hi,
    Source Structure
    ID (Mandatory)
    FName (optional)
    Target Structure
    EmpID (mandatory)
    EmpName (optional)
    In my mapping, i mapped FName to EmpName. Since FName is optional,when i have an XML file that does not contain Name element my message mapping fails. So i used "if-then-else" and "exists" to make the mapping work.
    Name --> <b>"exists"</b> --><b>"if-then-else",</b>
         FName--> EmpName (then)
         Constant-->EmpName(else)
    But now i want that my o/p element (EmpName) should not get generated, if Name element does not exist. I mean the element Empname should be supressed in message mapping.
    I know that if a target field is mapped, it is bound to come in the target structure. But i want this target element to be supressed.
    Hope somebody can help me out...
    Cheers,
    Siva Maranani

    Hi Siva,
    If i understand u correctly you want to supress the target field if the mapped source field does not exist:
    Try using IF WITHOUT ELSE
    When the source field exists then you will have the value mapped to the target field and when the source field does not exist, the target field will not be created.
    Regards,
    Sridhar

  • Putting filter in message mapping

    I am trying to put a filter for company codes such that if a type of company code comes in the file from source, it will filter out and send it to target system. I have set of company codes and values that I want to pass but want to filter out some company codes with certain values only. How can I achieve that? One possible way I can think of is If/then/Else logic with fixed values mapping.
    Is there a blog or step by step guide? Can anyone help how I can do this in message mapping?
    Thanks for your help.

    hi,
    if you filter multi-row record for source, if/else, not solution, you should look at this blog, if XI is 3.0 version,  /people/venkataramanan.parameswaran/blog/2006/03/17/illustration-of-enhanced-receiver-determination--sp16
    Does anybody know how to handle this with XI 7.0?
    because SAP_BASIS_7.0 does not have http://sap.com/xi/system, ReceiverDetermination for Message Interface under interface object.
    thanks
    venjamin

  • Message mapping: Passing data at the node level

    Hi,
    I have a question/requirement, XI Message Mapping program need to read the incoming xml and map to a diffrerent target structure. Incoming xml has a parent node called Description and it has a value "Frauen Hemd Shoes", we need to map this value to target LongText Field but message mapping is ignoring this data while mapping.
    A parent node can't hold the value/data while a child node is present. So is there any workaround to read this data to target str?
    <Description>
    <ShortName>Shoes</ShortName>
    Frauen Hemd Shoes
    </Description>
    Expected result:
    <Comments>
    <ShortText>Shoes</ShortText>
    <LongText>Frauen Hemd Shoes</LongText>
    </Comments>
    Please let me any clues to resolve the issue.
    thanks,
    Laxman

    I agree , the soruce structure is not a valid one..
    The source structure should look like the below:
    <Description ShortName='Shoes'>
    Frauen Hemd Shoes
    </Description>
    where ShortName is attribute for the Element "Description".
    You add attribute to the element the same way you add subElement, Just choose attribute instead of subelement.
    In this case the Mapping would be
    Descriprion -
    > LongText (target)
    ShortName -
    > ShortText (target)
    This Should work.
    Regards.
    Jeet.

  • XI Message Mapping for ORDER03

    Hello,
    We are in the process of mapping ORDERS03 to xCBL (supplier needed this in the format).
    We need to map IDTNR (ORDERS03\E1EDP01\E1EDP19) to vendor material if the QUALF (ORDERS03\E1EDP01\E1EDP19) value is 002.
    Also, we need to map IDTNR (ORDERS03\E1EDP01\E1EDP19) to buyer material if the QUALF (ORDERS03\E1EDP01\E1EDP19) value is 001.
    How can I achieve this? Please help.

    Hi Ppeter,
    ACtually I did something very similar in the message mapping and it depends also upon the exact structure and cardinality of your target nodes/elements.
    So I give just one exmaple but your case might need a variant upon this :
    So one option is that you only create the output node if the input node is available :
    1)Position yourself in the targetmessage on the PARENT node of the vendor material element :
    -add the QUALF
    -add a constant '002'
    -Use the standard StringCompare Function
    -link the output to the node function 'CreateIf'
    -link the createif to the target element ( = parent of vendor material )
    2) Position yourself on the vendor material : link directly with the IDTNR
    If the parent node contains other elements that need to be there independent of the vendor material, you can't use this of course. Then you can use a boolean function 'ifwithoutelse' instead of the 'createif' : if the qualf is 002 you link the IDTNR to the 'then' part of the ifwithoutelse and the output to the vendor material node
    In any case, you might need to change the context  from the QUALF ( right click / context ) to get the desired results
    rgds
    Dirk

Maybe you are looking for

  • Adobe Creative Cloud Crashing on Windows 8

    I have two programs that continue to crash/not respond. Premier Pro and Audition.   Several questions have been asked here:Re: Adobe audition CC keeps crashing  with no answers. I have uninstalled both programs and reinstalled-updated with no luck.  

  • Slow report caused by 85K record dataset

    I'm developing a report that cross validates fields in the Item table, based on criteria-FILTERS. I have 30 such FILTERS. Item Table is all about Item SKU properties and has Fields like: group, category, colour, price, cost, brand,class, etc Filters

  • Unable to communicate with printer-hp deskjet 1000

    I have used this Printer for almost 2 yrs and dis problem ne'er occoured before........forst my text print came distorted then it showed offline and later its says printer is ready but when i give the print command......it says "unable to communicate

  • Services in a two node installation

    Hi, we have 2 node installation of R12.1.1 Node A: Database & Batch Processing Node B: Application Services(Root service, web entry point services, web application services & other services) One thing i need to clarify Should i have to select root se

  • Transfer video from iphone to computer?

    How do I transfer my videos from my iPhone 4s to my computer.  I try just copy & pasting them from my phone to my computer using My Computer, but the videos play upsided down on my computer.  Any idea what I am doing wrong?