2007 Oct 05 5:44 AM
Hi,
Plz provide me the code how to use this function to upload data from excel sheet to internal table.
Thanks.
Hi,
Plz provide me the code how to use this function to upload data from excel sheet to internal table.
Thanks.
2007 Oct 05 5:47 AM
Hi,
ORM get_inputdata USING pv_fname TYPE rlgrap-filename.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = pv_fname
i_begin_col = 1
i_begin_row = 1
i_end_col = 15
i_end_row = 12000
TABLES
intern = i_col_row
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
Unable to open excel file
MESSAGE i899(fi) WITH text-124.
LEAVE LIST-PROCESSING.
ENDIF. "IF sy-subrc <> 0.
ENDFORM. " get_inputdata
FORM update_to_table .
LOOP AT i_col_row INTO wa_col_row.
IF NOT wa_col_row-row = 1.
v_value = wa_col_row-col.
CASE v_value.
WHEN 1.
wa_input-land1 = wa_col_row-value.
WHEN 2.
wa_input-mwskz = wa_col_row-value.
WHEN 3.
wa_input-txjcd = wa_col_row-value.
WHEN 4.
wa_input-text1 = wa_col_row-value.
WHEN 5.
wa_input-date = wa_col_row-value.
WHEN 6.
wa_input-s_per = wa_col_row-value.
WHEN 7.
wa_input-c_per = wa_col_row-value.
WHEN 8.
wa_input-ct_per = wa_col_row-value.
ENDCASE."CASE v_value.
AT END OF row.
IF NOT wa_input IS INITIAL.
APPEND wa_input TO i_input.
CLEAR wa_input.
ENDIF."IF NOT wa_input IS INITIAL.
ENDAT."AT END OF row.
*get the header title into one work area
ELSE."IF NOT wa_col_row-row = 1.
CASE wa_col_row-col.
WHEN 1.
wa_header-rec+0(7) = wa_col_row-value.
WHEN 2.
wa_header-rec+8(8) = wa_col_row-value.
WHEN 3.
wa_header-rec+17(21) = wa_col_row-value.
WHEN 4.
wa_header-rec+39(16) = wa_col_row-value.
WHEN 5.
wa_header-rec+56(13) = wa_col_row-value.
WHEN 6.
wa_header-rec+69(12) = wa_col_row-value.
WHEN 7.
wa_header-rec+83(13) = wa_col_row-value.
WHEN 8.
wa_header-rec+97(11) = wa_col_row-value.
ENDCASE.
ENDIF."IF NOT wa_col_row-row = 1.
ENDLOOP. "LOOP AT i_col_row INTO wa_col_row.
REFRESH i_col_row.
*checking table for values
IF i_input IS INITIAL.
MESSAGE i899(fi) WITH text-124.
LEAVE LIST-PROCESSING.
ENDIF."IF i_input IS INITIAL.
ENDFORM. " update_to_i_cabn
Regards
Shiva
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |