Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

exel sheet display

Former Member
0 Likes
698

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.

1 ACCEPTED SOLUTION
Read only

former_member225631
Active Contributor
0 Likes
674

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

4 REPLIES 4
Read only

Former Member
0 Likes
674

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

Read only

Former Member
0 Likes
674

hi,

loop at it_exel.

write 😕 it_exel-f1,it_exel_f2....

endloop.

Read only

Former Member
0 Likes
674

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

Read only

former_member225631
Active Contributor
0 Likes
675

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.