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

Mapping from flat sql message to nested idoc

Hi,

im trying to map the values from a database select to an idoc. the structure is like that:

?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="">
   <ns0:Message1>
      <ns1:MT_SQL_Invoice_Req_response xmlns:ns1="">
         <SELECT_STATEMENT_response>
            <row>
               <ID>
               <TYPE>
               <VALUE>
            </row>
            <row>
               <ID>
               <TYPE>
               <VALUE>
            </row>
         </SELECT_STATEMENT_response>
      </ns1:MT_SQL_Invoice_Req_response>
   </ns0:Message1>
</ns0:Messages>

So I'm getting several rows in one message. For every <ID> i want to create a new Idoc. This problem i solved with a sort and split function. (BPE) Now i want to check if the <TYPE> has a specific value "POS" If that value is in the row i want to create a new row for an Item in the idoc. If the <TYPE> is "TAX" i want a new row in the idoc in position/tax. I'm quite new to SAP PI so I am sorry that i can't describe my problem better. Does anybody have an idea how i can solve that problem?

Thank you in advance for your advices

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 02, 2011 at 03:51 AM

    Does your question is if <type>="POS" then generate line item segment else if <type>="TAX" then generate Position/Tax segment

    If yes then use the below condition to generate

    1. Line Item (use ifWithoutElse function)

    if <type>="POS" then 'true' -


    createIf -


    Line Item segment

    2. Position/Tax

    if <type>="TAX" then 'true' -


    createIf -


    position/Tax segment

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 01, 2011 at 04:54 PM

    Just Few cents...

    For every ID you need to create a new idoc rite? If so use this [link|https://wiki.sdn.sap.com/wiki/display/XI/File%20to%20Multiple%20IDOC%20Splitting%20without%20BPM]

    This way you can create for every row a seperate idoc.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 01, 2011 at 05:55 PM

    Hi Stefan,

    try to avoid ccBPM/BPE, it´s usually a performance problem. You can use the link mentioned before in order to generate several IDOCs without BPM. Regarding your problem at position level, you can use the if function to filter based on the TYPE field, you propably will have to apply the same filter for the VALUE field.

    Regards,

    Matthias

    Add a comment
    10|10000 characters needed characters exceeded

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.