12-12-2009 7:12 AM
Please help me know how to use the function module " alsm_excel_to_internal_table ".
Iam unable to understand the parameters included in this function module.
Thanks and Regards,
Murali Krishna Tatoju
12-12-2009 7:32 AM
Hi,
1. pass the starting row and column number to I_begin_col and i_begin_row.
2. pass the end column and row to I_end_col and I_end_row.
3. pass the presentation file path to i_filename.
4. you will get the data into internal table in the form of row number, column number and value.
5. loop on this internal table and populate the values in the internal table as per required structure.
12-12-2009 7:35 AM
12-12-2009 7:45 AM
hi,
chk this, put the data into an excel file.then download.
suppose data base name is
db_name_age
fields inside it are name and age.
**************************************
sample excel sheet.
coloumn 1 is name and column 2 is age
name age
A 8
C 13
D 55
************************************
DATA : int_excel LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
data : record like db_name_age occurs 0 with header line.
DATA : v_start_col TYPE i VALUE '1', "starting col
v_start_row TYPE i VALUE '1', " starting row
v_end_col TYPE i VALUE '2', " total columns
v_end_row TYPE i VALUE '10'. "total no of record
FORM f_upload .
CLEAR : int_excel, int_excel[].
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = wf_filename
i_begin_col = v_start_col
i_begin_row = v_start_row
i_end_col = v_end_col
i_end_row = v_end_row
TABLES
intern = int_excel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
*Message is 'Unable to upload data from ' wf_filename.
MESSAGE e169(zm050) WITH wf_filename.
ELSE.
SORT int_excel BY row col.
REFRESH : record.
CLEAR : record.
LOOP AT int_excel.
CASE int_excel-col. "go thru each column.
WHEN 1.
record-name = int_excel-value.
WHEN 2.
record-age = int_excel-value.
ENDCASE.
AT END OF row.
APPEND record.
CLEAR record.
ENDAT.
ENDLOOP.
*inserting into table
modfiy db_name_age from table record.
ENDIF.
rgrds
anver