Legacy flat file to IDOC into SAP

after been given the task of converting a flat file structure to SAP idocs my research as lead me into the daunting world of CAPS. Basically I would like to know if using CAPS is the best choice for me
and if so what is actually involved to make this happen?
Thanks
Michael

hi michael,
from my point of view "the right thing to do" would be:
consider if this is the only task for you that is somehow EAI ish...
if it is do not care about technology... just do it with a very simple program
if you have to evolve choose a tool that is capeable of your systems you own: e.g. SAP AS400 .......
in caps you would typically do this:
setup CAPS
write an ftp2queue component
write a converter (custom otd + convertion logic + IDOC OTD)
write a idoc 2 sap component via TRFC
run ;-)
a good starting point would be:
http://developers.sun.com/docs/javacaps/index.jsp
or
http://wikis.sun.com/display/JavaCAPS/Grok+Java+CAPS
or try to convince your boss that sun will implement it for you if you have the money to do so.
we did that when introducing CAPS (we got it for free besides the CAPS licences of course ;-)).
regards chris

Similar Messages

  • MATMAS05 Idoc to Flat File : Multiple material into same file

    Hi ,
      I am struck in simple scenario .Sending Materail Master data to flat file using idoc MATMAS05.  I made following changes to MATMAS05.xml file.
    I added MaxOccurs -=Unbounded and imported it in the interface mapping.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"><xsd:element name="MATMAS05"><xsd:complexType><xsd:sequence><xsd:element name="IDOC" type="MATMAS.MATMAS05" maxOccurs="unbounded"
    I am able to get multiple materials extracted in same file .However the XML fails to open the file completely saying there is error.
    Can anybody send me an xml file of Material Master having 2 matrials so I can compare it?
    Regards
    Prashanta

    Hello Prasanta,
    If I understand correctly you are sending MATMAS from SAP to File.
    And you want to split the Matmas into multiple files .
    If this is the case then do not change the Idoc field occurance on the target side. In the Message mapping , messages tab change the occurance of the target to unbounded.
    And use enhanced interface determination for the same.
    Cheers,
    Himadri

  • Legacy flat file - XI - R/3 (IDocs)

    Hi Liu,
    I was trying to have some hands-on with XI 3.0 demo.
    I tried with the following scenario-
    Legacy flat file -> XI -> R/3 (IDocs)
    e.g., say to create BOM data or material Master.
    I take the flat file - create my own External Data Type, message type & message Interface for it in Design(Repository).
    And try to map it with the required IDoc Type(msg. type) imported from R/3.
    But while mapping, I found certain unknown fields like BEGIN (mandatory), inside the Control Record EDI_DC40- certain fields like SEGMENT, TABNAM, etc.
    Al these fields are unknown & I could not figure what to map & how to map them.
    Also how do we map Sender port/ receiver- dow e need to hard-code them or we can assign them/map them dynamically.
    Would appreciate ur sppedy reply.
    Thanks.

    For BEGIN you map a constant with no value.
    For the attributes SEGMENT you have to choose:
    1. Is the IDOC segment available only once (occurence 1..1), just map constant '1'
    2. Is the IDOC segment available multi times (occurence 1..unbounded), map arithmetic function 'counter' to make sure, that each attribut SEGMENT has an increasing number.
    Regards
    Stefan

  • Flat File to IDOC- didn't get data into IDOC

    Hi All,
    Our scenario is Flat File to IDOC....
    working fine... didn't get any errors... IDOC also generated but didn't get any data in that IDOC....
    for details see the attachment...
    Thanks In Advance,
    vishnu.........

    Hi Rajesh,
    I am getting payload in RWB from sender Cc like below:
    <?xml version="1.0" encoding="utf-8" ?>
    - <ns:MT_File xmlns:ns="http://mouritech.com/file2idocsender"> 
    - <MT_File> 
    <Value>1</Value>  
    <Reason>test</Reason>  
    </MT_File>
    </ns:MT_File>
    If i test with this payload in mapping i am getting a pop up with this message and mapping not completed ...
    Could you please let me know what i have to do now?
    Pop Up: 
            The processing instruction target matching "[xX][mM][lL]" is not allowed.
    See error logs for details    

  • IDoc flat file to IDoc

    I am receiving flat file in SFTP Server which need to be posted into SAP (No mapping involved)
    What will be the best approach ?
    1. I tried using IDOCFlatToXmlConvertor (The limitation in the format of source file. The parent and child node relationship should be explicitly mentioned in IDoc flat file which legacy system is not able to do) - Any workarounds ?
    2. I moved the Idoc flat file into SAP application server. Now need to schedule job using program RSEINB00
    3. File Content Conversion
    Any other better solution ? Appreciate your help.
    Thanks and regards,
    Jose Augastine

    For converting Idoc Flat file to idoc xml, ABAP mapping is one of the feasible option.

  • IDOC Flat File-- XI-- IDOC

    Hi,
       I have a requirement wherein we have to read the IDOC flat file and post it as IDOC to SAP using XI. I understand we have to use the Flat File Sender adapter and the IDOC Receiver Adapter. On the Sender Side we have to define the Content Conversion to convert the IDOC Flat File to IDOC XML. Writing File Content Conversion for the IDOC Flat File would be very tedious because of the number of fields and fixed structure of the flat file.
      I have don through the following guide Section 3.2 where it talks abt converting IDOC to IDOC XML using reportRSEINB00.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-how-to-guides/how%20to%20convert%20between%20idoc%20and%20xml%20in%20xi%203.0.pdf
    I am not clear how to invoke this report in the Flat File Sender adapter. Also is there any other approach.
    Thanks
    Rajeev Gupta

    Hi Rajeev
    You have a flatfile at the sender side so you dnt  have any feasiable option to do other than FCC....FCC is not a tediuos one...if you can provide the strucutrre we will help you out...
    Check out you have a fixedlength file or piple separated one....
    In the functional design how many fields re present and buil the DT,MT MI accoprdingly.....
    you have to just use some conecnt conversion parameters that's it...
    item.fieldSeparator
    item.endSeparator
    item.fieldNames
    here item is your recordset name
    let us know your strucutre
    regards
    Nisar

  • IDOC to Flat file and Flat file to IDOC

    Hello Experts,
      I have the following requirement in my current project:
    Third Party Sender sends the data in the in the below XML format via HTTP:
    <?xml version="1.0"?>
    <fxEnvelope>
      <header>
        <message>
          <exchangeID></exchangeID>
          <messageID></messageID>
          <subject></subject>
          <payloadType>IDOC</payloadType>
        </message>
        <from>
          <orgID></orgID>
          <locationID></locationID>
          <messageID></messageID>
        </from>
        <to>
          <orgID></orgID>
          <locationID></locationID>
        </to>
      </header>
      <body>
        <Opaque>
          <DataType></DataType>
          <DataStream></DataStream>
        </Opaque>
      </body>
    </fxEnvelope>
    In the above XML, the Tag <DataStream> is a string which contains the IDOC flat file.
    Now, the scenario is HTTP to IDOC, where the sender sends the above XML payload and PI needs to convert <DataStream> to IDOC XML and pass it on to the receiver R/3.
    But the challange i am facing is converting this <DataStream> tag which contains the IDOC flat file to IDOC XML using a Mapping program.Since both adapters are running on ABAP stack i can not go for Adapter Modules available(We are using PI 7.10).
    Looking for some guidance on the same.
    Thanks in advance.
    Cheers,
    Manasa.

    There are 2 options for you
    In either case, you might need a java mapping to convert the DataStream into String. Use a file adpater to write this string to IDOC-File.
    1) Option1: Write the content of DataStream into IDOC-Flatfile.(java mapping) Pick it from PI to convert IDOC-flat file inot IDOC-XML (using std features of PI) & send it to ECC.
    2) Option2: Write the Content of DataStream to IDOC-Flatfile (accessible to ECC system). Configure WE21 to pick the file from a file port.
    If the datastream was IDOC-XML, then it would have been simpler, it will be a direct communcation from PI to ECC (using java mapping & IDOC adapter).
    Regards,
    Siva Maranani

  • Flat file to XML in SAP SFTP adapter

    Hello All
    I am trying to convert flat file to xml using SAP SFTP adapter.
    Flat File is like below:
    AABEN;20141106;20141106;45;0.00
    AABOL;20141106;20141106;45;0.00
    ABGRI;20141106;20141106;45;0.00
    ADDEA;20141106;20141106;45;0.00
    ALADA;20141106;20141106;45;58.43
    AMSCH;20141106;20141106;45;0.00
    ANOLV;20141106;20141106;45;0.00
    ANROY;20141106;20141106;45;0.00
    AVMCD;20141106;20141106;45;0.00
    Message Type structure I created like below
    In Server SFTP adapter in Module tab I am using "AF_Modules/MessageTransformBean" and conversion type ="StructPlain2XML"
    I am getting error = "Error: com.sap.aii.af.sdk.xi.adapter.trans.TransformException: Transformer Conversion3.0.5226 Error initializing Class: java.lang.Exception: java.lang.Exception: java.lang.Exception: Error(s) in XML conversion parameters found (4408) Parameter 'xml.keyFieldName' is missing (4403) Parameter 'xml.keyFieldType' is missing (4403) ; nested exception caused by: java.lang.Exception: java.lang.Exception: java.lang.Exception: Error(s) in XML conversion parameters found (4408) Parameter 'xml.keyFieldName' is missing (4403) Parameter 'xml.keyFieldType' is missing (4403) "
    I am not using any key field then please let me know how to overcome this issue.
    I searched on SDN but did not get any perfect answer.
    Thanks
    Dheeraj Kumar

    Hello Dheeraj,
    Thanks for your reply. I created a new discussion,
    Flatfile to XML
    Thanks well in advance for your help!
    -Satish.

  • Converting a flat file to IDOC

    Greetings to All,
    I have a requirement where i need to convert an IDOC (flat) file to IDOC.
    the idoc is SHPMNT04.Presently i am trying to implement it using FCC at the sender side as the flat file is fixed length type.
    Can any one suggest me a better method like using XSLT or Java mapping which could make my work smarter as i am Finding it very difficult to count and write the FCC for the IDOC which is have more than 60 segments.
    Any help will be greatly admired.
    Thnaks,
    Anika.

    Hi
    I am still having a doubt if this method will work on real time scenario.I mean i have to pick files
    from an 3rd party FTP location (polling and picking as and when i get a file starting with say
    ABC*.txt).Added to this there will be issue related to the volume of file(1000 per day),will that create
    any performance issues.
    It is now that you are sharing the complete scenario/ problem , just have a glance from your first post at the top & the replies, because its the problem statement that steers the discussion.
    Making the files available for the Report is a seperate task. You have to develop FTP-to-File XI scenario (or regular ftp process to send files across, which normally will not be allowed in XI server), I dont see any other way, if any, I 'assume' that it might complicate the situation.
    Performance - it is not something to do with your scenario alone, but the overall system load, configuration etc. (b.t.w 1000 is normal)
    Can we schedule a job for running the report periodically?
    Yes, scehdule a batch job calling this Report (with necessary variants) with required frequency or exact time (if there is any agreement with sender)
    I have started a POC
    I appreciate that, best way at this moment. you can reverse engineer from the errors to configure your scenario. for any reason,if you think it does not work, you can always stop and/or look for different solution.
    need your help
    - Definitely I will share my thoughts, if time permits
    how will i get the flat file xml(IDOC) in the source side
    do you mean the source structure, you can use the same structure as your target.
    once you are convinced with your solution approach, then it is better to close this thread & start a new one with new issues, for more views & suggestions and better readability.
    @Rajesh - I appreciate your efforts to solve the issue , but the below is not correct & possible, w.r.t this issue
    Here what you need is to do configure File Sender CC with NFS protocol.
    Regards
    Vishnu

  • Extract to flat file or IDOC

    Does anybody know how to use BW Datasources in R3 (found in transaction RSA5) to extract data to a flat file for the purpose of loading a non-SAP data warehouse?
    The export file may be an IDoc.
    I tried RSA3, but it seems you have to specify a "target system" which is a BW system. I simply want to use the BW extractors to extract to a file.
    Thanks - I will reward points.

    Hi,
    If it is function module based extractor then you can use the copy/modify the code (copy in case you are authorized to change it). Now at the end of the extractor write an ABAP code to download the data into a flatfile using GUI_DOWNLOAD or any suitable function module. You can use this extractor fn module in an ABAP program and schedule it everyday to create the flatfile.
    If it view/table base extractor then use that in an ABAP program to create the flatfile.
    Revert if you need more info.
    You can find the type of extractor in RSO2 and also in the tabel ROOSOURCE.
    Bye
    Dinesh
    Message was edited by: Dinesh Lalchand

  • Flat File to IDOC

    Hi,
    I have to post the data from Flat File to SAP using IDOC. Please help me out with all the posibilities.
    Regards,
    Kiran.L

    Hi,
    Step 1 Read flate file into internal table.
    step 2  Follow below program to create a idoc through Z program,
    REPORT ZOUTBD_IDOC_TEMPLATE NO STANDARD PAGE HEADING.
    *************************START OF DECLARATIONS**********************
    *eject
    Table Declarations
      TABLES:  ZIDOC_TAB_EX1,  "Equivalent to an SAP Master table.
               ZIDOC_TAB_EX2.  "Equivalent to an SAP Master table.
    *eject
    Types Declarations with data work Areas / Internal tables.
      TYPES: begin of ty_idoc_par,
               werks      LIKE   ZIDOC_TAB_EX1-werks,
               c_rec_ind  LIKE   ZIDOC_TAB_EX1-c_rec_ind,
               name1      LIKE   ZIDOC_TAB_EX1-name1,
               name2      LIKE   ZIDOC_TAB_EX1-name2,
               stras      LIKE   ZIDOC_TAB_EX1-stras,
               pfach      LIKE   ZIDOC_TAB_EX1-pfach,
               ort01      LIKE   ZIDOC_TAB_EX1-ort01,
               counc      LIKE   ZIDOC_TAB_EX1-counc,
               pstlz      LIKE   ZIDOC_TAB_EX1-pstlz,
               telf1      LIKE   ZIDOC_TAB_EX1-telf1,
               regio      LIKE   ZIDOC_TAB_EX1-regio,
            end of ty_idoc_par.
      TYPES: begin of ty_idoc_chd,
               werks     LIKE    ZIDOC_TAB_EX2-werks,
               eroed     LIKE    ZIDOC_TAB_EX2-eroed,
               schld     LIKE    ZIDOC_TAB_EX2-schld,
             end of ty_idoc_chd.
      TYPES: begin of ty_message,
               OBJNR      LIKE    MCMAILOBJ-OBJNR,
               OBJLEVEL   LIKE    MCMAILOBJ-OBJLEVEL,
               OBJTYPE    LIKE    MCMAILOBJ-OBJTYPE,
               OBJNAM     LIKE    MCMAILOBJ-OBJNAM,
               OBJDES     LIKE    MCMAILOBJ-OBJDES,
               OBJLINE    LIKE    MCMAILOBJ-OBJLINE,
             end of ty_message.
      TYPES: begin of ty_mess_output,
               v_err_out(1000)     TYPE  C,
               v_err_out_2(1000)   TYPE  C,
             end of ty_mess_output.
    *eject
    Data Declarations
    Essential declarations for populating the IDOC:
      DATA:  begin of itab_idoc_data occurs 0.
               include structure edidd.                    "Data record.
      DATA:  end of itab_idoc_data.
      DATA:  begin of itab_comm_idoc_control occurs 0.
               include structure edidc.                    "Control record.
      DATA:  end of itab_comm_idoc_control.
    Internal Table for Mail Recipient.
      DATA: BEGIN OF ITAB_RECIPIENT OCCURS 0.
              INCLUDE STRUCTURE  ZINT_RECEIVER.
      DATA: END OF ITAB_RECIPIENT.
    Declare an internal table for Parent segment.
      DATA:  itab_idoc_par TYPE ty_idoc_par occurs 0 with header line.
    Declare an internal table for child segment.
      DATA:  itab_idoc_chd TYPE ty_idoc_chd occurs 0 with header line.
    Declare variables for Parent and Child Segments
      DATA:  i_z1parseg  LIKE   z1parseg,     "PARENT SEGMENT DATA.
             i_z1child   LIKE   z1child.      "CHILD  SEGMENT DATA.
    Internal table to process function to send error mails.
      DATA: itab_err_mess  TYPE   ty_message     occurs 0 with header line.
      DATA: itab_mess_output TYPE ty_mess_output occurs 0 with header line.
    Variables for sending error mails.
      DATA: objnr                 LIKE   SOOD1-ACNAM, "Name of object.
            V_ERR_DESC_1          LIKE   SOOD1-OBJDES,
                        "Error message on pop up box after program executes.
            V_OBJLINE             LIKE   ITAB_ERR_MESS-OBJLINE,
            V_MESSAGE_1(60)       TYPE   C,
            V_MESSAGE_2(120)      TYPE   C,
            V_MESSAGE_3(75)       TYPE   C,
            V_MESSAGE_4(150)      TYPE   C,
            V_MESSAGE_5(150)      TYPE   C,
            V_MESSAGE_6(150)      TYPE   C,
            V_RDATE(10)           TYPE   C,
            V_RTIME(8)            TYPE   C,
            V_RECIPIENT(12)       TYPE   C,
            v_itab_idoc_par_lines,
            v_itab_idoc_chd_lines,
            child_counter         TYPE   C,
            parent_counter        TYPE   C,
            idoc_counter          TYPE   C,
            v_mess_output(1000)   TYPE   C,
            v_error_detail(88)    TYPE   C,
            v_final_detail(1000)  TYPE   C,
            V_DUMMY               TYPE   C.   "Dummy File Indicator.
    *eject.
    Constant Declarations
      CONSTANTS:
    BASIC IDOC TYPE AS CREATED FROM TRANSACTION CODE we30.
      C_Segment_type1(8)         TYPE C  VALUE  'Z1IDOCOB',
      C_mestyp(11)               TYPE C  VALUE  'ZSAMPLEMESS',
      C_SENDMODE                 TYPE C  VALUE  'B',   "Sending Mode
      C_EXPRESS                  TYPE C  VALUE  'E',
      C_LANGUAGE                 LIKE sy-langu   VALUE  'E'.
    **********************END OF DECLARATIONS*****************************
    *eject
    Initialisation
    INITIALIZATION.
    Assign the initial settings for sending error mails.
      v_err_desc_1   = 'Message from processing ZOUTBD_IDOC_TEMPLATE.'.
                       "Error message in pop up box after program executes.
      v_error_detail = 'A complete set of detail records is not held for'.
      idoc_counter   = '0'.   "No of Idocs processed.
      parent_counter = '0'.   "No of parent segments selected.
      child_counter  = '0'.   "No of child segments selected.
    *************************BEGIN OF PROCESSING**************************
    Call form to initialize standard structures
      PERFORM clear_Structures.
    Fill report to tell user when the interface was run.
      PERFORM fill_mail_report.
    Call function to populate parent structure:
      PERFORM select_parent_data.
    Call function to populate child structure:
      PERFORM select_child_data.
    Inform the user of the number of records that were selected.
      PERFORM fill_record_selected.
    Loop at contents of parent structure:
      LOOP AT itab_idoc_par.
    Populate the control structure with the partner and port sending and
    receiving details.
       REFRESH itab_idoc_data.
       PERFORM populate_Control_structure USING  c_mestyp
                                                 c_SEGMENT_type1.
       PERFORM transfer_Parent_data_to_seg.
    Loop at the children structure - retrieving the children segments
    for this parent.
       LOOP AT itab_idoc_chd WHERE WERKS = itab_idoc_par-WERKS.
    Call form to transfer data to child Idoc.
       PERFORM transfer_Child_data_to_seg.
    ENDLOOP.      "Stop looping through the children structure.
    Call SAP function to transfer data.
       PERFORM master_idoc_distribute.
    Form to close logical unit of work.
       PERFORM COMMIT_WORK.
    ENDLOOP.   " Stop looping through the parent structure.
    Fill the number of articles processed for online mail.
       PERFORM fill_process_record.
    Write to online mail report on data interface has processed.
       PERFORM FILL_ERR_MESSAGE USING  V_OBJLINE
                                       V_MESSAGE_1
                                       V_MESSAGE_2
                                       V_MESSAGE_3
                                       V_MESSAGE_4
                                       V_MESSAGE_5
                                       V_MESSAGE_6.
    Send online mail with contents of message fields.
       PERFORM SEND_MAIL.

  • Flat file to idoc mapping issue

    Hi Gurus,
    i had a flat file format in sender side as below:
    H_ID     TYP_CODE    line_elemet      Quantity
    5896  STANDARD                       1.transmitter    1
    5896                  STANDARD       2.xxxxxxxxx           1
    5896                   STANDARD      3.yyyyyyyyy  2
    6895                  STANDARD       1.aaaaaaaaa        1
    9436                  STANDARD       1.bbbbbbbbb          4
    9436                  STANDARD       2.ggggggggg          3
    The above file need to be send to an Idoc.
    for which same header_ID values should create only one header segment, under that many a line segments should create as many line items appear on that header_id value.
    Here my query is how to suppress the repetetive header values to create onlyone header segment. And how to create as many line_item segments as the number of line items appear.
    points obvoius for the response
    Thanks in advance,
    Sekhar.

    About map problem I suggest youn to see the following link that are really helpful to improve knowledge about mapping:
    /people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i
    /people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
    I suggest you to see the following link to learn more about mapping:
    Mapping functionality in XI
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9202d890-0201-0010-1588-adb5e89a6638
    SAP Exchange Infrastructure - Graphical_Mapping
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6658bd90-0201-0010-fbb6-afe25fb398d3
    SAP Exchange Infrastructure - Graphical Mapping Exercise
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/fd5ebd90-0201-0010-d697-91374d5b5190
    SAP Exchange Infrastructure - Graphical Mapping - Advanced
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/be05e290-0201-0010-e997-b6e55f9548dd
    SAP Exchange Infrastructure: Mapping Patterns - Understand Context Handling in Message Mapping - Webinar Powerpoint
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f59730fa-0901-0010-df97-c12f071f7d3b
    SAP NetWeaver Exchange Infrastructure Mapping Troubleshooting - Webinar Powerpoint
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e01e9400-9e81-2910-20a5-a862945a5e98
    Mapping Lookups a RFC API
    Mapping lookups - RFC API
    XI 3.0 New Mapping Features
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8a57d190-0201-0010-9e87-d8f327e1dba7
    I hope these links will be usefull.
    Regards,
    Salvatore

  • File content conversion - flat file to Idoc error

    Dear Experts,
    I have a situation where im using FCC in the sender adapter The data is in flat file with multiple fields separated by space .
    (*header444456    line4445758 header343434 line445687*) sample falt file data . should be divided as below
    header - 44456 , 343434
    *line    -  44457578 , 445687
    So i want to read the header items and pass it into header data of the IDoc and line items into line item data of the Idoc . And the header items and fields items are mixed up in the flat file . How do i read from the position 20 to 26 , 37 to 56 intermittently .And im not using any key field name . as the whole data is in one line . Any solution would be of great help .
    Thanks in advance
    Ganga
    Edited by: N.Ganga on Jan 28, 2012 3:30 PM
    Edited by: N.Ganga on Jan 28, 2012 3:30 PM

    Dear Grzegorz ,
    Yes i totally agree with you it can be separated by comma . But it is as below
    Header       - (once ).............................................. Flat file example :
         Field 1    -
    >order    line no 1   plant        material 1  code 1  quantity 1 
          .......................................................................order    line no 2   plant        material 2  code 2  quantity 2
         Field 2  (plant vlaue shuld come........................................................|
    Line          -  repeats (0-unbounded)                                      |                                     |                             |
       field 1 (line no 1)----
    |                                     |                             |
       field 2(material1)----
    |                             |
       field 3 (quant 1)----
    |
       field 1 (line no 2)----
    |                                     |                             |
       field 2(material2)----
    |                             |
       field 3 (quant 2)----
    |
    So i need to read the data intermittently and map them in the line items ignoring the order and plant data in every line apart from the first line. The order and plant remains the same in the flat file only line items keep changing .
    Hope my question is clear .
    Regards
    Ganga

  • Flat file to IDOC creation

    hi all,
    I'm looking for the ABAP (sample) Program which can help me out in generating IDOC from the Flat file.
    Flat file will be residing on local PC.
    I required this for Purchase Order Confirmation Step (MSG Type ORDRSP).
    If any had done it, then let me know.
    Regards,
    S Anand

    Hi
    Sorry it is not copied properly.
    Read the data from flst file using function module GUI_UPLOAD and for each entry of internal table fille the control recor and data record and pass to function module IDOC_INBOUND_ASYNCHRONOUS to generate IDOC.
    Sample code which i have used in my report to update customer master using IDOC
    PARAMETERS:p_kunnr TYPE kna1-kunnr,
    p_zahls TYPE knb1-zahls,
    p_tlfns TYPE knb1-tlfns,
    p_intad TYPE knb1-intad.
    START-OF-SELECTION.
      PERFORM idocgeneration.
    *&      Form  idocgeneration
          IDOC Generation
    FORM idocgeneration.
      DATA:wa_knb1 TYPE knb1,
      wa_kna1 TYPE kna1,
      wa_controlrecord LIKE edi_dc40,
      wa_detailrecord  LIKE edi_dd40,
      wa_e1kna1m TYPE e1kna1m,
      wa_e1knb1m TYPE e1knb1m.
      DATA:it_controlrecord TYPE STANDARD TABLE OF edi_dc40,
      it_detailrecord  TYPE STANDARD TABLE OF edi_dd40.
      CONSTANTS: cedidc40    LIKE edi_dc40-tabnam  VALUE 'EDI_DC40',
                 cdebmas06   LIKE edi_dc40-idoctyp VALUE 'DEBMAS06',
                 czdebmas06  LIKE edi_dc40-cimtyp  VALUE 'ZZDEBMAS06',
                 cdebmas     LIKE edi_dc40-mestyp  VALUE 'DEBMAS',
                 ce1kna1m    LIKE edi_dd40-segnam  VALUE 'E1KNA1M',
                 ce1knb1m    LIKE edi_dd40-segnam  VALUE 'E1KNB1M',
                 c_2       TYPE c VALUE '2'.
    Control Record
      CLEAR: wa_controlrecord,it_controlrecord[].
      wa_controlrecord-tabnam  = cedidc40.
      wa_controlrecord-mandt   = sy-mandt.
      wa_controlrecord-direct  = c_2.
      wa_controlrecord-idoctyp = cdebmas06.
      wa_controlrecord-cimtyp  = czdebmas06.
      wa_controlrecord-mestyp  = cdebmas.
      wa_controlrecord-mesfct  = space.
      wa_controlrecord-sndpor  = 'SAPPLD'.
      wa_controlrecord-sndprt  = 'KU'.
      wa_controlrecord-sndprn  = 'A000'.
      wa_controlrecord-rcvpor  = 'SAPPLD'.
      wa_controlrecord-rcvprt  = 'KU'.
      wa_controlrecord-rcvprn  = 'A000'.
      APPEND wa_controlrecord TO it_controlrecord.
    Remove the contents in detail record internal table
      REFRESH it_detailrecord.
    Create detailed data
    Assign values to the segment fields
      CLEAR:wa_kna1,wa_e1kna1m.
      SELECT SINGLE * FROM kna1 INTO wa_kna1 WHERE kunnr = p_kunnr.
      IF sy-subrc IS INITIAL.
        MOVE-CORRESPONDING wa_kna1 TO  wa_e1kna1m.
        wa_e1kna1m-msgfn = 'INT'.
    Create the detail record
        CLEAR wa_detailrecord.
        wa_detailrecord-segnam  = ce1kna1m.
        wa_detailrecord-mandt   = sy-mandt.
        wa_detailrecord-segnum  = '000001'.
        wa_detailrecord-psgnum  = '000000'.
        wa_detailrecord-hlevel  = '01'.
        wa_detailrecord-sdata   = wa_e1kna1m.
        APPEND wa_detailrecord TO it_detailrecord.
      ENDIF.
    *assign values to the segment fields
      CLEAR:wa_knb1,wa_e1knb1m.
      SELECT SINGLE * FROM knb1 INTO wa_knb1 WHERE kunnr = p_kunnr.
      IF sy-subrc IS INITIAL.
        MOVE-CORRESPONDING wa_knb1 TO  wa_e1knb1m.
        wa_e1knb1m-msgfn = 'INT'.
        wa_e1knb1m-intad = p_intad.
        wa_e1knb1m-zahls = p_zahls.
        wa_e1knb1m-tlfns = p_tlfns.
      ENDIF.
    Add segment to the detail record
      CLEAR wa_detailrecord.
      wa_detailrecord-segnam  = ce1knb1m.
      wa_detailrecord-mandt   = sy-mandt.
      wa_detailrecord-segnum  = '000003'.
      wa_detailrecord-psgnum  = '000001'.
      wa_detailrecord-hlevel  = '02'.
      wa_detailrecord-sdata   =  wa_e1knb1m.
      APPEND wa_detailrecord TO it_detailrecord.
      CALL FUNCTION 'IDOC_INBOUND_ASYNCHRONOUS'
        TABLES
          idoc_control_rec_40 = it_controlrecord
          idoc_data_rec_40    = it_detailrecord.
      IF sy-subrc IS INITIAL.
        WRITE:/ 'Sucessfully Update'.
      ENDIF.
    ENDFORM.                    "IDOC Generation

  • Flat File to IDOC Scenario

    I am working on the following scenario:
    Flat CSV orders file to a Orders IDOC.
    The input file has data like
    a,b,c,d,e,f,g,h...
    a,b,c,d,e,f,g,h...
    We need to generate ONE IDOC per file. The complexity lies in the mapping.
    The segments generated in the IDOC and the number of times they are generated all depends on the values of a,b and c and the segment fields are mapped to values either from the file or mapped to some constants or are figured out based on some logic depending upon what value a,b or c has and what range of values c has.
    Overall, quite a complex mapping.
    The way I am trying to work is:
    1. Create Outbound MI ABC based on the File Structure:
    <Record> 0 to unbounded
    <a></a> 1..1
    <b></b> 1..1
    <c></c> 1..1
    2. Do file content conversion in Sender File adapter.
    3. Import the Orders02 idoc in the IR.
    4.Create a message mapping with ABC as source and Orcers02 IDOC as target.
    5. Now with mapping, I am trying to use createif for every IDOC segment node. The logic is to create this node if the condition is true ( i.e a=somevalue else do not create).I am definig UDF for evaluating these conditions.
    6. Then I map the fields of the generated segment node to either the values from the source or some values generated by UDFs based on some criteria.
    I am still in the mapping phase and I just wanted to know if this was a correct approach to acheive this. So far, I am mapping one node and when I check in the output it works okay.
    My question is :
    1. I would end up using lots of UDFs for every input record and for every record of input, each UDF will be called again and again.
    2. Does anyone know of any better approach to achieve this?
    3. If a segment appears more than one time, let us say generate segment E1TDK01 if a=1, and a could be 1 in multiple records that means generating multiple E1TDK01 segments, is there anything that needs to be taken care of? I see in the target structure that this segment can occur 0 to 99 times, so will this segment be generated 5 times if my file had a=1 in 5 records?
    Please help me understand this and any pointers to existing weblogs will also be appreciated.

    Hi,
    Try this and this should resolve your issue:
    1. Import IDOC into repository
    2. After import, download the wsdl of the imported IDOc into your file system
    3. Open the wsdl and insert code at the IDOC tag ===> minOccurs=0, maxOccurs=unbounded (Pl follow correct syntax, I may not be right on syntax)
    4. save the file
    5. imported the modified wsdl  into repository and use this one in the message mapping
    6. In message mapping, messages tab change the occurances to 0 to Unbounded for the modified wsdl IDOC
    7. Do the same thing in interface mapping
    Hope this helps.
    TNV

Maybe you are looking for

  • Problem with JNI hello world

    I found some tutorial on SUN site on how to use JNI. I'm using Eclipse to compije Java and C (via Cygwin) files. Here are complete files: Hello.java: class Hello      public native void sayHello();      static           try           System.loadLibra

  • Is there a way to change the cursor hotspot systemwide on Mountain Lion?

    Hello community. Is there a way to change the cursor hotspot on Mountain Lion, systemwide? Like editing the original cursor file (or downloading one) and replacing the original one? Reason: when I enlarge the arrow, the "absoulute" tip (top of the wh

  • TopLink doesn't support JAXP 1.1 ?!?

    Does anyone know when Toplink is going to support JAXP 1.1? It seems to be using old xerces-1 type objects, but when I try to use xml-apis.jar, it doesn't work. - Rustam -

  • Secured Info...

    I've recently typed in my myspace password on my iPhone, but I forgot it...Is there anyway to find out what was type in my iPhone?

  • Layout use in alv

    Hi,     I have saved three layouts on alv grid display screen. I have given three radio buttons on screen to select any one of them. But I dont know how to pass the layout name to alv grid. Please if any one cud help.