Skip to Content
avatar image
Former Member

IDOC-XML to IDOC FILE

Hi,

My scenario is IDOC to XI to IDOC FILE. I read through the HOW TO CONVERT IDOC-XML to IDOC FILE. They execute ABAP mapping to do this but they haven't specified the target structure. The source would obviously the idoc metadata but what would be the target structure. Here we are trying to generate a flat IDOC file ( not XML ) so my question here again is what should be the target structure in INTERFACE MAPPING?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Aug 23, 2006 at 02:45 AM

    Hi Shubha,

    Create a inbound message interface which is of the same type IDOC. While configuration use file adapter as receiver. Now you will have IDOC as file then you can use content conversion to convert into flat structure.

    My suggestion is get the requirements clearly that what all fields/data you wanted as output and based on the design a data type for the target. You can creat the target data type in such a way that you can easily do a content conversion coz doing a content conversion for a IDOC strucutre is not that easy as it has lots of segemnts and it has deep structures.

    Thanks,

    Prakash

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 23, 2006 at 04:00 AM

    Hi ,

    Check this weblog...

    /people/prateek.shah/blog/2005/06/08/introduction-to-idoc-xi-file-scenario-and-complete-walk-through-for-starters

    sekhar

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 23, 2006 at 04:08 AM

    Hi Shubha,

    I thought i will just share a few basic thoughts that you need to take care while doing an IDOC to File Scenario. Just see if it helps you in anyways.

    While doing an IDOC -> XI -> File scenario, The Points to noted are:

    1. You don’t need a DT, MT or a message interface for the IDOC as it itself acts as the Message Interface.

    2. You import the IDOC and use the same in your mapping.

    3. In this configuration note that you don’t have a sender agreement as you don’t have a sender IDOC adapter.

    If it is that you wanted to send an IDOC from XI (File to IDOC) , then in this case:

    points 1 and 2 will remain, but the 3 will not. You will need a sender agreement for the file and a receiver agreement for the IDOC.

    IDOC -> File scenario ref:

    <a href="/people/prateek.shah/blog/2005/06/08/introduction-to-idoc-xi-file-scenario-and-complete-walk-through-for-starters scenario</a>

    File -> IDOC ref:

    <a href="/people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping to IDOC</a>

    To be able to trigger your IDOC from the SAP ISU system, you will have to set the partner profile in we20. Select your Business System (mostly under Logical system) and then create Outbound entries for whichever IDOC you want to trigger.

    You define your basic type also in your partner profile settings, Please go thru the following links to get a better idea about partner profile:

    http://help.sap.com/saphelp_nw04/helpdata/en/dc/6b833243d711d1893e0000e8323c4f/frameset.htm

    http://help.sap.com/saphelp_nw04/helpdata/en/dc/6b7cd343d711d1893e0000e8323c4f/frameset.htm

    http://help.sap.com/saphelp_nw04/helpdata/en/32/692037b1f10709e10000009b38f839/content.htm

    http://help.sap.com/saphelp_nw04/helpdata/en/5e/b8f8bf356dc84096e4fedc2cd71426/frameset.htm

    Also, I would suggest that you go through this blog by michal if any issue arises,

    /people/michal.krawczyk2/blog/2005/03/29/xi-error--unable-to-convert-the-sender-service-to-an-ale-logical-system

    /people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions

    I hope this answers your query.

    Regards,

    Abhy

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Subha,

      First approach

      Try using a flat strucutre as a target and make sure the occurance is 0..1.

      Structure like this

      MT_Output

      FlatStruct xsd:string 0..1

      Execute it, if you face some problem then go for the following logic

      -


      Second Approach

      Add this code before the <b>endmethod</b> statement

      * create output document
      data: odocument type ref to if_ixml_document.
      odocument = ixmlfactory->create_document( ).
      
      * create element 'MessageType & FlatStruct' and add it to the document
      data: msgtype type ref to if_ixml_element.
      msgtype = odocument->create_simple_element(name = 'MT_Output' parent = odocument ).
      
      * create element 'FlatStruct' and add it to the output document
      data: elementflat type ref to if_ixml_element.
      elementflat = odocument->create_simple_element(name = 'FlatStruct' value = result parent = msgtype ).
      
      * create output stream
      data: ostream type ref to if_ixml_ostream.
      ostream = streamfactory->create_ostream_xstring( result ).
      
      * create renderer
      data: renderer type ref to if_ixml_renderer.
      data irc type i.
      
      renderer = ixmlfactory->create_renderer( ostream = ostream document = odocument ).
      irc = renderer->render( ).
      

      You will get an output like this

      <?xml version="1.0" ?>

      <MT_Output>

      <FlatStruct>...idoc content...</FlatStruct>

      </MT_Output>

      The you can use content conversion in the receiver to save the file as .txt file. (The content conversion will remove the tags <MT_Ouput> and <FlatStruct> you will have only the idoc content)

      Try it and let me know

      Thanks,

      Prakash