‎2008 Mar 26 8:07 AM
Hi,
All
can we transfer excel sheet in application serfer,if yes how.
i have to transer excel sheet from dsktop to application server.
and after that i have to display that data.
‎2008 Mar 26 8:16 AM
Hi,
If you want to transfer file from desktop to application server use the Tcode CG3Z.Once it is transfered to application server you can see that file from the tcode AL11 by using the path of the file.
Thanks,
shyla
‎2008 Mar 26 8:20 AM
Hi,
Use OpenDatset command.
E_FILE IS THE PATH IN YOUR APPLICATION SERVER.
DATA: E_FILE LIKE RLGRAP-FILENAME value '\\170.41.0.52\d$\usr\sap\trans\scm\test.xls'.
OPEN DATASET efile FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT itab.
TRANSFER itab-fld TO E_FILE.
ENDLOOP.Regards,
Ballack.
Reward Points if helpful.
‎2008 Mar 26 8:21 AM
HI,
Data : filename(250) type c value '/usr/sap/tmp/ASHOKTEST11.XLS'.
start-of-selection.
open dataset filename for input in text mode encoding default.
do.
if sy-subrc <> 0.
exit.
endif.
read dataset filename into itab.
append itab.
enddo.
loop at itab.
write: itab-lifnr.
endloop.
close dataset filename.
‎2008 Mar 26 8:43 AM
Hi ,
Data in the application server stored as a DATASETS .
-
See this sample code where i had moved data from EXCEL SHEET to INTERNAL TABLE to APPLICATION server
Program:
parameter: file_nm type localfile.
types : begin of it_tab1,
f1(20),
f2(40),
f3(20),
end of it_tab1.
data : it_tab type table of ALSMEX_TABLINE with header line,
file type rlgrap-filename.
data : it_tab2 type it_tab1 occurs 1,
wa_tab2 type it_tab1,
w_message(100) TYPE c.
at selection-screen on value-request for file_nm.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = 'X'
MASK = ' '
CHANGING
file_name = file_nm
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
.
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
start-of-selection.
refresh it_tab2[].clear wa_tab2.
file = file_nm.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '10'
i_end_row = '35'
tables
intern = it_tab
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 it_tab.
case it_tab-col.
when '002'.
wa_tab2-f1 = it_tab-value.
when '004'.
wa_tab2-f2 = it_tab-value.
when '008'.
wa_tab2-f3 = it_tab-value.
endcase.
at end of row.
append wa_tab2 to it_tab2.
clear wa_tab2.
endat.
endloop.
data : p_file TYPE rlgrap-filename value 'TEST3.txt'.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
Display error messages if any.
IF sy-subrc NE 0.
MESSAGE e001(zsd_mes).
EXIT.
ELSE.
*---Data is downloaded to the application server file path
LOOP AT it_tab2 INTO wa_tab2.
TRANSFER wa_tab2 TO p_file.
ENDLOOP.
ENDIF.
*--Close the Application server file (Mandatory).
CLOSE DATASET p_file.
loop at it_tab2 into wa_tab2.
write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
endloop.
Reward if useful
Thanks
Jagadeesh.G
‎2008 Mar 26 8:51 AM
hi,
how to upload--
Try to run the Transaction CG3Z.
to upload the file from local pc to application server.
Anver -