How to convert the flat file data into sap tables . ?

how to upload flat file data into sap table . before upload mapping is also there in some filds . any one can give me some steps how to upload and mapping . ?

Hi
See the sample code
REPORT zmmupload.
Internal Table for Upload Data
DATA: i_mara like MARA occurs 0 with header line
PARAMETERS: p_file LIKE ibipparms-path.  " Filename
At selection-screen on Value Request for file Name
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Get the F4 Values for the File
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      program_name  = syst-cprog
      dynpro_number = syst-dynnr
    IMPORTING
      file_name     = p_file.
Upload the File into internal Table
  CALL FUNCTION 'UPLOAD'
    EXPORTING
      filename                = p_file
      filetype                = 'DAT'
    TABLES
      data_tab                = i_mara
    EXCEPTIONS
      conversion_error        = 1
      invalid_table_width     = 2
      invalid_type            = 3
      no_batch                = 4
      unknown_error           = 5
      gui_refuse_filetransfer = 6
      OTHERS                  = 7.
  IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
Upload the Data from Internal Table
  MODIFY MARA from TABLE i_MARA.
Regards
Anji.

Similar Messages

  • How to store the flat file data into custom table?

    Hi,
    Iam working on inbound interface.Can any one tell me how to store the flat file data into custom table?what is the procedure?
    Regards,
    Sujan

    Hie
    u can use function
    F4_FILENAME
    to pick the file from front-end or location.
    then use function
    WS_UPLOAD
    to upload into
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'F4_FILENAME'   "Function to pick file
        EXPORTING
          field_name = 'p_file'     "file
        IMPORTING
          file_name  = p_file.     "file
      CALL FUNCTION 'WS_UPLOAD'
       EXPORTING
         filename                       = p_file1
        TABLES
          data_tab                      = it_line
    *then loop at it_line splitting it into the fields of your custom table.
    loop at it_line.
              split itline at ',' into
              itab-name
              itab-surname.
    endloop.
    then u can insert the values into yo table from the itab work area.
    regards
    Isaac Prince

  • How to upload the flat file records into internal table by position?

    Hi
    I have a flat file which has 7 records in each row and they are NOT provided with CSV or Tab demilited...
    They are continous text without spaces....
    but i know the fixed length of each field Eg : 1st field 7 char and seconc field 3 char and so on...
    How can i upload this file into internal table by reading positions of each field...I know we can use GUI_UPLOAD and Read dataset and Open dataset...
    But please let me know to read the file with the fixed postions and load into internal table...
    Thanks in advance
    MM

    Hi
    As per my knowledge i dont think thr is some function module or so to read with a fixed positions.
    You can use the below method if you think this is the best way.
    Suppose your file has
    types : begin of ty_itab,
                field1 type char7,
                field2 type char3,
                field3 type chat3,
                field4 type char3,
                end of ty_itab.
    types : begin of ty_upload,
                 str type string,
                end of ty_upload.
    data : it_itab type standatd table of ty_itab,
              it_upload type standard table ot ty_upload,
              wa_itab type ty_itab,
              wa_upload type ty_upload.
    use gui_upload.get the data in it_upload.
    here you know that u have first 16 charcters makes a first row n then next 16 charcters next row
      Loop at it_upload into wa_upload.
       v_len =  strlen ( wa_upload ).
       v_len = v_len / 16.
        You get number of rows per record ,if it is decimal value make it final value if 3.9 make to 4.
        do v_len times.
          wa_itab = wa_upload.
          By this only first 16 characters are moved and respective fields will get a value.or else u can use offset
           wa_upload+0(16).
          append wa_itab to it_itab.
          Now shift 16 characters using shift command in wa_upload.
        enddo.
      endloop.
    Hope this syntax help you to resolve your issue.May be something i have missed .Right now i don't have sap system to send you the full correct syntax code.
    Cheers
    Joginder

  • How to transfer the Legacy Transaction Data into SAP R/3

    Hi Experts,
    I  have  issue with legacy transaction data transfer  to R/3 system. My clients want to see  last 3 years legacy transaction data into SAP R/3 system.  But I am not sure whether it is possible or not.
    Please let  me know any possibilities to transfer the legacy tansaction data into SAP.
    Please help me out from this issue.
    Advanced Thanks,
    Chandra

    Hi Sunitha,
    Here legacy sytem is MRP for Retail Sales.
    And format is excel. Since three years data available in
    existing system.
    Please let me know if any further information required.
    Regards,
    Chandra

  • How to convert the alv list data into pdf format

    Hi Expersts,
                      Is it possible to convert the alv list output data into PDF format? if yes, then please help me with this issue.
    thanks in advance,
    Regards,
    Samad

    hii samad,
    you can go through these link.i hope it ll solve your purpose
    How to convert list output to PDF
    Display ALV list output in PDF format
    regards,
    Shweta

  • Converting Flat File data into XML

    Hi Experts,
    Consider the message type of the SENDER system and flat file data
    <dt_sender>
    <root>
    <header1>   0..1
        <f1>
        <f2>
        <f3>
    <header2>   0..1
        <f4>
        <f5>
        <f6>
    <item>        1..unbounded
        <f7>
        <f8>
        <f9>
        <f10>
        <f11>
        <f12>
    </item>
    abc     def     ghi     jkl     mno     pqr
    123     123     123     123     123     123
    456     456      456     456     456     456
    how to convert the flat file data into following XML data. please note that each field value is separated by TAB delimeter...wht parameters shld b used
    <root>
        <Header1>
            <f1>abc</f1>
            <f2>def</f2>
            <f3>ghi</f3>
        </Header1>
        <Header2>
            <f4>jkl</f4>
            <f5>mno</f5>
            <f6>pqr</f6>
        </Header1>
        <item>
            <f7>123</f7>
            <f8>123</f8>
            <f9>123</f9>
            <f10>123</f10>
            <f11>123</f11>
            <f12>123</f12>
            <f7>456</f7>
            <f8>456</f8>
            <f9>456</f9>
            <f10>456</f10>
            <f11>456</f11>
            <f12>456</f12>
        </item>
    points will be given to the correct answers
    Thanks in advance.
    FAisal
    Edited by: Abdul Faisal on Feb 29, 2008 5:53 AM

    Faisal,
    When you read the multiple recordset strucutre file then each record in txt file should have an header from which you can identiy which segment it should go.. and you identiy it by using the keyfiledValue in file adapter
    <root>
    <header1> 0..1
    <f1>
    <f2>
    <f3>
    <header2> 0..1
    <f4>
    <f5>
    <f6>
    <item> 1..unbounded
    <f7>
    <f8>
    <f9>
    <f10>
    <f11>
    <f12>
    </item>
    for this input file
    abc def ghi jkl mno pqr
    123 123 123 123 123 123
    456 456 456 456 456 456
    abc def ghi can be read using the file adater to header 1 usinfg key field value, but using the same file adapter you cannt put GHI into header2.
    else you should read whole row abc def ghi jkl mno pqr in single filed and write an UDF to split data to header1 and Header 2
    similarly you have to take care for item records also
    if your inout file is something like this
    abc def ghi
    jkl mno pqr
    123 123 123 123 123 123
    456 456 456 456 456 456
    abc identifies to Header 1
    JKL for Header 2  so on...
    read the whole line in single field  and write UDF to Split to header 1 and header 2 similary for item.

  • Bdc upload file data into internal table problem with gui_upload fm

    Hello experts,
    my coding is like this ..
    data : begin of itab occurs 0 .
    field1 like mara-matnr,
    field2......
    etc,
    end of itab.
    data: file1 type string.
    parameter :file like rlgrap-filename.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
    static = 'X'
    mask = space
    field_name = 'FILE'
    CHANGING
    file_name = file.
    START-OF-SELECTION.
    FILE1 = FILE . "HERE I AM PASSING INTO STRING
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = FILE1
    FILETYPE = 'ASC'
    has_field_separator = 'X'
    TABLES
    data_tab = itab. " here the data is not populating from the file , it is giving the error like speified table not found.
    HERE i am getting the message like "specified table name not recgonised" . the data is not populating into the itab from the file.
    file structure is same as the internal table.
    I stored the file as .txt( ie in notepad).
    my file is like this..
    10000 200 323 sunndarrr.......
    i had a problem with this bdc , i am getting like "specified table name not recgonised" in the fm gui_upload while debugging.
    when i am using the ws_upload it is working fine.
    please guide me where i have done the mistake.
    thank you so much for all the replies.

    Hi,
    Have a look on the following code.
    TABLES: kna1.
    DATA: BEGIN OF itab1 OCCURS 0,
          str(255),
          END OF itab1.
    DATA: itab2 TYPE kna1 OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'WS_UPLOAD'
      EXPORTING
        filename                = 'D:\ABAP EVE\ffile1.txt'
        filetype                = 'ASC'
      TABLES
        data_tab                = itab1
      EXCEPTIONS
        conversion_error        = 1
        file_open_error         = 2
        file_read_error         = 3
        invalid_type            = 4
        no_batch                = 5
        unknown_error           = 6
        invalid_table_width     = 7
        gui_refuse_filetransfer = 8
        customer_error          = 9
        no_authority            = 10
        OTHERS                  = 11.
    IF sy-subrc <> 0.
      WRITE:/ 'sorry'.
    ELSE.
      LOOP AT itab1.
        SPLIT itab1-str AT ',' INTO itab2-kunnr itab2-name1.
        APPEND itab2.
      ENDLOOP.
      IF sy-subrc = 0.
        LOOP AT itab2.
          WRITE:/ itab2-kunnr,itab2-name1.
          INSERT INTO kna1 VALUES itab2.
        ENDLOOP.
        IF sy-subrc = 0.
          WRITE:/ 'inserted'.
        ELSE.
          WRITE:/ 'not inserted'.
        ENDIF.
      ELSE.
        WRITE:/ 'fail'.
      ENDIF.
    ENDIF.
    Flat file:
    10001,Sadney
    10003,Yogesh
    20005,Madan
    1.U need to define internal table with one field of max size
    2.upload the flat file data into that internal table
    3.split that internal table data into another internal table(having fields)
    <REMOVED BY MODERATOR>
    thanks,
    Chandu
    Edited by: Alvaro Tejada Galindo on Apr 30, 2008 12:17 PM

  • Convert the flat file to xml format.

    hi,
    I need to write a interface program in the R/3  to pull the flat file data from the unix application server and do some manipulation and place back into the unix application server in XML format, From the unix box XML file taken by the XI server.
    pls give me some idea to convert the flat file to XML format, through any function module or any other logic is there...
    with regards,
    Thambee.

    Hi Thambe
    in addition to the above posts
    Program to convert flat file to XML file.
    please download tool from this link:
    http://www.download.com/Stylus-Studio-2008-XML-Enterprise-Suite/3000-7241_4-10399885.html?part=dl-StylusStu&subj=dl&tag=button&cdlpid=10399885
    how to use:
    http://www.stylusstudio.com/learn_convert_to_xml.html
    http://www.sap-img.com/abap/sample-xml-source-code-for-sap.htm
    Flat file to XML
    CONVERTION OF FLAT FILE TO XML : NO OUT PUT FOUND
    Converting Idoc flat file representation to XML
    how to convert flat file into IDOC-XML
    Thanks
    sandeep sharma
    PS ; if helpful kindly reward points

  • Load flat file data into ODS in BI

    Dear Gurus,
    How to load flat file data into ODS?. Please share the article if you have.
    advance wishes
    Thanks
    Venkadesh

    Please search the forums before posting :
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60debae1-84dd-2b10-e7bf-bdedf1eabdf9
    http://wiki.sdn.sap.com/wiki/display/BI/Beginner+Section

  • How to convert the javasource file(*.class) to execute file(*.exe)?

    How to convert the javasource file(*.class) to execute file(*.exe)?
    thank you!

    Although i have seen a few programs (that are platform specific) that will embed a small jvm into an exe with your class file, it is generally excepted that you cannot create an executable file using java. The JAR executable file is probably the closest your going to get
    Pete

  • Conversion_Exit_Cunit_error occured while loading the Flat file data

    Hi
    Iam tryign to load Flat file data into an ODS, i am getting error like Error Conversion Cunit.
    Also we are using 0unit in the ODS for which CUNIT is a conversion rule
    Can you please suggest me why iam getting this error

    Hi Sunil
    Hope you can check whether you are loadig the flat file data from application server or Client workstation.
    May be if you are loading from Client work station you will face problem of this type.
    Try to check if any change in format in the file.
    at the end of the file delete the spaces.

  • Convert the Flat file format to XSTRING.

    hi experts,
                    I need to convert the flat file(.txt,.pdf....) to an internal table as the XSTRING.

    Hi,
          Refer
    /people/michal.krawczyk2/blog/2006/04/19/xi-rfc-or-abap-proxy-abap-proxies-with-attachments
    Regards

  • How to query the flat files?

    Hi
    How to query the flat files that are used in Etl From EBS source.

    That can be done in OBIEE. Save the flat file as .csv format. Then go to ODBC Administrator on windows machine where you BI server is running, and create an System DSN and select "Microsft Access Text Driver (*.txt, *.csv)" as driver type.
    Next, import tables in RPD using this ODBC connection. Rest of the steps as same as building model from a table source.
    Hope this helps.

  • How to list the JAR files loaded into the Oracle Database ?

    How to list the JAR files loaded into the Oracle Database ?

    From 11.1 onwards, the below two views are available to identify the jar files loaded into the Database.
    JAVAJAR$
    JAVAJAROBJECTS$
    By querying the JAVAJAR$ view you can know information about the JAR files loaded into the Database and using JAVAJAROBJECTS$ view you can find all the java objects associated with the given JAR file.
    These views are populated everytime you use LOADJAVA with "-jarsasdbobjects" option to load your custom java classes.
    But unfortunately this feature is available only from 11.1 onwards and there is no clear workaround for above in 10.2 or earlier.

  • To upload a data into SAP Table with the help of RFC function in BODS

    Hi,
    Please provide me step-by-step solution to upload data into any SAP table with the help of RFC function in Data Services.
    I have created RFC function that upload data into SAP table. RFC Function contains one table that has same structure as my database table.
    In the data services how can i filled the table of RFC function, i am using this function in query transform of data services but it gives me error.
    I am also follow link http://wiki.sdn.sap.com/wiki/display/BOBJ/BusinessObjectsDataServicesTipsand+Tricks
    but it did not help me.
    Thanks,
    Abhishek

    Hi Abhishek,
    Did you import the function module in the SAP datastore first? When you open the SAP datastore, the function should be listed in the 'functions' section. If not, import it. Make sure your function is remote executable.
    Once the function is there, you can use it in a transformation. In 'Schema Out' right-click on 'Query' (top level) and choose 'New Function Call'. You can then select a datastore and a function in the datastore. The wizard will show you which output parameters are available. I believe you have to add at least one and can select as many as you like.
    After confirming your selection the function and the output parameters appear in Schema Out. You can then right-click on the function and choose 'Modify function call'. A popup will appear where you can specify the input parameters.
    I hope this helps.
    Jan.

Maybe you are looking for