2008 Dec 31 8:47 AM
Hi,
I want to upload excel file from presentation server and application server to internaltable.
for Presentation server i used fm like 'ALSM_EXCEL_TO_INTERNAL_TABLE'.
How can i read the Excel data from application server to internal table.
please provide me sample code.
Regards,
Suresh.
2008 Dec 31 8:49 AM
Hi,
I want to upload excel file from presentation server and application server to internaltable.
for Presentation server i used fm like 'ALSM_EXCEL_TO_INTERNAL_TABLE'.
How can i read the Excel data from application server to internal table.
please provide me sample code.
Regards,
Suresh.
2008 Dec 31 8:49 AM
2008 Dec 31 8:51 AM
You could use OPEN DATASET, READ DATASET for reading file from your app server.
2008 Dec 31 8:53 AM
Hi Suresh,
Use this demo:-
DATA: BEGIN OF it_final OCCURS 0,
matnr(10) TYPE c,
werks(10) TYPE c,
usage(10) TYPE c,
data(08) TYPE c,
END OF it_final.
DATA wa_final LIKE LINE OF it_final.
DATA: v_excel_string(2000) TYPE c,
v_file LIKE v_excel_string VALUE
'D:\TEST1.CSV',
delimiter TYPE c VALUE ' '.
OPEN DATASET v_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
"error message
ELSE.
WHILE ( sy-subrc EQ 0 ).
READ DATASET v_file INTO wa_final.
IF NOT wa_final IS INITIAL.
APPEND wa_final TO it_final.
ENDIF.
CLEAR wa_final.
ENDWHILE.
ENDIF.
CLOSE DATASET v_file.
LOOP AT IT_FINAL into WA_FINAL.
WRITE:/ WA_FINAL-MATNR, WA_FINAL-WERKS, WA_FINAL-USAGE, WA_FINAL-DATA.
ENDLOOP.
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir
2008 Dec 31 8:54 AM
2008 Dec 31 8:57 AM
hi,
try this code
OPEN DATASET v_file FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.
WHILE sy-subrc = 0.
READ DATASET v_file INTO lt_data.
SPLIT l_data AT tab INTO: wa_data-doc_date
wa_data-doc_type
wa_data-co_code
wa_data-cost_cen
wa_data-debit_gl
wa_data-desc1
wa_data-deb_amt
wa_data-cre_gl
wa_data-desc2
wa_data-cre_amt
wa_data-curr.
IF NOT wa_data IS INITIAL.
APPEND wa_data TO it_data.
CLEAR wa_data.
ENDIF.
endwhile.
CLOSE DATASET v_file.
thanks
2008 Dec 31 9:31 AM
Hi ,
The file formats in the application servers is mainly in Text and Binary modes.
Use the Open Data seta and the resepctive mode( binary/text mode) in the syntax and then using Read Data set commands you can transfer the data to the internal tables.Then You can finally use a close Data set command to close the file.
Regards,
Radhika
2008 Dec 31 9:35 AM
you can't upload Xl data from applications server..........
lot of experts are telling this ,, still this q is posting on SCN?
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |