Creating JCo IDoc from flat file structure

Hi,
I need to send an IDoc into SAP using JCo.
The input to my program is a string containing lines representing a flat file idoc, e.g.
Line 1="EDI_DC40                           2   ORDERS04.."
Line 2="E1EDK01                                          00000100000001    USD..."
Line 3="E1EDK14                                          0000030000000...."
Is there a simple way to use JCo to create & send the IDoc? 
i.e.
1) If I use JCo and RFC IDOC_INBOUND_ASYNCHRONOUS, what would be all the steps/calls to SAP (create TID, call IDOC_INBOUND_ASYNCHRONOUS, confirm TID..?)
And can IDOC_INBOUND_ASYNCHRONOUS be called using the flat file structures (without having to map to all the JCo ParameterList fields)?  Since the flat file structures are  in the format required by the RFC, just in one long string.
Line 1=>IDOC_CONTROL_REC_40
Lines 2..n=>IDOC_DATA_REC_40
2) Similarly, if I were to use JCo plus the JCO IDoc library, is there a way to pass the flat file structures without having to do all the mapping to segment fields?
3) Other options..?
I want to use ALE to SAP, not files, even though the input is in the flat file structure.

Your reply gives a link to the general JCo documentation.
It doesn't give ideas on how to call an RFC or IDoc from JCO without mapping each and every field from a flat file structure.
I'm looking for a way to do something like this:
Function IDOC_INBOUND_ASYNCHRONOUS has table parameters
      IDOC_CONTROL_REC_40 STRUCTURE  EDI_DC40
      IDOC_DATA_REC_40 STRUCTURE  EDI_DD40
Since I have the flat file representation of the IDoc, the first line should overlay exactly onto the EDI_DC40 structure.  And the subsequent lines should overlay onto EDI_DD40.  (all fields in this RFC are strings)
However JCO and JCO IDoc library seem very strongly typed, so it looks like I would have to map each field from the flat file structure to a field in the JCO Function or JCO IDoc object. 
This could be done in a generic way using the function/idoc metadata, however there would still be some overhead.
Is there a way to get round this, and build the function/idoc treating its parameters as one long string?

Similar Messages

  • How to create Inbound Idoc from XML file-Need help urgently

    Hi,
    can any one tell how to create inbound Idoc from XML file.
    we have xml file in application server Ex. /usr/INT/SMS/PAYTEXT.xml'  we want to generate inbound idoc from this file.we are successfully able to generate outbound XML file from outbound Idoc by using the XML port. But not able to generate idoc from XML file by using we19 or we16.
    Please let me know the process to trigger inbound Idoc with out using  XI and any other components.
    Thanks in advance
    Dora Reddy

    Hi .. Did either of you get a result on this?
    My question is the same really .. I am testing with WE19 and it seems SAP cannot accept an XML inbound file as standard.
    I see lots of mention of using a Function Module.
    Am I correct in saying therefore that ABAP development is required to create a program to run the FM and process the idoc?
    Or is there something tht can be done with Standard SAP?
    Thanks
    Lee

  • How to Create Hierarchy From Flat file Structure

    Hi Gurus,
    There is a scenario for me regarding the Hierarchy.
    Required Hierarchy structure - Region>Director>Manager-->Sales id
    I have flat file which gives the info like user id , sales id , manager id, director id.
    But the transaction data Flat file has structure with sales id, region id, sales amt, sales qty.
    Note : Region id is another Master Data.
    How i can create hierarchy from the first flat file which doesnot have region info in that but it is available in the transaction data Flat file.
    Is there anyway we can create hierarchy based on the first Flat file structure which contains more that 1,00,000 records.
    Try to Suggest me in this regard .
    This is urgent.
    Regards,
    Mano

    Hi Mano,
                    Defining the source system from which to load data
    Choose the source system tree File  ® Create.
           2.      Defining the InfoSource for which you want to load data
    Optional: choose InfoSource Tree ® Root (InfoSources) ® Create Application Components.
    Choose InfoSource Tree ® Your Application Component ® Other Functions  ® Create InfoSource 3.x ® Direct Update.
    Choose an InfoObject from the proposal list, and specify a name and a description.
           3.      Assigning the source system to the InfoSource
    Choose InfoSource Tree ® Your Application Component ® Your InfoSource ® Assign Source System. The transfer structure maintenance screen appears.
    The system automatically generates DataSources for the three different data types to which you can load data.
    ○       Attributes
    ○       Texts
    ○       Hierarchies (if the InfoObject has access to hierarchies)
    The system automatically generates the transfer structure, the transfer rules, and the communication structure (for attributes and texts).
           4.      Maintaining the transfer structure / transfer rules
    Select the DataSource for uploading hierarchies.
    IDoc transfer method: The system automatically generates a proposal for the DataSource and the transfer structure. This consists of an entry for the InfoObject for which hierarchies are loaded. With this transfer method, the structure is converted to the structure of the PSA during loading, which affects performance.
    PSA transfer method: The transfer methods and the communication structure are also generated here.
           5.      Maintaining the hierarchy
    Choose Hierarchy Maintenance, and specify a technical name and a description of the hierarchy
    Hope this helps
    Regards
    Karthik
    Assign points if Helpful

  • Create IDoc from flat file - How to do the message mapping

    Hi everybody,
    I want to create an IDoc from a flat file.
    The file structure looks like this:
    MT_XYZ
    - Node001       0...1
      - Leaf001
    - Node002       0...unbounded
       - Node003    0...1
          - Leaf002
          - Leaf003
       - Node004    0...1
          - Leaf004
       - Node005    0...1
          - Leaf005
    I have created a mapping and all the other stuff to set up the IDoc adapter.
    Now when I try to test the interface the IDoc is created properly but obviously no information from the nodes "Node003" to "Node005" is inserted in the IDoc. Only the information kept in the elements (leafs) of "Node001" are inserted.
    All IDoc segments and their "Segment" elements are linked to the root node of the file structure "MT_XYZ". I tried to link some IDoc segments only to "Node002" but then this segment is not created.
    So how can I set up the message mapping in a way that the information from "Node003" to "Node005" is transported to the IDoc? Can anyone help me here?
    Thanks in advance for all answers!
    Regards,
    Torben
    Edited by: Torben Hönemann on Dec 14, 2009 4:26 AM

    Hi Torben,
    >>I want to create an IDoc from a flat file.
    So you are using File content Conversion on the sender side. Right?
    >>no information from the nodes "Node003" to "Node005" is inserted in the IDoc.
    Are these information available in the source XML (you can check in transaction SXMB_MONI-> Input Payload).. There is a limitation in File Content Conversion of File adapter and it is that I can make an XML structure of 3 level.. Since these nodes details are in level 4 and 5 they should be missing in Source XML structure itself (after content conversion of File adapter). check that
    >>So how can I set up the message mapping in a way that the information from "Node003" to "Node005" is transported to the IDoc? Can anyone help me here?
    So you need to take an alternate approach where you do File Content Conversion and make 3 level structure.. then using a mapping convert this three level structure to your 5 level one and then try to map with the idoc.
    Check this blog for an idea
    http://www.riyaz.net/blog/xipi-file-content-conversion-for-complex-structures/
    http://www.riyaz.net/blog/xipi-convert-flat-file-to-deeply-nested-xml-structures-using-only-graphical-mapping/
    Regards
    Suraj

  • Create inbound invoice from flat file

    Hi Folks,
    for periodic creation of PO invoice from flat file, what would be the best way to go?
    Thanks and Rg. Jimbob

    1. Read the file using OPEN DATASET and read and fill up the segment info and fill the EDIDC header data
    and then call function
    CALL FUNCTION 'INBOUND_IDOC_PROCESS'
        TABLES
          IDOC_CONTROL       =  i_edidc
          IDOC_DATA          =  i_edid4.

  • How to create a inbound IDOC from flat file in Application server

    HI All
    Our requirement is to create the Inbound idocs from a flat file from application server with in R/3
    Could any body please let me know the steps required for this.
    Thanks
    Malli

    1. Read the file using OPEN DATASET and read and fill up the segment info and fill the EDIDC header data
    and then call function
    CALL FUNCTION 'INBOUND_IDOC_PROCESS'
        TABLES
          IDOC_CONTROL       =  i_edidc
          IDOC_DATA          =  i_edid4.

  • Steps to create Data loading from Flat File to Info Cube in BI

    Hi,
         I am very new BW, I need some one help. When I am trying to create info source i am any pop window stating to create Transaction data or master data.
         After creating Info source, I dont know how to assign this info source to source system (which i created).
          When select the context menu of info source I dont have option to assign the datasource.
          And one more thing is When I am creating the Info Cube. I cant understand how to create.
          Please some one help me how to map the fields to Source system.
    Regds
    Dave.

    Hi,
    For flat file upload, first you need to create the source system.
    Then you need to create the infosource based on the format of the flat file you are going to upload or vice versa depending on your requirements.
    Once your infosource is ready, right click on it and select assign datasource. Here you can assign your flat file datasource. Then create an infopackage and give the path from where the file is to be upload to BW (in the infopackage).
    Also look at the thread below for procedure on flat file upload :
    http://help.sap.com/saphelp_nw04s/helpdata/en/8e/dbe92341c84242be2c7d3917f1c197/frameset.htm
    Cheers,
    Kedar

  • Need help at date format while creating External Tables from Flat file

    Hi All,
    I have a flat file generated from SQL Server 2005. In that generated flat file the date format is in the format as "YYYY-MM-DD HH24:MI:SS.Millisec" like example "2007-09-08 13:32:36.568".
    My task is I have to load this flat file data into Oracle database table running on 9i, but its failing at the creation of external table itself because of this date format. The target table in Oracle the date column data type is "date" only not the "TIMESTAMP".
    Can any body suggest how to resolve this?
    Thanks,
    Sankar

    Or:
    SQL> select cast(to_timestamp('2007-09-08 13:32:36.568',
      2                  'yyyy-mm-dd hh24:mi:ss.xff') as  date) dt
      3  from dual;
    DT
    08-SEP-07                                                                                                                                                                                                                                                                                                                                                                   

  • Inbound idocs with flat file

    Hi
    Iam creating INBOUND IDOCS from flat file ...so my sending and recieving systems are same...
    In WE20 i have setup the logical system and assigned inbound parameters with message type and proces code.
    Iam using IDOC_INBOUND_ASYNCHRONOUS to create the inbound IDOCS but iam getting the error
    EDI: Partner profile inbound not available
    It looks like iam missing some settings here..
    Please let me know what checks i need to make sure to get rid of this error and post the idoc.
    Thanks
    Govi

    Hello,
    You need to create partner profile in WE20 transaction code.
    For more details follow the link: [creating PARTNER PROFILE|http://help.sap.com/saphelp_nw04/helpdata/en/2d/f371e4d24a11d289810000e8216438/frameset.htm].
    Hope this resolves your issue!
    Thanks,
    Augustin.

  • IDOC --- XI -- HTTP (via a flat file structure, not XML)

    I am working on a senario in which we need to send a third party payroll service provider our HR Master Data records (Message type HROT_UM).  The manual method is to create a flat file from an IDOC and place the file in a shared directory, then upload the flat file by logging on to the web server.  We would like to automate this process using XI.
    Is it possible to send a flat file structure to a webserver using a HTTP receiver adapter?  If not, can you provide a basic view of how to accomplish this task.  Please note that FTP is not an option for us. 
    Any suggestions or recommendations would be greatly appreciated.

    hey
    flat file over HTTP is not possible,it takes only XML.
    have a look at the following thread
    Send file through http
    thanx
    ahmad
    PL:reward with points for helpful answers

  • 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

  • Create the Product Catalog from Flat file

    Hi,
    We have a requirement to create the Product catalog (CRM) from flat file data. We have the required data like Product catalog ID, description, sub areas and products are present in the Exel file. Now we need to create product catalog automatically using the report. Can u give me any pointers on what FM and BAdis to be callled in this report?.
    Thanks and Regards,
    S Reddy

    Link:[Create product basic Data|http://esoadocu.sap.com/socoview(bD1lbiZjPTAwMSZkPW1pbg==)/render.asp?packageid=DDC84252E3AEF0F1AA5A001A64D3F460&id=8C145DB8CF3A11DC2B8D000F20FCB6A9]

  • Create IDOCs from DMEE Files

    Hi SDN,
    Can I create Custom IDOCs from the DMEE file format.
    The file is getting downloaded after the DMEE Run in a specific format individual to every company code.
    I want to generate IDOCs for every DMEE Run.
    Thanks,
    Manu

    Take a look at this :
    http://www.sappoint.com/ppt/idoc.ppt
    you need to create File port in Tr.WE21 , as file port
    Then you have to sechdule the program RSEout00 to collect Idocs .
    You can test it in Tr.WE19 , you can also use the Tr.BD87 to see your Idoc status
    Hope this’ll give you idea!!
    <b>P.S award the points.</b>
    Good luck
    Thanks
    Saquib Khan
    "Some are wise and some are otherwise"

  • Creating IDoc from DMEE File Format

    Hi SDN,
    Can I create Custom IDOCs from the DMEE file format.
    The file is getting downloaded after the DMEE Run in a specific format individual to every company code.
    I want to generate IDOCs for every DMEE Run.
    Thanks,
    Manu

    Hi,
    your problem is just like filling the segements using the data in other segements. that means if you have knowledge of enhancing the idoc and populating the enhanced segments then in the same way you can populate the BATCH segment also.
    you just go to the function module which will be creating the idoc(if its outbound) / function module which will be posting the idoc which is for inblund and then find the perform where it fills the segments ( it will be the one which you will use to fill the segment BATCH )and go that and at last of form you will find one customer function which you can use to fill the BATCH segment.
    i think this will help u,
    Regards,
    Ravi

  • Creating BOM using BDC :How to display no of records from flat file under

    Hi,
          How to display no of records from flat file under one (Alternative BOM) vertically.
        When i execute, the records are replacing one by one.
    Here my coding:
    report ZBOM1
           no standard page heading line-size 255.
    *include bdcrecx1.
    DATA: BEGIN OF bdc OCCURS 0,
           matnr(18),
           werks(4),
           stlan(1),
          END OF BDC.
    DATA: BEGIN OF BDC1 OCCURS 0,
           idnrk(18),
           MENGE(18),
           MEINS(3),
           postp(1),
          END OF bdc1.
    DATA: BEGIN OF BDCDATA OCCURS 0,
             matnr(18),
             werks(4),
             stlan(1),
             idnrk(18),
             MENGE(18),
             MEINS(3),
             postp(1),
             posnr(4),
          END OF BDCDATA.
    data: ibdcdata type  standard table of bdcdata WITH HEADER LINE.
    *start-of-selection.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = 'C:\Documents and Settings\dilipkumar.b\Desktop\soft.txt'
       FILETYPE                       = 'ASC'
       HAS_FIELD_SEPARATOR            = ','
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                     =
      HEADER                         =
      TABLES
        DATA_TAB                      = BDCDATA
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_READ_ERROR               = 2
      NO_BATCH                      = 3
      GUI_REFUSE_FILETRANSFER       = 4
      INVALID_TYPE                  = 5
      NO_AUTHORITY                  = 6
      UNKNOWN_ERROR                 = 7
      BAD_DATA_FORMAT               = 8
      HEADER_NOT_ALLOWED            = 9
      SEPARATOR_NOT_ALLOWED         = 10
      HEADER_TOO_LONG               = 11
      UNKNOWN_DP_ERROR              = 12
      ACCESS_DENIED                 = 13
      DP_OUT_OF_MEMORY              = 14
      DISK_FULL                     = 15
      DP_TIMEOUT                    = 16
      OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    *perform open_group.
    loop at bdcdata.
    perform bdc_dynpro      using 'SAPLCSDI' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29N-STLAN'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RC29N-MATNR'
                                  'SOFTDRINKS'.
    perform bdc_field       using 'RC29N-WERKS'
                                  'WIND'.
    perform bdc_field       using 'RC29N-STLAN'
                                  '1'.
    perform bdc_field       using 'RC29N-DATUV'
                                  '16.09.2008'.
    perform bdc_dynpro      using 'SAPLCSDI' '0110'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RC29K-BMENG'
                                  '1'.
    perform bdc_field       using 'RC29K-STLST'
                                  '1'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29K-EXSTL'.
    perform bdc_dynpro      using 'SAPLCSDI' '0111'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29K-LABOR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPLCSDI' '0140'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POSTP(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=FCBU'.
    perform bdc_field       using 'RC29P-IDNRK(01)'
                                  BDCDATA-IDNRK.
    perform bdc_field       using 'RC29P-MENGE(01)'
                                  BDCDATA-MENGE.
    perform bdc_field       using 'RC29P-MEINS(01)'
                                  BDCDATA-MEINS.
    perform bdc_field       using 'RC29P-POSTP(01)'
                                  BDCDATA-POSTP.
    perform bdc_dynpro      using 'SAPLCSDI' '0130'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POSNR'.
    perform bdc_field       using 'RC29P-POSNR'
                                   BDCDATA-POSNR.            "'0010'.
    perform bdc_field       using 'RC29P-IDNRK'
                                  BDCDATA-IDNRK.             "'15'.
    perform bdc_field       using 'RC29P-MENGE'
                                  BDCDATA-MENGE.             "'1'.
    perform bdc_field       using 'RC29P-MEINS'
                                  BDCDATA-MEINS.             "'ml'.
    perform bdc_dynpro      using 'SAPLCSDI' '0131'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POTX1'.
    perform bdc_field       using 'RC29P-SANKA'
                                  'X'.
    *perform bdc_transaction using 'CS01'.
    *perform close_group.
    CALL TRANSACTION 'CS01' USING IBDCDATA MODE 'A' UPDATE 'S'.
    REFRESH IBDCDATA.
    endloop.
           Start new screen                                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR iBDCDATA.
      iBDCDATA-PROGRAM  = PROGRAM.
      iBDCDATA-DYNPRO   = DYNPRO.
      iBDCDATA-DYNBEGIN = 'X'.
      APPEND ibDCDATA .
    ENDFORM.
           Insert field                                                  *
    FORM BDC_FIELD USING FNAM FVAL.
    IF FVAL <> NODATA.
        CLEAR iBDCDATA.
        iBDCDATA-FNAM = FNAM.
        iBDCDATA-FVAL = FVAL.
        APPEND iBDCDATA .
    ENDIF.
    ENDFORM.

    Hi,
    the BDCDATA structure must be fnam, fval,dynbegin,dynpro,program.
    You have to declare like this and pass this in your CALL TRANSACTION statement.
    Please give some other table name for BDCDATA you declared for and also for IBDCDATA.

Maybe you are looking for