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..
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.
actually we are doin data migration from one server to other.
so here from x server i hav downloaded hte data
now hav to upload into Y server using BDC
now y BDC means we hav to do it using the transaction VK11
table which has to be uploaded is A006 which i have it in a excel formal on my PC
So in addition to the above code given by me after data is read into the internal table and in step 4 updation in the table A006 will be done by the code generated by the BDC first run using a Tcode VK11 using the tcode SHDB.
I hope you know how to do BDC recording using SHDB/SM35
Edited by: Pooja Gupta on Mar 24, 2009 10:40 AM
Hi venkat sharma gaddala,
Thanks for elabrating your need,
1. As now we need to do recording using SHDB for T-code VK11 and give input values which are from downloaded file ie X Server. (here you will come to know if any error).
2. If step 1 is done then use this FM ALSM_EXCEL_TO_INTERNAL_TABLE to download your excel data to Internal table.
3. Pass this internal table values to BDC. thats it the data now is in Y Sever.
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.