on 01-10-2007 9:18 AM
hi all,
i need to upload a file from the application server which hold the sales order number, fetch certain details on it and download it to the presentation server.
Presentation server will be the file on our desktop..
explain me about the application server and the usage of it..
i also need to validate the file paths of both the servers..
thanx in advance
regards,
Priya
Hi Hamsa,
here a short example to write/read from to application Server
and to download the File.
You have to set DATEI_A, DATEI_PC and ITAB/ITAB1 as you like
TABLES: MARA.
*
DATA: DATEI_A(30) TYPE C VALUE '/transfer/sap/matnr.txt'.
DATA: DATEI_PC TYPE STRING VALUE 'D:\MATNR.TXT'.
*
DATA: BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
END OF ITAB.
*
DATA: BEGIN OF ITAB1 OCCURS 0,
MATNR LIKE MARA-MATNR,
END OF ITAB1.
*
START-OF-SELECTION.
*
SELECT MATNR INTO TABLE ITAB FROM MARA UP TO 10 ROWS.
*
PERFORM DATEI_AUSGEBEN.
PERFORM DATEI_EINLESEN.
PERFORM DATEI_DOWNLOAD.
*
************************************************************************
FORM DATEI_AUSGEBEN.
*
OPEN DATASET DATEI_A FOR OUTPUT IN TEXT MODE.
IF SY-SUBRC NE 0. MESSAGE E001. STOP. ENDIF.
*
LOOP AT ITAB.
*
TRANSFER ITAB TO DATEI_A.
*
ENDLOOP.
*
CLOSE DATASET DATEI_A.
IF SY-SUBRC NE 0. MESSAGE E001. STOP. ENDIF.
*
ENDFORM. "DATEI_AUSGEBEN
************************************************************************
FORM DATEI_EINLESEN.
*
*
OPEN DATASET DATEI_A FOR INPUT IN TEXT MODE.
IF SY-SUBRC NE 0. MESSAGE E001. STOP. ENDIF.
*
DO.
*
READ DATASET DATEI_A INTO ITAB1.
*
IF SY-SUBRC <> 0. EXIT. ENDIF.
*
APPEND ITAB1.
*
ENDDO.
*
CLOSE DATASET DATEI_A.
*
IF SY-SUBRC NE 0. MESSAGE E001. STOP. ENDIF.
*
LOOP AT ITAB1. WRITE: / ITAB1-MATNR. ENDLOOP.
*
ENDFORM. "DATEI_EINLESEN
************************************************************************
FORM DATEI_DOWNLOAD.
Datei downloaden
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
FILENAME = DATEI_PC
FILETYPE = 'ASC'
CHANGING
DATA_TAB = ITAB1[]
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
NOT_SUPPORTED_BY_GUI = 22
ERROR_NO_GUI = 23
OTHERS = 24.
*
IF SY-SUBRC NE 0. MESSAGE E001. STOP. ENDIF.
*
ENDFORM. "DATEI_DOWNLOAD
************************************************************************
Regards, Dieter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To read any file from your application server place the file in AL11 and use the Open and close Dataset calls in ABAP.
To read the files from the Presentation server use the OO way of calling the method to Upload or Download.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use CL_GUI_FRONTEND_SERVICES class...
Puru
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Application server is the place where some legacy files are uploaded into the Oracle system and placed in certain directories. You can use AL11 to view the files.
To download from this server, use the Open...dataset, read..dataset and store in an internal table.
Presentation server is your desktop. You can use GUI_DOWNLOAD or WS_DOWNLOAD to download this file from an internal table onto your desktop.
Refer ABAP help for open & read dataset.
Regards
Subramanian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.