‎2008 Jul 01 1:05 PM
Hi,
I am using Open Dataset, Read Dataset etc to Upload XLS file from Applicaton Server. I am just getting junk values in the inernal table. Even if we see the XLS file from AL11, we are seeing junk values only.
But the BASIS Team says, the file is present properly in the Application Server.
Can you please let me know how to upload XLS file from Application Server to my Internal Table.
Is there any FM to do this. There are some FM to move file from Presentation Server to Internal Table, but I want to move it from Application Server.
Thanks and Regards,
Ishaq.
‎2008 Jul 01 1:08 PM
Hi,
You can use The Finction Module
ALSM_EXCEL_TO_INTERNAL_TABLE.
Regards,
Sujit
‎2008 Jul 01 1:08 PM
‎2008 Jul 01 1:11 PM
Hi Ishaq,
Compare this Code with your Code....
IF file_type = 'BIN'.
OPEN DATASET wf_filename FOR INPUT IN BINARY MODE.
ELSE.
OPEN DATASET wf_filename FOR INPUT IN TEXT MODE.
ENDIF.
IF sy-subrc NE 0.
MESSAGE i000(su) WITH text-t02.
LEAVE LIST-PROCESSING.
ENDIF.
DO.
CLEAR : wf_row.
READ DATASET wf_filename INTO wf_row.
IF sy-subrc NE 0.
IF wa_file-file_delimiter EQ 'TAB'.
Tab delimited File
SPLIT wf_row AT co_tab INTO TABLE tb_data.
LOOP AT tb_fieldcat INTO wa_fieldcat.
ASSIGN COMPONENT wa_fieldcat-fieldname
OF STRUCTURE <dyn_wa> TO <fs>.
CLEAR wa_data.
READ TABLE tb_data INTO wa_data INDEX sy-tabix.
<fs> = wa_data-data.
ENDLOOP.
ELSEIF wa_file-file_delimiter EQ ';'.
; delimited File
SPLIT wf_row AT ';' INTO TABLE tb_data.
LOOP AT tb_fieldcat INTO wa_fieldcat.
ASSIGN COMPONENT wa_fieldcat-fieldname
OF STRUCTURE <dyn_wa> TO <fs>.
CLEAR wa_data.
READ TABLE tb_data INTO wa_data INDEX sy-tabix.
<fs> = wa_data-data.
ENDLOOP.
ELSEIF wa_file-file_delimiter EQ 'ND'.
ND - No delimiter (Continuous)
<dyn_wa> = wf_row.
ELSE.
MESSAGE i000(su) WITH text-t01.
LEAVE LIST-PROCESSING.
ENDIF.
‎2008 Jul 01 1:38 PM