‎2010 Aug 18 10:45 AM
Hi,
i want to upload data in cs01 tcode.
but data is excel sheet while i am trying to use gui_upload it is not being possible for me to upload data.
can any one tell me what is the function module?
can any send me the steps how to uplaod data if it is in excelsheet?
thanks & regards
naveen
Moderator message: FAQ, please search for available information before asking.
locked by: Thomas Zloch on Aug 18, 2010 1:46 PM
‎2010 Aug 18 10:48 AM
‎2010 Aug 18 10:54 AM
but with that function module only one record will be uploaded it seems becuase it is asking col and row i have 20 coloumns and 20 rows then how i can assign that many columns and that many rows
‎2010 Aug 18 11:00 AM
Hi Naveen,
Just refer this code snippet which I have developed recently for uploading Excel data to Internal table :-
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file1
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '2'
i_end_row = '48'
TABLES
intern = itab.
IF NOT itab[] IS INITIAL.
*loop at itab.
LOOP AT itab.
CASE itab-col.
*---First Column
WHEN '1'.
translate itab-value to upper case.
it_user-BNAME = itab-value.
*---Second Column
WHEN '2'.
it_user-NAME_TEXT = itab-value.
APPEND it_user.
CLEAR it_user.
ENDCASE.
ENDLOOP.
ENDIF.
IF NOT it_user[] IS INITIAL.
MODIFY zactv_dialog_usr FROM TABLE it_user.
IF sy-subrc = 0.
COMMIT WORK.
WRITE : sy-dbcnt, 'Records updated successfully'.
ENDIF.
ENDIF.Regards
Abhii
‎2010 Aug 18 10:56 AM
Hi,
If you have to upload the data form Excel sheet to a particular tranaction, then you need to have a praticular functionlaity in place for the same. This means if you wnat to upload the data from excel sheet to a tcode then You have to get the data in an internal table first & then either by a BAPI or a BDC you have to update the data.
Just search for this more in forum [Data Transfers|;
Regards
Abhii
‎2010 Aug 18 11:22 AM
Hi,
Try the below sample code u ll get an idea of uploading using 'TEXT_CONVERT_XLS_TO_SAP'.
REPORT zupload_excel_to_itab.
TYPE-POOLS: truxs.
PARAMETERS: p_file TYPE rlgrap-filename.
TYPES: BEGIN OF t_datatab,
col1(30) TYPE c,
col2(30) TYPE c,
col3(30) TYPE c,
END OF t_datatab.
DATA: it_datatab type standard table of t_datatab,
wa_datatab type t_datatab.
DATA: it_raw TYPE truxs_t_text_data.
At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
***********************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw " WORK TABLE
i_filename = p_file
TABLES
i_tab_converted_data = it_datatab[] "ACTUAL DATA
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.
***********************************************************************
END-OF-SELECTION.
END-OF-SELECTION.
LOOP AT it_datatab INTO wa_datatab.
WRITE:/ wa_datatab-col1,
wa_datatab-col2,
wa_datatab-col3.
ENDLOOP.
Thanks & Regrads,
Neela.