7 Replies Latest reply: Mar 24, 2009 10:53 AM by Suneel Kumar Gopisetty RSS

how to upload a excel file using BDC

venkat sharma gaddala
Currently Being Moderated

how should i upload a file using BDC

 

i have downloaded a excel file containing the values of  table A006 a X server.

now i hav to upload it into new server Y server using BDC , how do i do it?

wat all things one shud consider ?

  • Re: how to upload a excel file using BDC
    Mansi SAP SD
    Currently Being Moderated

    Hi,

    Use function module GUI_UPLOAD to upload values from excel into an internal table.

    Then you can follow any one of the following :

    1. Loop at the internal table and update database table A006 directly.

    2. Create a recording of BDC using transaction SHDB and then update the database.

     

    The first method is more efficient and logical..

    Regards,

    Mansi.

  • Re: how to upload a excel file using BDC
    Suneel Kumar Gopisetty
    Currently Being Moderated

    Hi venkat sharma gaddala,

     

      Here why we need concept of BDC? Until unles If you need to go thru some T-Code.

     

     

    What do u mean by Server, is that a FTP server ???

     

    If so how did you down from FTP in the same way we need to use FM 'FTP_R3_TO_SERVER' to upload

    that Excel internal table.

     

    Regards,

    SG

  • Re: how to upload a excel file using BDC
    Pooja Gupta
    Currently Being Moderated

    Hi,

     

    This is very simple, follow the below mention steps to do so:

     

    1.Declare an internal table having same structure as db table, but take all the fields type as 'C' and length same as defined in the table.

     

     

    TYPES:BEGIN OF it,
      key(20) TYPE c,
      indicator(20) TYPE c,
      bldat(20) TYPE c,"bkpf-bldat
      budat(20) TYPE c,"bkpf-budat
      END OF it.
    DATA: itab TYPE STANDARD TABLE OF it,
          wa TYPE it.

     

    2.Include TRUX as type pool and declare a variable of type trux_t_text_data to be passed in the FM that actually reads data from excel sheet into above declared intrenal table.

     

    TYPE-POOLS: truxs.
    
    DATA: it_raw TYPE truxs_t_text_data.

    3. Call the FM 'TEXT_CONVERT_XLS_TO_SAP' and pass the file name and the internal table name into the parameter

     

    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
    *    I_FIELD_SEPERATOR          = 'X'
         i_line_header              = 'X'
          i_tab_raw_data             = it_raw 
          i_filename                 = p_file "name of the excel file
        TABLES
          i_tab_converted_data       = itab[] "internal table where data will be stored
       EXCEPTIONS
         conversion_failed          = 1
         OTHERS                     = 2
                .
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.

    4. loop at internal table and modify the ztable/dbtable where data to be upload .

     

    Hope this solve your problem.

     

    Pooja

Actions