IDoc as a flat file...

I want to read a flat file that is an IDoc and post it as a XML after necessary conversion...So i wanted to know what are the feasible ways to read the flat file thats an IDoc?

Your flat file is of fixed lenght format or tab delimited I believe. Get the flat file data into an internal table. Study the IDOC structure in transaction WE30. & according populate the idoc segemnts from the internal table value..
For ABAP to XML conversion..Create XSLT & the extraction program..
Create XSLT:
In transaction SE80 browse menu Workbench -> Edit Object. In the popup window enter XSLT Program name (e.g. ZXSLT) and click on create button.
Enter the following code into the editor..
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<!xsl:output encoding="utf-8" indent="yes"/>
<xsl:template match="D2CXML">
<PurchaseOrders>
<xsl:apply-templates/>
</PurchaseOrders>
</xsl:template>
<xsl:template match="item">
<PONO>
<xsl:attribute name="no">
<xsl:value-of select="EBELN"/>
</xsl:attribute>
<PORDNO>
<xsl:apply-templates select="EBELN"/>
</PORDNO>
<Vendor>
<xsl:apply-templates select="LIFNR"/>
</Vendor>
<PurchaseOrg>
<xsl:apply-templates select="EKORG"/>
</PurchaseOrg>
<PurchaseGrp>
<xsl:apply-templates select="EKGRP"/>
</PurchaseGrp>
<xsl:apply-templates select="X-MLSTRUCT"/>
</PONO>
</xsl:template>
<xsl:template match="X-MLSTRUCT">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="X-MLSTRUCT/item">
<Product>
<ItemNo>
<xsl:apply-templates select="EBELP"/>
</ItemNo>
<Material>
<xsl:apply-templates select="MATNR"/>

Similar Messages

  • TCODE TO DOWNLOAD IDOC INTO A FLAT FILE

    Hi All,
       Please let me know if there is any tcode to download IDOC into a flat file..
    Regards,
    Kaveri

    try with we60 where you should have links to download the idoc type.
    Please check this:
    1. How to Download a Hierarchy to a Flat File
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0403a990-0201-0010-38b3-e1fc442848cb
    2. How To Convert an IDoc-XML structure to a flat file and vice versa in XI 3.0 Version 1.10
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a
    run the report RSEOUT00 with the idoc number, flat xml file will be generated at the location user/sap/XI/SYS/global/idoc_file
    Please rewrds if found help ful

  • Idoc data in flat file structure

    Dear Experts,
             We have  idoc data in flat file structure. We need to fetch it using ftp and map it to an idoc.
    please tell me how to proceed .
    Thanks,
    Aju

    Hi,
    For flat file you need to use the File content conversion parameters.
    Refer the blog,
    SAP Network Blog: How to process flat files with multiple documents like POs, SOs etc. in a File to IDoc scenario
    How to process flat files with multiple documents like POs, SOs etc. in a File to IDoc scenario
    Thanks
    Swarup

  • Facing Problem in IDOC to EDI FLAT File Scenario

    Hi,
    I am working on a scenario IDOC to EDI FLAT File. For this I have used ABAP mapping.
    The problem i am facing is that the EDI FILE contains the segment name as E1EDK01 for eg. while I need the name as per the latest segment definiton released. I have also tried this using File port and it gives the required segment names in file.  But we dont have to use File ports. Please suggest me if something is missing in PI Abap stack ?? Why I am not getting the segments name as per latest segment definition mainatined in R3.
    Thanks
    Neha

    Hi Neha,
                   Please check the segment name in sxmb_moni. Is this showing new value or the old value?
    If SXMB_MONI shows old value then the source SAP (R/3) system which is sending the idoc may not have released the segment after changing the name. You need to ensure that the idoc segment has been released properly. Then re-import the iodc into PI server again. Finally delete entry of the iodc structure in idx2 transaction, no need to re-import the idoc structute again in idx2, since once you run the scenario the metadata automatically gets imported.
    regards
    Anupam

  • What are the advantages of idoc compare to flat file. how data is secure

    what are the advantages of idoc compare to flat file. how data is secure in idocs compare to flat file

    Hi Ramana,
    In simple words, Main advantage with idoc over flat file is security....
    I will explain you some scenario here U got a flat file with all the data...Now u r having the flat file if you want u can modify the data in it, or somehow any one can modify the data in it  if they were able to access this file. That means u maintained the file in the presentation server
    One level of higher security to the above level is maintaining the flat file in application server, at point also even though lot of people r not having the access to that file, super user who is  having  the access may modify the data or delete the data from it rite....
    so in both of those levels u don't have 100% security...
    So there come to the picture of idocs, Idocs simply data carriers, those r generated by a program but not manually...data will be divided into number of segments based upon ur program. So manually its not so easy to modify the data in these idocs. If any changes to be made in the data then u have to modify the data in the application and then u have to update the idoc or you have to generate the new idoc with that corresponding data. so in this case not even super user can manipulate the data directly in the idoc....
    I think u got my point what I mean to say.....
    If you find it useful mark the points
    ~~Guduri

  • Creation of Inbound IDOC from a flat file.

    Hi all,
    I hav to create Purchse Order using inbound IDOC in which I hav to take data from a .xls or any flat file.
    Can any one help me with this. i.e wat r the steps involed to do so.
    Regards.
    Rahul

    Hello,
    Why do u want to create a Idoc for creating PO from flat file - you can simply use BAPI. Ok if you want to create PO only using Idoc.
    I think message type is ACC_PURCHASE_ORDER0.
    I just made one sample program to you how to create a PO with Idoc method. Here i am doing for Material Master Creation. Let me know if want any clarification.
    ********Poorna********
    TABLES : MARA, MAKT, EDP13.
    DATA : I_EDIDC LIKE EDIDC OCCURS 0 WITH HEADER LINE,
          I_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE.
    PARAMETERS : P_MATNR LIKE MARA-MATNR.
    START-OF-SELECTION.
      REFRESH I_EDIDC.
      SELECT * FROM EDP13 WHERE MESTYP = 'ZMATMASTER'.
        MOVE-CORRESPONDING EDP13 TO I_EDIDC.
        I_EDIDC-IDOCTP = EDP13-IDOCTYP.
        APPEND I_EDIDC.
      ENDSELECT.
      READ TABLE I_EDIDC INDEX 1.
      I_EDIDD-SEGNAM = 'ZMATMASTER'.
      SELECT SINGLE * FROM MARA WHERE MATNR = P_MATNR.
      SELECT SINGLE * FROM MAKT WHERE MATNR = P_MATNR
                                  AND SPRAS = SY-LANGU.
      I_EDIDD-SDATA+0(18) = MARA-MATNR.
      I_EDIDD-SDATA+18(40) = MAKT-MAKTX.
      I_EDIDD-SDATA+58(4)  = MARA-MTART.
      I_EDIDD-SDATA+62(1)  = MARA-MBRSH.
      I_EDIDD-SDATA+63(3)  = MARA-MEINS.
      APPEND I_EDIDD.
      CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
        EXPORTING
          master_idoc_control                  = I_EDIDC
       OBJ_TYPE                            = ''
       CHNUM                                = ''
        tables
          communication_idoc_control          = I_EDIDC
          master_idoc_data                    = I_EDIDD
    EXCEPTIONS
       ERROR_IN_IDOC_CONTROL                = 1
       ERROR_WRITING_IDOC_STATUS            = 2
       ERROR_IN_IDOC_DATA                  = 3
       SENDING_LOGICAL_SYSTEM_UNKNOWN      = 4
       OTHERS                              = 5
      COMMIT WORK.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

  • IDOC creation from flat file.

    Hello Friends.
    I need to create a custom program for posting goods receipts for a purchase order. 
    I think  a custom program needed to achieve this task because i need to do mappings prior to create an IDOC. Now using a flat file what are the function modules or steps involved. can any one of you able to help me on this.
    Thanks

    Sorry, I'm trying to remember the name of the function module I used....I had a similar situation...I had a flat file which I processed and constructed an IDOC which I then saved as an incoming IDOC using the FM....  Because we had our settings (standard SAP process code, standard SAP FM IDOC processor, etc.) set to automatically fire off the IDOC processing, the result was that I read the file, saved the IDOC and SAP then immediately grabbed and posted the IDOC.  I will do a little search for the FM I used to create the IDOC in my own system and get back to you if you think that would be helpful.  Sorry for my memory lapse....

  • Idoc data to flat file

    Dear All,
      How to convert the data from idoc to flat file.
    Plz send some sample program and FM.
    Thanks & Regards,
    Arun.

    Hi
    The same issue has been discussed in the below thread
    IDOC to flat file
    Regards
    Pavan

  • Proxy to File scenario - IDOC as an flat file

    Hi,
    I am working on ABAP Sender Proxy to File scenario. The target structure in the message mapping is SHPMNT05 IDOC and the output of the file needs to be in the text format and then the file will be send to an EDI subsystem.
    Currently, EDI subsystem gets the IDOC from ERP system as a flat file and expects the similar kind of file from XI system
    The requirement is to have all the fields of the IDOC in the target file. If data does not exist for a particular field, then there should be a space for that field in the text file.
    I would like to know if there is any other standard way of executing this scenario apart from using File Content conversion. In case if we have to use FCC, how difficult it would to be implementing the scenario. Please note that the output file needs  all the fields of IDOC in it.
    Regards,
    Sakthi
    Edited by: Sakthi on Sep 26, 2008 11:24 AM

    Hello Sakthi,
             By coding in proxy populate the idoc structure if it is difficult to handle thru Content conversion parameters then create an intermediate structure and populate that structure by concatenating the fields from idoc segments. If the fields are not having the values then add blank spaces as per length of the field.
    You can configure the file channel and content converison parameters for the intermediate structure.
    Hope it will helps to you.
    Cheers
    Veera

  • Multiple idocs from single flat file

    Hi All
    I want to send data from a flat file to SAP(file to idoc)
    My flat file structure is
    id,name,number,city
    2,R1,234,SD
    2,R2,457,MD
    3,R4,789,HG
    3,R6,235.HG
    The Field 'id' will change..after  every change in 'id' ,seperate idoc should be created.
    I have checked the following thread.
    Re: Content conversion for seperate idoc
    In the above thread ,it is asked to map v.no with remove context and use SPLIT BY VALUE on value change then do the mapping accordingly ,you can create 3 idocs for the same.
    I'm confused about how to do these mappings.
    Please explain the mapping in detail.
    Please help
    Regards
    Reema

    if  your source data type is like
    MT_Source
        Record           0-unbounded
           id                    ----1
           name              -----1
           number           -----1
           city               -------1
    then in the sender file communication channel you have to specify  file content conversion parameters as
    Parameter name               parametervalue
    Document Name                 MT_Source
    Recordset Structure           Record,*
    choose + to add more parameters
    Name                                  Value
    Record.fieldSeparator                      ,
    Record.fieldNames                        id,name,number,city
    Record.endSeparator                      'nl'
    then do the maping
    as
    id ---->removeContext---->SplitByValue(Value change)---->Target Idoc
    map according to your requirement for other fields

  • IDOC to email (flat file attachment) scenarion

    Hello everybody,
    I'm working with XI 3.0
    I have a scenario IDOC - XI - flat file, but the file need be sent by email and not by FTP.
    Using normal configuration of email communication Channel , i notify is not possible sent a flat file, but only XML.
    So i decided to devide interface in 2 step.
    1- IDOC - XI - FTP for create the file
    2- FTP - XI - EMAIL for send file to destination as a email attachment.
    this is a correct approach?
    IT's possible take a file from a FTP server and send by email as an attachment (without any mapping)?
    There is an document example?
    thanks in advance
    Alex

    Hi,
    its possible in one scenario as well,
    one of following example will help you have attachments.
    http://www.riyaz.net/sap/xipi-sending-emails-using-xi-mail-adapter/83/
    http://wiki.sdn.sap.com/wiki/display/XI/DynamicEmailAttachmentnameforReceivedMails
    Besides these you also need to use module adapter.
    use MessageTransformBean for content conversion.
    use link - http://help.sap.com/saphelp_nw04/helpdata/en/24/4cad3baabd4737bab64d0201bc0c6c/frameset.htm
    Also it is possible that you may have to use another module as payloadswapbean.
    But first 2 suggestion will work.

  • SAP IDOC XML to Flat File Conversion

    Hello,
    I have downloaded SAP schema through the "Consume Adapter Service" with properties GenerateFlatFileCompatibleIdocSchema = "true" and FlatFileSegmentIndicator = "SegmentType". I am trying to convert IDOC XML into a IDOC Flat File.
    Though the flat file gets created it has a "/" at the end of each blank field which I do not want in the flat file. I see the schema has <recordInfo structure="delimited"...> which I believe should be "positional". I tried
    changing preserve_delimiter_for_empty_data="True" and suppress_trailing_delimiters="False" properties also but did not help.
    I would appreciate any help on this.
    Thanks,
    Tarun

    Hi Tarun....
    please check this property set this property GenerateFlatFileCompatibleIDoc is set to false

  • Idoc Structure From Flat FIle

    Hi,
    I have two queries.
    1.I need to import idoc structure from excel file not from sap, is it possible ?
    2 what are the detalied steps to implement following SAP note for getting processed file name at runtime.
    Thanks & Regards
    Tuhin
    Symptom
    You want to access the name of a file sent through a File Adapter Sender channel from a custom developed XI module.
    Other terms
    XI 3.0, XI30, File Adapter, Module Processor, Module Development, Modules
    Reason and Prerequisites
    The functionality described in this note requires SP 9 or higher of the component XI ADAPTER FRAMEWORK CORE 3.0.
    Solution
    The File Adapter passes the name of the processed file to the module processor. This information is available in a Hashtable object accessible as as supplemental module data under the name "module.parameters" within the module's 'process' method.
    For further information, please take a look at the example code below:
    public ModuleData process(ModuleContext mc, ModuleData md) throws
      ModuleException
      Hashtable mp       = (Hashtable)
                             md.getSupplementalData("module.parameters");
      String    fileName = null;
      if (mp != null)
        fileName = (String) mp.get("FileName");

    Hi Tuhin,
    <i>
    1. .I need to import idoc structure from excel file not from sap, is it possible ?</i>
    Yes and No; If the structure in the Excel sheet is defined  in XSD format (XML schema) then it should be possible to import it assuming you are using XI 3.0. In 2.0 this is not possible.
    Not sure if in XI 3.0 you are allowed to import Excel files straight forward into XI.
    <i>2 what are the detalied steps to implement following SAP note for getting processed file name at runtime.</i>
    I'm not quite sure but this looks to me like you have to implement this within a Java custom function/mapping...
    The data (in this case the filename) is encapsulated in a Hashtable object available during runtime.
    Cheers,
    Rob.

  • Multiple IDOCs from one Flat file

    HI Gurus,
    Sender file is of such format
    Header1,Item1 details
    Header1,Item2 Details
    Header2, Item1 Details
    Header2,item2 Details
    Header3, Item1 Details
    I need to map this file format to IDOC strucutre, In Header there is a filed which is the Key value to identify the change in header.
    Eg: Order Number is the field in the following file which identifies the change in header: First three fields are header details and following are the item details:
    ABC,ON1,22,Item1,XX
    ABC,ON1,33,Item2,FF
    ABC,ON2,44,Item1,MM
    ABC,ON3,66,Item1,LL
    How would be the Data type strcuture to capture this type of falt file strcuture and FCC parameters?
    I need to send a single IDOC per one header with multiple Items. is it possible to achieve?
    Thanks
    Rajeev

    Hi Satish,
    Do we need to do some configuration  to produce 3 IDOCs from the below strcuture?
    ABC,ON1,22,Item1,XX
    ABC,ON1,33,Item2,FF
    ABC,ON2,44,Item1,MM
    ABC,ON3,66,Item1,LL
    From the above structure 3 IDOCs should be generated as below:
    1st IDOC as
    ABC,ON1 (Header Details)
    22,Item1,XX (Item1 Details)
    33,Item2,FF  (Item2 Details)
    2nd IDOC as
    ABC,ON2 (Header Details)
    44,Item1,MM  (Item1 Details)
    and 3rd IDOC as
    ABC,ON3 (Header Details)
    66,Item1,LL  (Item1 Details)
    Do following Data type for the above file structure is valid? or I can use one flat DT?
    Record
    Header(1..Unbounded)
    ---F1 (Field 1)
    ---ON (Key Field Order Number)
    Item Details(1..Unbounded)
    ---F1 (Field1)
    ---F2
    ---F3
    If the above DT is correct then how would be the FCC parameters?
    Thanks
    Rajeev

  • Mapping of multiple segments of  Idoc HRMD_A06 to flat file

    Hi Experts,
               I am doing an Idoc to file scenario. Idoc i am using is HRMD_A06, which is having around 38 segments, contains the hiring action details of multilpe employees (Infotypes 0000,0001,0002,0003,0302,1001).
              When i have send the idoc , I am getting the file in the destination path, but having only one line which is having the the details of first employee.
              As the segments are repeating my mapping is not proper. Can anyone please help me with some details for mapping Idoc to file, when the segments repeats in a single idoc.
             Please also give me the details regarding the destination message interface.

    Hi
    Please go through below link,
    /people/prateek.shah/blog/2005/06/08/introduction-to-idoc-xi-file-scenario-and-complete-walk-through-for-starters
    /people/prateek.shah/blog/2005/06/08/introduction-to-idoc-xi-file-scenario-and-complete-walk-through-for-starters
    Its very simple to do some changes in your existing mapping and some occurance changes.
    Verify that if your file message structure has 0..Unbounded Occurance.
    Use 0..Unbounded and map accordingly to target structure with 0...unbounded..
    and test with sample xml in message mapping with multiple idocs data and see whther u get multiple records in target
    Also if you need each sengment on new line with FCC then refer below links
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
    Edited by: Swarup Sawant on Jan 24, 2008 10:09 AM
    Edited by: Swarup Sawant on Jan 24, 2008 10:09 AM

Maybe you are looking for

  • Open Item in GR/IR Account

    Dear Experts 1.         I have some credit balance lying in GR IR clearing account. Now I dont need to do MIRO and   pay it to vendor. How I can clear particular Line items from GR IR account.

  • Facebook export doesn't show all existing albums

    Lightroom 5.3 CR 8.3 Windows 8 Hello everyone I have a client who is running into an issue when trying to export pictures to facebook from lightroom 5.3.  Everything works great, except, the list of existing albums contains only 25 of their 83 albums

  • Excluded as an exception for OFAC in APP(F110)

    Hi Team, We have requirement for payment item is being read, the validation must also be made to determine if the payment should be excluded as an exception for "OFAC"(OFFICE OF FOREIGN ASSETS CONTROL) so Pls let me know if anybody have experience on

  • JavaFx Mobile + Swing Problems

    {color:#000000}{color:#ff0000}{color:#003300}The application runs fine when Run As "Desktop(std. execution mode)" & when changed to Run In "Mobile Emulator" gives following Error :-->{color} {color}{color}{color:#ff0000}Error preverifying class javaf

  • Business Syetem

    Hi,   what is the exact definition of business system and busniess component in sap pi? what is the difference ?