12-20-2007 1:51 PM
12-20-2007 1:59 PM
Hi,
just go through these Function Modules.
DATA: v_f4_filename TYPE ibipparms-path.
DATA: v_alsm_filename TYPE rlgrap-filename.
DATA: v_repid TYPE sy-repid.
DATA: v_dynnr TYPE sy-dynnr.
DATA: it_data1 like alsmex_tabline occurs 0 with header line.
v_repid = sy-repid.
v_dynnr = sy-dynnr.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = v_repid
dynpro_number = v_dynnr
FIELD_NAME =
IMPORTING
file_name = v_f4_filename.
.
v_alsm_filename = v_f4_filename.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = v_alsm_filename
i_begin_col = 1
i_begin_row = 1
i_end_col = 36
i_end_row = 65536
TABLES
intern = it_data1
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.
Note: you must be having atleast a notepad which has some values so that theses datas can be put into internal table it_data1.
if you are having more doubts about these function Modules
Go to se37 and have a look at these FM.
hope this helps.
12-20-2007 2:00 PM
Hi,
If you could pass an excel sheet to the FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' that will be better
This is with regards to example what i gave.
12-20-2007 2:02 PM
12-20-2007 2:05 PM
Hi,
what dump it is giving?? and where you are going to implement this FM?? Did you checked your legacy (notepad or Excel sheet etc etc.)??
12-20-2007 2:07 PM
i am giving legacy data in flat file(excel) to upload.That time it gives short dump reg parameters(end col and end row)
12-20-2007 2:20 PM
Hi,
the problem you are facing right now may be like the below,
just look at this function module and tell me whether have you enabled the darkened areas or not and
if no just check your
sy-subrc value whether it is 1 or 2 or 3.
as 1 <-- inconsistent_parameters
2 <--upload_ole
3 <--OTHERS
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = v_alsm_filename
i_begin_col = 1
i_begin_row = 1
i_end_col = 36
i_end_row = 65536
TABLES
intern = it_data1
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.
12-20-2007 2:06 PM
hi
good
pls check this links,hope these would help you to solve your problem
http://www.sap-img.com/abap/upload-direct-excel.htm
thanks
mrutyun^
12-20-2007 2:36 PM
Hi,
Function Module: ALSM_EXCEL_TO_INTERNAL_TABLE is used to upload Excel sheet. It uploads only one sheet, because Your excel spreadsheet can not contain more than one sheet to be used.
sample code:
[code]REPORT ZDBLV_UPLOAD_EXCEL_TEST.
data: begin of itab occurs 0,
name(20) type c,
addre(20) type c,
end of itab.
dATA : ITAB1 LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
DATA : B1 TYPE I VALUE 1,
C1 TYPE I VALUE 1,
B2 TYPE I VALUE 100,
C2 TYPE I VALUE 9999.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = 'C:\test.xls'
I_BEGIN_COL = B1
I_BEGIN_ROW = C1
I_END_COL = B2
I_END_ROW = C2
TABLES
INTERN = itab1
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.
loop at itab1.
write:/ itab1.
Endloop. [\code]
Best Regards,
Rajesh.
Please reward points if found helpful.