06-15-2006 10:18 AM
hi everyone,
i am moving the ontents fromthe database to the internal table..the results of the internal table has to be sent to the particular directory...how can i perform this...help me out plz....
06-15-2006 10:24 AM
If it is to application server the you can use
OPEN DATASET dsn FOR OUTPUT.
LOOP AT ITAB.
TRANSFER ITAB TO DSN.
ENDLOOP.
CLOSE DSN.
If you want to transfer data to your desktop then you can make use of Function module
GUI_DOWNLOAD, or WS_DOWNLOAD.
RGDS
TM.
06-15-2006 10:21 AM
06-15-2006 10:21 AM
If the Directory is on Application server, then use
open dataset/transfer /Close dataset
If the directory is on the presentation server, you can use the GUI_DOWNLOAD Function Module.
Regards,
ravi
06-15-2006 10:23 AM
Hi,
If you have to send the record to a directory on the presentation server you can use the FM 'GUI_DOWNLOAD'.Pass the internal table to the FM and collect the record in any directory
06-15-2006 10:23 AM
If the data has to be save on your desktop us the method GUI_DOWNLOAD of the class, CL_GUI_FRONTEND_SERVICES
If you are saving it on the app server,
then you will have to use
OPEN DATASET
TRANSFER
CLOSE DATASET.
Sample code
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3c8c358411d1829f0000e829fbfe/frameset.htm
Regards,
Ravi
06-15-2006 10:24 AM
If it is to application server the you can use
OPEN DATASET dsn FOR OUTPUT.
LOOP AT ITAB.
TRANSFER ITAB TO DSN.
ENDLOOP.
CLOSE DSN.
If you want to transfer data to your desktop then you can make use of Function module
GUI_DOWNLOAD, or WS_DOWNLOAD.
RGDS
TM.
06-15-2006 10:24 AM
Hi,
If u want to download to ur presentation server:
use GUI_DOWNLOAD .
If u want to send to application server u have to write code for transfering file.
: <b>example</b>
DATA FNAME(60) VALUE 'myfile'.
TYPES: BEGIN OF LINE,
COL1 TYPE I,
COL2 TYPE I,
END OF LINE.
TYPES ITAB TYPE LINE OCCURS 10.
DATA: LIN TYPE LINE,
TAB TYPE ITAB.
DO 5 TIMES.
LIN-COL1 = SY-INDEX.
LIN-COL2 = SY-INDEX ** 2.
APPEND LIN TO TAB.
ENDDO.
OPEN DATASET FNAME FOR OUTPUT.
LOOP AT TAB INTO LIN.
TRANSFER LIN TO FNAME.
ENDLOOP.
CLOSE DATASET FNAME.
OPEN DATASET FNAME FOR INPUT.
DO.
READ DATASET FNAME INTO LIN.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
WRITE: / LIN-COL1, LIN-COL2.
ENDDO.
CLOSE DATASET FNAME.
rgds,
latheesh
Message was edited by: Latheesh Kaduthara
06-15-2006 10:27 AM
Hi,
Use GUI_DOWNLOAD
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\File.txt'
TABLES
DATA_TAB = INTERNAL_TAB
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6.
If you want to download the information to a desktop directory, then use function module GUI_DOWNLOAD with your internal table. If you want to download to the server directory, then use the following logic.
OPEN DATASET v_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT itab.
TRANSFER itab TO v_file LENGTH reclen.
ENDLOOP.
CLOSE DATASET v_file.
Kindly close the thread if query resolved and reward if helpful.
Rgds,