Splitting logic in map

Hi,
I have an image element in the source schema and the value which i will be getting in that field will look this
; NS2151--C1819ISPT-20.jpg; NS2151--C1819ISPT-20-1.jpg; NS2151--C1819ISPT-20-2.jpg; NS2151--C1819ISPT-20-3.jpg
Now i need to split the string and create fields in the destination
The incoming field can have 1 to 4 .jpg image names separated by semi colon. if i have one .jpg i have create one custom attribute in the destination and if have 2 image names i have to create 2 custom attributes in the destination and so on.
Is there any way that i can handle this logic in the map
Thanks
sree

Hi Sree,
I would advise you to use recursive XSLT Template for this.
Links below will help you achieve this. 
http://social.technet.microsoft.com/wiki/contents/articles/23662.biztalk-create-repeating-records-from-comma-separated-values.aspx
http://kentweare.blogspot.in/2008/08/biztalk-mapper-transforming-comma.html
Rachit

Similar Messages

  • Message Split Comes Before Mapping

    Hi,
    Can anybody explains the following queries....
    1.Why Message Split Comes Before Mapping in Pipeline Steps?
    2.What do you mean by Collaborative Profile and Collaborative Agreement?
    3.What are Context Path, Context Object and Context Handling?
    4.Which adpaters run on j2ee engine and which run on ABAP stack.
    5.What is the need of datatype when we are creating the message type
    6. and similarly what is the use of Business system when we are creating the corresponding Technical system
    Thanks n Advance.,
    Stallin

    >>1.Why Message Split Comes Before Mapping in Pipeline Steps?
    Simple. Imagine you have 2 receivers with different mappings. If this has to work correct, XI needs to copy of the source msg for doing the mapping. rite?
    >> 2.What do you mean by Collaborative Profile and Collaborative Agreement?
    Collaborative profile -->Serivce with out party and service and all the commn channels you create for it.
    Collaborative agreement -->Sender & Receiver agreements, that bind your cc with the interface.
    >> 3.What are Context Path, Context Object and Context Handling?
    Context path- It is Xpath expressions I guess. It is used for specifying conditions in receiver determination and interface determination.
    Context Objects -- Used for the same.It reduces the complex Xpath expressions.
    >>4.Which adpaters run on j2ee engine and which run on ABAP stack.
    All adapters are part of j2ee frame work except IDOC and HTTP adapters. You dont need sender agreements for the 2.
    5.What is the need of datatype when we are creating the message type
    To get the valid XML structure.
    6. and similarly what is the use of Business system when we are creating the corresponding Technical system
    Tech systems -->Physical entiteis
    Buss Systems --> Logical entities.
    Regards,
    Jai Shankar
    Message was edited by:
            Jai Shankar

  • Split Logic in HR ABAP

    Hi Experts,
    I need to a code snippet or a sample program which has the split logic functionality.
    I know that in HR ABAP we have a standard functionality using PROVIDE and ENDPROVIDE which performs the split based on the records in the specific period from the infotypes.
    Need the same functionality but I don't want to use PROVIDE and ENDPROVIDE.
    Kindly help me in this requirement or share me your knowledge if have gone through this requirement.
    Regards,
    Thirumoorthy R

    Hi,
    the major advantage of PROVIDE - ENDPROVIDE ist it's greatest disadvantage as well.
    The fields fencing the validity (usually BEGDA and ENDDA) for each involved table, will be set according to each resulting split-interval.
    If this is, what you're trying to avoid, you'll have to do a nested loop.
    Assuming you have two internal table A and B, both having BEGDA and ENDDA.
    You then could do something like:
    LOOP AT A into wa_a.
         LOOP AT B into wa_b where begda LE wa_a-endda and endda ge wa_a-begda.
    *       Do something clever here
         ENDLOOP.
    ENDLOOP.
    Note, how the intervals are built by comparing the fields overcross, thus giving you in the inner loop, all entries that are at least one day valid within the interval set by the outer loop.
    Hope it helps.
    Best regards - Jörg

  • Splitting logic using LSMW

    Hi gurus,
    could anyone plz tell me the load logic and the splitting logic for the following scenario:
    Conversion of General Ledger Balances from the various legacy systems into SAP.  The balances will be loaded month for the current year only.
    SAP has a Limitation of 999 line items per Document.  If the conversion of the general ledger balance exceeds the 999 document line item limit, the record being loaded will need to be split into multiple documents to comply with size limitations.
    The purpose of this document is to define General Ledger header and line item fields that will need to be populated. 
    could anyone plz tell me how 999 documents can be splitup from n number of records using LSMW.

    Hi Karthik,
    For handling this situtation:
    1. First declare variable in global declaration wity type P
       data: ws_numrec type p.
    2. In the BEGIN_OF_RECORD of LSMW put this piece of code:
        ws_numrec = ws_numrec + 1.
        if ws_numrec GT 999.
          transfer_transaction
       endif.
    Hope this will help you.
    Regards
    Krishnendu

  • Batch splitting logic

    Hi
    I am required to add batch splitting logic in below code.
    Any one tell me how to do this
    PERFORM get_invoice_data.
      PERFORM filter_invoice_data.
    FORM get_invoice_data.
        SELECT k~vkorg k~vbeln k~fkart k~vtweg k~fkdat  "CHOYT CHG#1589121
               k~waerk k~bzirk k~regio
               k~BSTNK_VF                                       "Mod-010++
               p~posnr p~vkgrp p~vkbur p~mvgr5 p~matnr
               p~arktx p~fkimg p~vrkme p~netwr p~mwsbp
               p~aubel p~vgbel p~vgtyp
               p~charg p~werks k~fkart
               k~xblnr
          INTO CORRESPONDING FIELDS OF TABLE t_vbrp
          FROM vbrk AS k INNER JOIN vbrp AS p
            ON k~vbeln = p~vbeln
         WHERE k~vkorg IN s_vkorg "<< MOD CHOYT CHG#1589121
           AND k~fkdat IN s_fkdat
           AND k~vtweg IN s_vtweg
           AND k~rfbsk = 'C'      " Accounting document has been created
           AND vkgrp IN s_vkgrp
           AND vkbur IN s_vkbur.
    ENDFORM.                    " get_invoice_data
    FORM filter_invoice_data.
      DATA lt_vbpa LIKE t_vbpa OCCURS 0 WITH HEADER LINE.
    If not t_vbrp[] is initial. "Mod-004++
      REFRESH lt_vbpa.
      SELECT vbeln parvw kunnr
        FROM vbpa
        INTO CORRESPONDING FIELDS OF TABLE lt_vbpa
        FOR ALL ENTRIES IN t_vbrp
       WHERE vbeln = t_vbrp-vbeln
         AND posnr = '000000'.    " Header partner
      SELECT vbeln parvw kunnr
        FROM vbpa
        APPENDING CORRESPONDING FIELDS OF TABLE lt_vbpa
        FOR ALL ENTRIES IN t_vbrp
       WHERE vbeln = t_vbrp-vbeln
         AND parvw = 'WE'.    " Header partner
    Endif. "Mod-004++
      SORT lt_vbpa BY vbeln.
      t_vbpa[] = lt_vbpa[].
        LOOP AT lt_vbpa WHERE vbeln = t_vbrp-vbeln
                          AND parvw IN s_parvw
                          AND kunnr IN s_kunnr.
          EXIT.
        ENDLOOP.
        IF sy-subrc <> 0.
          DELETE t_vbrp.
        ENDIF.
      ENDLOOP.
      IF c_prf = 'X'.                                           "KA01
        SORT t_vbrp DESCENDING BY posnr vbeln fkart.            "KA01
        SORT t_vbrp DESCENDING BY vgbel fkart.
       LOOP AT t_vbrp WHERE rfbsk NE 'C'.
          t_vbrp_c = t_vbrp.
          APPEND t_vbrp_c.
          DELETE t_vbrp.
        ENDLOOP.
        SORT t_vbrp_c DESCENDING BY vgbel vgpos vbeln.
        DELETE ADJACENT DUPLICATES FROM t_vbrp_c
               COMPARING vgbel vgpos fkart.
        LOOP AT t_vbrp_c.
          t_vbrp = t_vbrp_c.
          APPEND t_vbrp.
        ENDLOOP.
        SORT t_vbrp.
      ENDIF.                                                    "KA01
    ENDFORM.                    " filter_invoice_data

    Hi Kumar,
    You should format your code before posting... I have done it and put it just below :
    PERFORM get_invoice_data.
    PERFORM filter_invoice_data.
    FORM get_invoice_data.
    SELECT k~vkorg k~vbeln k~fkart k~vtweg k~fkdat "CHOYT CHG#1589121
         k~waerk k~bzirk k~regio k~BSTNK_VF "Mod-010++
         p~posnr p~vkgrp p~vkbur p~mvgr5 p~matnr
         p~arktx p~fkimg p~vrkme p~netwr p~mwsbp
         p~aubel p~vgbel p~vgtyp p~charg p~werks k~fkart k~xblnr
      INTO CORRESPONDING FIELDS OF TABLE t_vbrp
      FROM vbrk AS k
      INNER JOIN vbrp AS p
       ON k~vbeln = p~vbeln
        WHERE k~vkorg IN s_vkorg "<< MOD CHOYT CHG#1589121
          AND k~fkdat IN s_fkdat AND k~vtweg IN s_vtweg
          AND k~rfbsk = 'C' " Accounting document has been created
          AND vkgrp IN s_vkgrp AND vkbur IN s_vkbur.
    ENDFORM. " get_invoice_data
    FORM filter_invoice_data.
    DATA lt_vbpa LIKE t_vbpa OCCURS 0 WITH HEADER LINE.
    IF NOT t_vbrp[] IS INITIAL. "Mod-004++
      REFRESH lt_vbpa.
      SELECT vbeln parvw kunnr FROM vbpa
        INTO CORRESPONDING FIELDS OF TABLE lt_vbpa
        FOR ALL ENTRIES IN t_vbrp
          WHERE vbeln = t_vbrp-vbeln
           AND posnr = '000000'. " Header partner
      SELECT vbeln parvw kunnr FROM vbpa
        APPENDING CORRESPONDING FIELDS OF TABLE lt_vbpa
        FOR ALL ENTRIES IN t_vbrp
         WHERE vbeln = t_vbrp-vbeln AND parvw = 'WE'. " Header partner
    ENDIF. "Mod-004++
    SORT lt_vbpa BY vbeln.
    t_vbpa[] = lt_vbpa[].
    " I believe that you have forget the following line, isn't it?
    LOOP AT t_vbrp.
    " ^^^^^^^^^^^^^^
      LOOP AT lt_vbpa WHERE vbeln = t_vbrp-vbeln
             AND parvw IN s_parvw
             AND kunnr IN s_kunnr.
        EXIT.
      ENDLOOP.
      IF sy-subrc 0.
        DELETE t_vbrp.
      ENDIF.
    ENDLOOP.
    IF c_prf = 'X'. "KA01
    " Are you sure you want to sort your internal table twice ???
      SORT t_vbrp DESCENDING BY posnr vbeln fkart. "KA01
      SORT t_vbrp DESCENDING BY vgbel fkart.
    " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    " I don't understand why you delete some lines in T_VBRP
    " that you after insert again in T_VBRP
    " (a sort change nothing to the content)???
      LOOP AT t_vbrp WHERE rfbsk NE 'C'.
    ...  " here I have skipped some lines
      ENDLOOP.
    " ^^^^^^^^^^^^^^^^^^^
      SORT t_vbrp.
    ENDIF. "KA01
    ENDFORM. " filter_invoice_data
    I have insert some remarks about your code : some lines seems strange! But for your question, what do you mean by batch splitting logic? Could you explicit? Thanks!
    Samuel

  • Fiscal year split logic

    Hi Guys Business requirement is have the fiscal year split logic
    1. Fiscal year 2007 (T009b) or ODD fiscal years and not calendar 2007
    2. Fiscal Yeat 2008 or Even Fiscal Year and Not Calendar 2008
    I want the simple abap logic that with generate a success message in process chain for Even year and Else return Odd to go other path in process chain
    Thanks
    Sincerely
    Soniya Kapoor

    Hi Sonia,
    U can get the fiscal year by using FM:
    FTI_FISCAL_YEAR_MONTH_GET or any other FM.
    Then , if the fiscal year is divisible by 2, it is a even year else, odd year.give messages accordingly.
    Hope it solves ur query.

  • F.19 GR/IR split - logic

    Hello!
    Is there someone who can help us to explain the system logic behind the split made if the open items on the GR/IR account in transaction F.19? We use the transaction monthly to split the open items between two other accounts. One account for items where goods receipt has been posted but invoice has not arrived yet and another account for items where the invoice has been posted but the goods receipt has not.
    Evaluating the result of the run I can see that in our case a summarization is made per profit center but that sometimes we will have more than one posting for the same profit center to the same account. Looking at the open items on the original GR/IR account we have tried to understand which logic the system uses to summarize the postings and decide to which account it should be posted but have so far failed in finding it. We thought for a while that it was profit center and document type but have seen that the logic is probably more sophisticated than that.
    Is there someone who has looked at this before and can help us with an explanation?
    Best regards,
    Marie-Louise

    Hello Marie
    Let me explain you use of F.19 and what logic system uses to split open items in GR-IR account.
    1. GR/IR Account is used in two scenarios as u have explained below.
       a. Goods received but invoiced not received fro vendor
       b. Invoice received but good not yet delivered by vendor.
    Typically at the month end there are scenarios for above mentioned a or b which cause GR/IR not to be zero. Hence it contains line items.  During month end / year end closing process you will have to transfer the values in this to B/S to reflect the correct values. 
    Scenario a. In this case you have book your Assets ( inventory /stock DR) but you have parked your liability (CR vendor ) to GR/IR account.
    Scenario b. In this case you have book your liability  (Cr Vendor)  but parked you asset ( dr stock /iventory) to GR/IR account.
    In customizing there are two additional account defined for GR/IR accounts.
    1. Adjustement Account - used in aceanrio a
    2. Target Account - used in scenario b
    T-code F.19 analyzes the Gr/IR clearing account and posts adjustment entries for outstanding amounts to respective accounts.
    Hope this helps. Please let me know if you need more information
    Thanks
    Sanjeev

  • Multi-Message-split with ABAP mapping and adapter specific attributes

    Hi all,
    With <b>ABAP-Mapping I split 1 message to n messages</b>.
    So many files are generated in <b>file-Adapter</b>.
    Everything fine.
    But now I want the file names different using adapter specific attributes.
    It is not possible to use variable substitution and write the file name in payload because of receiver restrictions.
    I tried this with following similar coding in ABAP-Mapping:
    data: lt_records TYPE MPP_DYNAMIC_TAB.
          Loop.
          l_file_name = "payload-Inbound"-information
          ls_record-namespace = 'http://sap.com/xi/XI/System/File'.
          ls_record-name = 'FileName'.
          ls_record-value = l_file_name.  "l_file_name comes from inbound-payload
          append ls_record to lt_records.
         Endloop.
      CALL METHOD dynamic_configuration->set_all_records
        EXPORTING
          records = lt_records.
    If I start the interface I see in the monitoring the dynamic configuration with many entries for file-name in the the SOAP-Header mapping of the request message (following extract):
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Mapping der Request-Message
      -->
    - <SAP:DynamicConfiguration xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">BPAADDRESS.XML</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">BPABROKERROLE.XML</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">BPACOMPANYSEGMENT.XML</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">BPACUSTOMERROLE.XML</SAP:Record>
    The result is that <b>all files have the same file name</b> (last entry in dynamic configuration).
    Is it possible to write the adapter specific configuration in ABAP-mapping <u>for every single result message</u>??
    Thank you for your help,
    Florian

    Hi Florian,
    I've a different idea...I dont think its a "right solution" but just another work around..it involves a BPM...
    In your ABAP mapping..set the dynamic config with as many variables as number of different messages...i.e. use the variables like 'FileName1', 'FileName2'...'FileName6' instead of 'FileName'. But use the same namespace 'http://sap.com/xi/XI/System/File'
    Call the above mapping in a BPM and capture the individual messages and set the attribute 'FileName' from the values of 'FileName1' to 'FileName6' accordingly using Message Mapping and then send the message using the 'Send' step.
    before you try this, try using the variable names 'FileName1' ...'FileName6' in the receiver adapters...enable the ASMS. <b>I know we need to select which variables from the dynamic config to be used by the adapter by specifically selecting 'FileName', 'Directory' etc...but just give it a try and see if it works..</b>
    Or..instead of using a BPM..you can combine Henrique's idea...use Adapter module to set the value for 'FileName' from variables 'FileName1'...'FileName6' accordingly.
    hope I'm clear..lemme know if you have any questions..
    cheers
    praveen

  • Need to split messages after mapping in the BPM.

    Hi,
    I have a req. to split MT to send to target as multicast...
    I need to do it after mapping...
    How to create interface determination and receiver determination.
    HOw to create reciver agreement ...?
    regards
    Akshay.

    Hi
    Receiver Determination (Only one)
    Enter the Sender Service, Interface and Namespace.
    Now add your first receiver system as the service in "Configured Receivers".
    Click on the '+' in "Configured Receivers".
    Add next receiver system.
    Repeat until all receivers are created.
    Interface Determination (Only one)
    Enter the Sender Service, Interface and Namespace.
    Enter '*' for Receiver Service.
    Select your inbound interface and your interface mapping.
    Receiver Agreement (One for each receiver)
    All receivers will need to have seperate communication channels.
    Create a receiver agreement for each receiver and select the communication channel for that system.
    Regards,
    Yaghya

  • Splitting using Java mapping

    Hi,
        I am working on a file to IDOC scenario.In the input file am getting data for multiple idocs.The file structure is such that in the sender communication channel am not able to identify the recordsets and hence cannot set the number of recordsets per message parameter,else would have generated multiple messages there itself.
       I want to implement java mapping.
       Can any one please tell me is splitting possible in java mapping, such that once the data for one idoc is over I will generate another idoc.
    Thnx,
    Pravesh Puria.

    Hi Puria,
    have a look to <a href="/people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible without BPM - Yes, it’s possible!</a>. Instead of the message mapping use your java mapping. You have to build your result XML like:
    <Messages xmlns:ns="myNamespace">
    <Message1>
    </MyFirstMessage>
    </Message1>
    <Message2> and so on
    Regards,
    Udo

  • Message Splitting in ABAP Mapping

    Hi Everybody,
    I have Implemented ABAP mapping in  my Scenario and have used message splitting. That is for each header node of source corresponding number of target nodes should be created.I have a source node under which i have 5 subnodes and when this source node repeats again i need to generate two target nodes with 5 subnodes in each of the target header node.
    I have tested the scenario in SXI_MAPPING_TEST by making the following changes in IR and ID.
    1. Changed the cardinality to 0 to unbounded in Interface mapping.
    2. Have kept the Interface determination type to Enchanced.
    I am getting the ERROR" split mapping created no messages" in sxi_mapping_test.
    Can anyone help me out on this.Good answers will be rewarded.
    Thanks all,
    Zabiulla

    Prabhu,
    what needs to rely on Java stack is the adapter, not the mapping.
    Mohammed,
    make sure you create Messages/MessageX tags (with proper namespace) in your multimapping. Also, expect these tags in your input mapping.
    You can get the exact Messages/Message1 tags (with the namespace) in a message mapping with multiple input or output messages. Create it and go to test tab, just to check the tags you should read/create in your abap mapping.
    Regards,
    Henrique.

  • Record splitting using XSLT mapping

    Hi,
    In my scenario i need to split n number of records into groups of 5.I learnt that this can be done through XSLT mapping also.So can  anyone please help me in getting this through XSLT.
    thanks in advance,
    Vikram

    Hi,
    You can simply use udf's for this.
    I have done such scenario.If you can give a brief overview of your input structure then i will be able to help.
    Regards
    Arpil

  • Message splitting using java mapping and BPM

    Hi all,
    I have a PLAIN FILE to IDOC Scenario.
    We decide to use javamapping instead of message mapping because we have several hierachical structures.
    We has more than one IDOC for file. And the mapping it's unable to detect the another header and create it at XI.
    I had seen:
    /people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change
    "XI: IDOC bundling - the "trick" with the occurance change"
    But the problem it's we doesn't use mapping programs, so we can't apply to this case.
    So now i need to create a BPM scenario for resolve this issue. Anyone knows any example for split the income message and send any idocs to destination?
    Thanks in advance,

    IT WORKED !!!!
    The only thing it's at out code line we must improve it in another way.
    For everyone who needs to resolve, i copy the code line of the java mapping program.
    The relationship is from the specific mapping for every scenary calling GenToHierMap.
    0.0.0.0.0.0.0.0.0.0.0.0.1. GENERIC PACKAGE (GenToHierMap)
    0.0.0.0.0.0.0.0.0.0.0.0.2.
    package com.sap.javaMapping;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import java.util.Vector;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Text;
    import com.sap.aii.mapping.api.StreamTransformation;
    public class GenToHierMap
         private Element root, idoc;
         private Element nodeArrayRef[];
         private String nodeArrayTagName[];
         private Relation  rel ;
         private int  stack_count ;
         private String nameSpace;
         private String separator="#!";
         protected String msgName;
         GenToHierMap(InputStream in, OutputStream out,Vector v1,String msgName1,String nameSpace1)
         msgName = msgName1;
         nameSpace = nameSpace1;
         rel = new Relation(v1);
         execute(in,out);
        public void execute(InputStream in, OutputStream out)
              Element e ;
              Relation cur_rel;
              DOMSource domS = null;
              Element keyNodeParent;
              //int numdocs;
              try
                           DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                           factory.setNamespaceAware(true);
                             TransformerFactory tf = TransformerFactory.newInstance();
                             Transformer transform = tf.newTransformer();
                             // Create DOM structure from input XML
                             DocumentBuilder builderel = factory.newDocumentBuilder();
                             Document docIn = builderel.parse(in);
                            NodeList rows = docIn.getElementsByTagName("ROW");
                            nodeArrayTagName = new String[rows.getLength() + 1];
                            nodeArrayRef = new Element[rows.getLength() + 1];
                             Document docOut = builderel.newDocument();
                             root = docOut.createElement(msgName);
                             docOut.appendChild(root);
                             //idoc = docOut.createElement("IDOC");
                             //root.appendChild(idoc);     
                            //Número de documents inicialitzat a 0
                            //numdocs=0;
                            //Per cada filera ROW
                       for (int count=0;count<rows.getLength();count++)
                                  String dataRecord = "";
                                  Node node = rows.item(count);
                                  node = node.getFirstChild();
                                  dataRecord = node.getNodeValue();
                                  String fieldValue [] = dataRecord.split(separator);
                                  //Cada cop que es troba una nova capçalera es crea un nou document.
                                  //Això permet que hi hagi més d'un IDOC per missatge processat.
                                  if (Integer.valueOf(fieldValue[0]).intValue()==1){
                                       //numdocs = numdocs + 1;
                                       //if (numdocs > 1){
                                            //Es dona sortida al document anterior abans de crear-ne un de nou - BE AWARE BECAUSE IN THE NEXT LINES WE DEFINE THE UNBOUNDED IDOC ATTRIBUTE, WITH BEGIN = 1 ****
                                            //transform.transform((domS),new StreamResult(out));
                                            //docOut = builderel.newDocument();
                                            //root = docOut.createElement(msgName);
                                            //docOut.appendChild(root);
                                            idoc = docOut.createElement("IDOC");
                                            idoc.setAttribute("BEGIN","1");
                                            root.appendChild(idoc);     
                                  cur_rel = (Relation) rel.v.get(Integer.valueOf(fieldValue[0]).intValue());                    
                                  String keyId = cur_rel.node;
                                  keyNodeParent = searchNode(keyId);
                                  nodeArrayTagName[count] = keyId;
                               e = docOut.createElement(keyId);
                                  e.setAttribute("SEGMENT",fieldValue[0]);
                               nodeArrayRef[count]= e;
                              keyNodeParent.appendChild(e);
                              createXmlTree(docOut,e,keyId,fieldValue);
                              domS = new DOMSource(docOut);
                              stack_count = stack_count + 1;
                         transform.transform((domS),new StreamResult(out));
           catch (Exception t)
                  t.printStackTrace();
    return;
    //returns the parent of the given node
    private Element searchNode(String keyId)
         Relation cur_rel;
         for (int i=0;i<rel.v.size();i++)
              cur_rel = (Relation) rel.v.get(i);
              if (cur_rel.node.equals(keyId))
                     for (int j=0;j<cur_rel.parents.length;j++)
                              if (cur_rel.parents[j].equals("NULL")) return root;
                              if (cur_rel.parents[j].equals("IDOC")) return idoc;
                               for (int k=(stack_count-1);k>=0;k--)
                                   for (int p=0;p<cur_rel.parents.length;p++)
                                       if (nodeArrayTagName[k].equals(cur_rel.parents[p]))
                                       return nodeArrayRef[k];
    return null;
    //Creates all the elements of the given node
    private void createXmlTree(Document docOut,Element node,String keyId, String fieldValue[])
          Element tagName;
          Text tagValue;
          Relation cur_rel;
          for (int i=0;i<rel.v.size();i++)
                     cur_rel = (Relation) rel.v.get(i);
                     if (cur_rel.node.equals(keyId))
                        for (int j=1;j<cur_rel.elements.length;j++)
                           tagName = docOut.createElement(cur_rel.elements[j]);
                           node.appendChild(tagName);
                           if ( j < fieldValue.length  && fieldValue[j].length() != 0 )
                           if ( fieldValue[j].substring(0,1).equals("""))
                           if ( fieldValue[j].length() > 2 )
                           fieldValue[j] = fieldValue[j].substring(1,( fieldValue[j].length() - 1 ));
                           else
                           fieldValue[j] = new String ();
                           if ( j >= fieldValue.length )
                           tagValue = docOut.createTextNode(new String());
                           else
                           tagValue = docOut.createTextNode(fieldValue[j]);
                           tagName.appendChild(tagValue);
                        return;
    //Main thread of execution
    0.0.0.0.0.0.0.0.0.0.0.0.1. SPECIFIC ONE
    0.0.0.0.0.0.0.0.0.0.0.0.2.
    package com.sap.javaMapping;
    * Mapping Program to Convert NOM IDOC Master Structure to the Generic structure Expected by
    * the FTP Receiver adapter
    import com.sap.aii.mapping.api.*;
    import java.io.*;
    import java.util.Map;
    import java.util.Vector;
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    //Specify the Hirearchial Structure
    public class INT938_mapping implements StreamTransformation
         public Vector v;
        private Map map;
        /** * method setParamters is required, but we do not anything with it */
         public void setParameter(Map param)
              map = param;
         } /** * method execute is called by the XI mapping program */
    public void buildXsd()
      Relation  mriRel ;
      v = new Vector();
      /* INICI MODIFICACIÓ ESTRUCTURA DE SORTIDA DEL MAPPING */
      // --> TOCAR AQUEST NODE IMPLICA MODIFICAR EL CÒDI!!!
      mriRel = new Relation();
      mriRel.parents = new String[1];
      mriRel.node =  "IDOC" ;
      mriRel.parents[0] =   "NULL" ;
      v.add(mriRel) ;
      /* ESTRUCTURA DEL IDOC DE SORTIDA */
      //NODE - 01
      mriRel = new Relation();                          
      mriRel.parents = new String[1];                                                    
      mriRel.elements = new String[22];                                                                 
      mriRel.node = "E1BPEBANC";                                    
      mriRel.parents[0]   =   "IDOC";                                              
      mriRel.elements[0]  =   "SEGMENT";   
      mriRel.elements[1]  =   "PREQ_ITEM"; 
      mriRel.elements[2]  =   "DOC_TYPE";  
      mriRel.elements[3]  =   "PUR_GROUP"; 
      mriRel.elements[4]  =   "CREATED_BY";
      mriRel.elements[5]  =   "PREQ_NAME"; 
      mriRel.elements[6]  =   "PREQ_DATE"; 
      mriRel.elements[7]  =   "SHORT_TEXT";
      mriRel.elements[8]  =   "MATERIAL";  
      mriRel.elements[9]  =   "PLANT";     
      mriRel.elements[10] =   "STORE_LOC";
      mriRel.elements[11] =   "TRACKINGNO";
      mriRel.elements[12] =   "MAT_GRP";   
      mriRel.elements[13] =   "QUANTITY";  
      mriRel.elements[14] =   "UNIT";      
      mriRel.elements[15] =   "DELIV_DATE";
      mriRel.elements[16] =   "ACCTASSCAT";
      mriRel.elements[17] =   "DES_VENDOR";
      mriRel.elements[18] =   "PURCH_ORG"; 
      mriRel.elements[19] =   "BATCH";     
      mriRel.elements[20] =   "VEND_MAT";  
      mriRel.elements[21] =   "CURRENCY";
      v.add(mriRel) ; 
      //NODE - 02
      mriRel = new Relation();                                   
      mriRel.parents = new String[1];                                                    
      mriRel.elements = new String[2];                                                                  
      mriRel.node = "Z1SOLCOM";                                    
      mriRel.parents[0]  =   "E1BPEBANC";                                                     
      mriRel.elements[0] =   "SEGMENT";  
      mriRel.elements[1] =   "ZPO_NUMBER";
      v.add(mriRel) ;
      //NODE - 03
      mriRel = new Relation();                                   
      mriRel.parents = new String[1];                                                    
      mriRel.elements = new String[3];                                                                 
      mriRel.node = "E1BPEBKN";                                    
      mriRel.parents[0]  =   "IDOC";                                                   
      mriRel.elements[0] =   "SEGMENT";
      mriRel.elements[1] =   "PREQ_ITEM";   
      mriRel.elements[2] =   "COST_CTR";
      v.add(mriRel) ;
      //NODE - 04
      mriRel = new Relation();                                   
      mriRel.parents = new String[1];                                                    
      mriRel.elements = new String[8];                                       
      mriRel.node = "Z1SOLRES";                                    
      mriRel.parents[0]  =   "E1BPEBKN";                                                   
      mriRel.elements[0] =   "SEGMENT";            
      mriRel.elements[1] =   "DADES_PACIENT";      
      mriRel.elements[2] =   "NOHIS";              
      mriRel.elements[3] =   "ZNINTER";            
      mriRel.elements[4] =   "ZFEIMP";             
      mriRel.elements[5] =   "NMPAC";              
      mriRel.elements[6] =   "ZNLOTE";             
      mriRel.elements[7] =   "ZNSERIE";            
      v.add(mriRel) ;
      /* FI    MODIFICACIÓ ESTRUCTURA DE SORTIDA DEL MAPPING */
    public void execute(InputStream in, OutputStream out) throws com.sap.aii.mapping.api.StreamTransformationException
         INT938_mapping rel = new INT938_mapping();
         rel.buildXsd();
         new GenToHierMap(in,out,rel.v,"ZPREEX01","http://namespace1/namespace");
    public static void main (String[] args) throws Exception
              try
                   INT938_mapping rel = new INT938_mapping();
                   FileInputStream in = new FileInputStream ("C:/DOM_IN.xml");
                   FileOutputStream out = new FileOutputStream ("C:/DOM_OUT.xml");
                   rel.buildXsd();
                   new GenToHierMap(in,out,rel.v,"ZPREEX01","http://namespace1/namespace");
              }catch(Exception e) {e.printStackTrace();}
    //Transformation of flat structure to hirearchial structure
    Any issue you can contact me. Best regards and reward points !

  • Split message - Multi mapping w/o BPM

    Did you check this thread same thing discusing here
    Quality of service in Receiver file/ftp adapter (SAP PI 7.1)?
    Rajesh

    Hi Sarvesh.
      I executed a refresh full, but the problem persists. I really think something is wrong in my scenario.
      At Design I created 1 Message Mapping (MM_File) with 1 source Message Type (MT_FROM) split to target 3 Message Types (MT_TO1, MT_TO2, MT_TO3).
      I created 1 Interface Mapping (IM_My_Main_File) with 1 source interface (MI_File_Out), 1 Message Mapping (MM_File) and 3 target interfaces (MI_File1_IN, MI_File2_IN, MI_File3_IN).
      At Configuration I created these objects:
    Interface Determination:
    Sender Service: BS_FROM
    Sender Interface: MI_File_Out
    Receiver Service: BS_TO
    Type of Interface Determination -> Enhanced
    Quality of Service: Maintain Order At Runtime is marked
    Interfaca Mapping: IM_My_Main_File
    Inbound Interfaces:
    MI_File1_IN
    MI_File2_IN
    MI_File3_IN
    Receiver Determination:
    Sender Service: BS_FROM
    Sender Interface: MI_File_Out
    Receiver Service: *
    Type of Receiver Determination -> Standard
    Configured Receivers -> Service BS_TO
    Configurarion Overview for Receiver Determination
    BS_TO
    MI_File1_IN IM_My_Main_File CC_File1_IN
    MI_File2_IN IM_My_Main_File CC_File2_IN
    MI_File3_IN IM_My_Main_File CC_File3_IN
    Thanks!

  • Issue with splitting 1:N mapping using Synchronous mode.

    Hi All,
    My Scenario is like below and i'm using BPM to handle this scenario
    SOAP request from sys-A --> SOAP sync call to Sys-B --> Send sync response from Sys-B  to Sys-C
    - I will be getting mutlple orders in single message from Sys-A.
    - I need to split this single message into multiple messages and pass as a sync request to Sys-B
    - The responses from sys-B should go to Sys-C.
    Issue:
    The scenario is working fine when I send the orders in Asynchronous mode to Sys-B by changing the occurence to 0..unbounded in message mapping and interface mapping.
    The same scenario is not working when I try to send the orders in Synchronous mode to Sys-B. When I tried to change the occurance in Interface mapping, the reponse tab is disappearing when I click "Read interfaces" in Interface mapping.
    If I don't mention 0..occurance in interface mapping then the interface mapping is not showing up in interface determination (when i click Enhannced radio button to select the interface mapping).
    Is there any limitation that split messages won't work in Synchronous mode?
    Do I need to use any function in BPM to handle this splitting message? I want do this in a simple way without complicating in BPM.
    Kindly suggest me.
    Thanks
    Deepthi

    Hi Bhupesh,
    I think you didn't get my scenario correctly. Here I explained with BPM steps.
    Start>Receive(Async)>Send(Sync)>Send(Async)>stop
    receive req from SysA >Send sync req to sysB>Map sync response to Idoc and send to SysC
    While sending Sync message to Sys-B, I will be mapping Abstract Sync message to Inbound Sync message.
    So in interface mapping, I will be assigned
    Abstract_SyncB <---> Inbound_SyncB
    request and response tabs will present.
    This scenario is working perfectly fine when i try to send single order sync message to SysB. But according to my requirement I need to Split the input message into multiple messages and send to sysB.
    To do this, I trying to change the occurances from 0..1 to 1..unbounded in both message mapping and interface mapping. by doing this, I can use the enhanced button in interface determination. So that the splitting the message will happen.
    When I change the occurance to 0..unbounded and save in interface mapping, the response tab is dissapearing.
    What might be the reason for this?  Is sync message can't handle splitting the messages?
    Thanks
    Deepthi.

Maybe you are looking for

  • K7N2 Delta-ILSR BSOD

    Hi MSI Nforce K7N2 Delta-ILSR Bios V1016 Antec True380SPGB True Power 380w AMD Athlon XP2800+ 2x512mb Crucial DDR 1xSATA HDD Abit Siluro GF4 Ti4200 I've installed 1 SATA onto the onboard Raid controller, but I keep getting BSOD when either playing a

  • Data slicing and dicing

    Hi, What is the difference between data slicing and data dicing?

  • Can I add a WinServer 2012 into a mix child Domain with 2008 and 2003?

    The founctionall level is 2003 and the main domain is mix with 2008 and 2003. The user need the templete of Server 2012 and use the "new" group policy so that they are able to use the "new" feature in windows 8 (which I totally do Not think is much u

  • HT5557 iBook Author does not open file

    A client submit by email a file with extension *.book. I know is an iBook Author file but I don't understand why I cannot open it. Any help will be appreciate it. Best regards,

  • Any experience with NFS failover in Sun Cluster?

    Hello, I am planning to install dual-node Sun Cluster for NFS failover configuration. The SAN storage is shared between nodes via Fibre Channel. The NFS shares will be manually assigned to nodes and should fail over / takeback between nodes. Is this