ABAP MAPPING - 1 read file leads to 2 files after split

Hi there,
please help me finding a solution for the following task:
Currently there is an ABAP mapping (consisting of an ABAP class that implements the interface IF_MAPPING including a method EXECUTE) that is getting the complete payload by the parameter SOURCE, modifying it and rewriting it by the parameter RESULT. No big deal so far. The input structure may look as follows...
<?xml version="1.0" encoding="utf-8"?>
<RecordSet>
     <Header>
          <header00>HDR</header00>
     </Header>
     <Row>
          <field00>1</field00>
     </Row>
     <Row>
          <field00>1</field00>
     </Row>
          <Row>
          <field00>5</field00>
     </Row>
</RecordSet>
After modification in ABAP mapping the whole payload can be written and sent within one file when all <field00> have the same value. BUT when there is at least one different <field00> (as shown in my example) I want to get two different files on my ftp server that look as follows...
file 1:
<?xml version="1.0" encoding="utf-8"?>
<RecordSet>
     <Header>
          <header00>HDR</header00>
     </Header>
     <Row>
          <field00>1</field00>
     </Row>
     <Row>
          <field00>1</field00>
     </Row>
</RecordSet>
file 2:
<?xml version="1.0" encoding="utf-8"?>
<RecordSet>
     <Header>
          <header00>HDR</header00>
     </Header>
     <Row>
          <field00>5</field00>
     </Row>
</RecordSet>
How can I achieve this since I only can rewrite the whole content in just 1 parameter RESULT? How does XI afterwards recognize that there are two messages for two different files?
Thans a lot and best regards,
Ralph

Hi Gopal,
Ur approach to the interface is perfect.... Go ahead.
For selecting multiple files in source use Advanced Selection for files.. and specify the directory paths and also the file name shema...
This will fetch the 2 files into the integration engine... then u map the 2 source files to one target file(2:1 mapping).
Specify accordingly the receiver side FCC and test it end to end...
If u face any prblm post here... some1 will help u out..
Babu

Similar Messages

  • IDOC-XI-FILE Scenario: Error in ABAP Mapping

    Dear All,
    I am working on IDOC-XI-Flat FIle scenario in which I am using ABAP Mapping as per document "How To Convert an IDoc-XML
    structure to a flat file and vice versa in XI 3.0".
    I created one customized Idoc for this. The Idoc is reacing XI but its flat file is not getting created. Its giving me following error:
    <SAP:Stack>Error in mapping program Z_ABAP_MAPPING_PACKING_LIST (type SAP-ABAP, kernel error ID UNCAUGHT_EXCEPTION) An exception with the type CX_SY_REF_IS_INITIAL occurred, but was neither handled locally, nor declared in a RAISING clause Dereferencing of the NULL reference.</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
    I have also gone thru threads posted for the same topic earlier but still I am not been to resolve this error.
    Please help me out in resolving this error.
    Regards,
    N.Jain

    HI,
       Log saying that, u have problem in the mapping program.
      i.e Z_ABAP_MAPPING_PACKING_LIST
       the problem is due declaration of data.
       i hope that, you have some methods.
       those are declared under intialization section in mapping program.
      please use start of selection before the method.
    other wise, it will come under intilization section.
    warm regards
    mahesh.

  • Reading attachment in SOAP message with ABAP mapping

    I am searching an ABAP code to read attachment in sender SOAP message..
    I am using PI 7.3, I can read by java mapping but I get another error after reading the attachment.. So I try to abap mapping..
    That's it..
    Thanx ..

    Hello Mark,
    1. My Soap Sender Adapter, I checked the Keep Attachment option
    2. I am getting the WSDL file from the SOAP Sender Agreement.. it is like http(s)://host:port/XISOAPAdapter/MessageServlet?channel=p:s:c? as you said.
    I used the user-defined function, it works when <inc:Include href="cid:test.jpg" xmlns:inc="http://www.w3.org/2004/08/xop/include" /> is deleted in the message.
    If the coming message includes <inc:Include href="cid:test.jpg" xmlns:inc="http://www.w3.org/2004/08/xop/include" />,
    the <null> error occurs.
    Thanx for your reply..

  • Proxy - ABAP mapping - file with content conversion

    Scenario goes from ECC (proxy) to XI then I do ABAP mapping.  I have tested the ABAP mapping with SXI_mapping_test transaction.  My ABAP mapping puts the payload back into XML and then the data goes to a file adapter where I also use content conversion.  If I do not do the content conversion the data comes out correct in XML.  When I change to content conversion I get 20 blank lines.  Is it possible to do content conversion from ABAP mapping?
    Any help would be greatly appreciated.
    Thanks
    Skip Ford

    Hi,
    Have you checked whether the blank lines you got in the XML files are from the blank nodes or elements which you created in ABAP mapping?
    If it is, then just create your elements or nodes whenever there are corresponding values in your ABAP mapping.
    e.g.
    If  l_sender_service is NOT initial.
      elementsender = odocument->create_simple_element(
                                   name = 'SenderService'
                                   value = l_sender_service
                                   parent = msgtype ).
    endif.
    Regards,
    Lim...

  • How to convert xml file into internal table in ABAP Mapping.

    Hi All,
    I am trying with ABAP mapping. I have one scenario in which I'm using below xml file as a sender from my FTP server.
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:MTO_ABAP_MAPPING xmlns:ns0="http://Capgemini/Mumbai/sarsingh">
      <BookingCode>2KY34R</BookingCode>
    - <Passenger>
      <Name>SARVESH</Name>
      <Address>THANE</Address>
      </Passenger>
    - <Passenger>
      <Name>RAJESH</Name>
      <Address>POWAI</Address>
      </Passenger>
    - <Passenger>
      <Name>CARRON</Name>
      <Address>JUHU</Address>
      </Passenger>
    - <Flight>
      <Date>03/03/07</Date>
      <AirlineID>UA</AirlineID>
      <FlightNumber>125</FlightNumber>
      <From>LAS</From>
      <To>SFO</To>
      </Flight>
      </ns0:MTO_ABAP_MAPPING>
    AT the receiver side I wnat to concatenate the NAME & ADDRESS.
    I tried Robert Eijpe's weblog (/people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach)
    but couldnt succeed to convert the xml file into internal table perfectly.
    Can anybody help on this. 
    Thanks in advance!!
    Sarvesh

    Hi Sarvesh,
    The pdf has details of ABAP mapping. The example given almost matches the xml file you want to be converted.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how to use abap-mapping in xi 3.0.pdf
    Just in case you have not seen this
    regards
    Vijaya

  • Abap mapping and variable substitution in File adapter

    Hi experts!!.
    I am new in abap mapping, but I can do one abap mapping succesfully, but my problem is:
    I need to do a variable substitution in my file receiver adapter:
    Target directory = %cliente&/out
    File Name Scheme = TC%Fecha%.EFI
    ¿Using abap mapping is this possible? How I can do it?.
    Please is very urgent.
    Thanks in advance, and best regarts.

    Yes you can,.
    DynamicConfigurationKey key = DynamicConfigurationKey.create(
        “http://sap.com/xi/XI/System/File”,
        “FileName”);
    will become
    DynamicConfigurationKey key = DynamicConfigurationKey.create(
        “http://sap.com/xi/XI/System/File”,
        “Directory”);
    In the receive file adapter all you would need to do is select Adapter Specifc Attributes --> File Name and Directory and givce some dummy values for the filename and directroy. In the runtime values will be taken from the SOAP header which you set in the mapping.
    Regards
    Bhavesh

  • File to IDoc : XML parsing in ABAP mapping

    Hi,
    In ABAP mapping I want to parse all of the incoming XML strings to internal table.Later I add few more fields to this table and transfer them to IDOC adapter in IDOC-XML format.In thsi case how do i get all of the input file data(converted from XML) into internal table using XML parsing in ABAP Mapping?
    Thansk in advance,
    RP

    Hi Amil,
    I insert into table but not immediately,I want all the parsed xml data into internal table and do something before I insert into DB /send it to IDOC.
    I knwo how to get single Xml parsing,but how to get multple records(looping xml parse) to internal table?
    Thanks,
    RP
    Edited by: RP@261 on Jun 3, 2009 2:14 PM

  • ABAP Mapping :: for multi files

    Dear Experts,
    We are doing an Idoc to file interface, using ABAP mapping.
    This is 1:n mapping i.e receiver message interface is 0..unbounded.
    We have achieved the mapping for 1:1. But when I test for multi, i get an error in moni saying
    Parsing error after multi mapping.Expected Message<i> instead of Item
    Item is the name of the node that has to be created multiple times.
    Has anyone done multi mapping in ABAP?? Any idea why this error....may be we are missing something.
    Any idea as to how we can progress???
    Thanks in advance
    Regards
    Shobha

    Hi,
    Surely u can use an ABAP mapping for this.
    Sounds like your problem is your not using correct output structure for multi mapping.
    As with any type of multi mapping your structure should reflect this. Your target payload must thus have the following structure:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
         <ns0:Message1>
              <unboundedPayload/>
         </ns0:Message1>
    </ns0:Messages>
    The <unboundedPayload> element in above should of course be replaced with your actual payload - I believe 'Item' in your case, if that is in fact the root node of your actual payload.
    Regards,
    Daniel

  • Checking Well-Formed XML files with ABAP Mapping

    Hi guys,
    Anybody knows which is the best way to check (well-formed) incoming XML files trough XI?
    I’m using ABAP Mapping and before I check the value of the XML fields I want to check if the XML is well-formed. For this reason I need to know which is the class or classes that I need to use to checking the format of XML using an XSD file?
    That is also possible using a DTD file instead of XSD?
    Which is better XSD or DTD?
    Thanks in advance,
    Ricardo.

    Hi Ricardo,
      try out these links.
    /people/r.eijpe/blog/2005/11/04/using-abap-xslt-extensions-for-xi-mapping
    /people/ravikumar.allampallam/blog/2005/02/10/different-types-of-mapping-in-xi
    /people/sap.user72/blog/2003/09/18/xsl-and-abap
    Thanks and Regards
    Vishal Kumar

  • Setting File Name inside ABAP mapping

    Hello All,
    We have a requirement where we need to send the IDOC in a flat file format to the destination system which we are doing inside an ABAP mapping. Now we need to set the file name depending on a particular field in the IDOC. For this we need to use the DynamicConfigurationKey class inside our ABAP mapping.
    Can anyone throw some light how to access these Adapter-Specific Attributes inside ABAP mapping?
    Thanks
    Abinash

    guess this is the one
    Re: Abap mapping and variable substitution in File adapter

  • IDoc to Flat file scenario - abap mapping

    Hi All,
    I have to do some IDOC to Flat file scenarios. In Order to generate the file in required format I will have to add all segments(Nodes) of Idoc in FCC receiver. We also have other option of doing it through ABAP Mapping which I found in one blog.
    Now my question is : Is it better way of doing it through FCC or ABAP Mapping?
    Ofcourse from development point of view ABAP Mapping looks easier as FCC is very time consuming task.
    Is there and performance issues in either of the approach?
    Thanks and Regards,
    Atul

    Hi VJ and Harald,
    Thanks for your replies.
    I am not having PI7.1 however the given blog was very informative.
    I will try using file port approach as suggested.
    Thanks and Regards,
    Atul

  • Webservice  to Idoc/File using ABAP mapping

    Hi Experts,
    I need your expert advise on below scenario.The flow of the scenario is..
    1)I will get a control record from a webservice(SOAP sender adpater), this initiates the process flow.
    2)based on control record ,The ABAP mapping program will call a program(within the PI sys) to fetch the data from DB table.then the ABAP mapping program will have to create 2 messages for the target. One is IDoc and another one is File.
    Pls suggest the best approach.
    Regards,
    Srini

    Hi Prateek,
    Thanks for quick reply.
    there is a main program which has different classes and methoda to fetch the data from DB tables.I dont want to touch this main program.
    what  i am going to do is, I will this main program from abap mapping by passing the control record information.based on this control record,the main program will fetch data for ABAP mapping.From ABAP mapping, i have to generate 2 messages,one for IDOc and another one is for File.
    Hope you got my requirement.
    Regards,
    Srini

  • ABAP mapping - File to Idoc

    Hi All,
    I want help on ABAP mapping to perform File to Idoc posting.
    Kindly provide any sample code / document for this.?
    Thanks.
    Ramiz.

    Hi
    Please do a search before posting.
    This link will provide you all about abap mapping.
    https://www.sdn.sap.com/irj/scn/advancedsearch?query=abap+mapping&cat=sdn_all
    Thanks
    Saiyog

  • Abap Mapping - Specify file name

    Hi there
    Is it possible to specify the flat file's filename in the abap mapping? I need to create several flat files with abap mapping and each file uses the same receiver adapter but have a different name..
    Thanx,
    Jan

    Hi Jan,
    >The variable mechanism only seems to work if you specify the filename before you execute the abap mapping
    aeh, no
    >Or in the abap mapping itself set the filename
    yes
    You need a XML element like <filename> in your target message, there you store the filename (by ABAP mapping).
    At adapter side you define the filename with %myVariable%
    And finally you need to fill the variable, choose payload: myRootElement,1,filename,1 for example, if this is your structure. Have a look to Variable substituion at SAP help [Configuring the Receiver File/FTP Adapter|http://help.sap.com/saphelp_nw2004s/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm]
    Regards,
    Udo

  • Acces dynamic configuration variable (e.g. filename) in ABAP mapping class

    Hi experts
    I am searching for a possibility to acces a dynamic configuration variable (DCV) in an ABAP mapping class. Since I could not find a solution in SDN and other sources, I hope somebody in this forum can help me.
    What I already found is the following code which can be used to set a DCV, but what I would be interested in is how to read a DCV.
    Any help is appreciated.
    Markus
    METHOD if_mapping~execute.
    DATA l_record type mpp_dynamic.
    * copy payload
    result = source.
    * add an adapter specific attribute
    l_record-namespace = 'http://sap.com/xi/XI/System/File'.
    l_record-name = 'FileName'.
    l_record-value = 'test.xml'.
    dynamic_configuration->add_record( l_record ).
    ENDMETHOD.

    Hi Markus,
    you can find everything in my blogs
    /people/michal.krawczyk2/blog/2007/04/26/xipi-throwing-generic-exceptions-from-any-type-of-mapping
    Regards,
    michal

Maybe you are looking for