2007 May 25 8:05 AM
hi,
i want to display data from exel file.how can i do that.
i am using function module alsm_excel_to_internal_table.
here is the code i developed.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FILE
I_BEGIN_COL = 1
I_BEGIN_ROW = 1
I_END_COL = 20
I_END_ROW = 20
TABLES
INTERN = <b>IT_EXEL</b>
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
now i want to display data from <b>it_exel</b> table.
please help me.
2007 May 26 9:46 AM
DATA:iexcel TYPE TABLE OF alsmex_tabline WITH HEADER LINE.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = path1
i_begin_col = 1
i_begin_row = 1
i_end_col = 4
i_end_row = 60000
TABLES
intern = iexcel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0 .
WRITE :/15 'FILE NOT UPLOADED. INVALID FILE NAME OR PATH.' COLOR 6 .
EXIT.
ENDIF.
LOOP AT iexcel.
IF iexcel-col = '0001'.
itab-etsrk = iexcel-value.
ENDIF.
IF iexcel-col = '0002'.
itab-evbgd = iexcel-value.
ENDIF.
IF iexcel-col = '0003'.
itab-evend = iexcel-value.
ENDIF.
IF iexcel-col = '0004'.
itab-tlsrk = iexcel-value.
ENDIF.
AT END OF row.
APPEND itab.
ENDAT.
CLEAR iexcel.
ENDLOOP.
REFRESH iexcel.
After that use
loop at itab.
write
endloop.
or you can use ALV.
if you want to display the data in excel sheet itself then use FM
RH_START_EXCEL_WITH_DATA
or use ALVs and display data using REUSE_ALV_GRID_DISPLAY
2007 May 25 8:13 AM
hi,
P_FILE = 'C:\xxx.xls'.. this is file path from your presentaion server..
and use the FM you ill get the data from excel to internal table..
note: the internal table should contain the same no of fields in excell
rewards if useful
regards
nazeer
2007 May 25 8:14 AM
2007 May 25 8:16 AM
if you want to display the data in excel sheet itself then use FM
RH_START_EXCEL_WITH_DATA
or use ALVs and display data using REUSE_ALV_GRID_DISPLAY
2007 May 26 9:46 AM
DATA:iexcel TYPE TABLE OF alsmex_tabline WITH HEADER LINE.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = path1
i_begin_col = 1
i_begin_row = 1
i_end_col = 4
i_end_row = 60000
TABLES
intern = iexcel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0 .
WRITE :/15 'FILE NOT UPLOADED. INVALID FILE NAME OR PATH.' COLOR 6 .
EXIT.
ENDIF.
LOOP AT iexcel.
IF iexcel-col = '0001'.
itab-etsrk = iexcel-value.
ENDIF.
IF iexcel-col = '0002'.
itab-evbgd = iexcel-value.
ENDIF.
IF iexcel-col = '0003'.
itab-evend = iexcel-value.
ENDIF.
IF iexcel-col = '0004'.
itab-tlsrk = iexcel-value.
ENDIF.
AT END OF row.
APPEND itab.
ENDAT.
CLEAR iexcel.
ENDLOOP.
REFRESH iexcel.
After that use
loop at itab.
write
endloop.
or you can use ALV.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |