‎2007 May 25 6:31 PM
can anyone please tell me how to put all the data in the internal table m_itab into the application server with the path specified as "/export/SAPtf/aiainc".
thanks in advance......
‎2007 May 25 6:37 PM
You need to use Open dataset command.
data : v_file(128) type c value '/export/SAPtf/aiainc'.
open dataset v_file for output in text mode .
loop at itab.
transfer itab data to v_file.
endloop.
close dataset v-file.
Reward Points if it is helpful
Thanks
Seshu
‎2007 May 25 6:33 PM
check this sample coding
REPORT test.
*--Internal table & Work area Declaration
DATA : t_data TYPE STANDARD TABLE OF t000,
wa_data TYPE t000.
DATA : w_message(100) TYPE c.
*--Application Server File path from user
PARAMETERS : p_file TYPE rlgrap-filename.
START-OF-SELECTION.
*--Get data into the Internal table t_data
SELECT * FROM t000 INTO TABLE t_data .
*--- Create the application server file path
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT MESSAGE w_message.
*--- Display error messages if any.
IF sy-subrc NE 0.
MESSAGE w_message TYPE 'E'.
EXIT.
ELSE.
*---Data is downloaded to the application server file path
LOOP AT t_data INTO wa_data.
TRANSFER wa_data TO p_file.
ENDLOOP.
ENDIF.
*--Close the Application server file (Mandatory).
CLOSE DATASET p_file.
IF sy-subrc NE 0.
MESSAGE 'Error closing the File' TYPE 'E'.
EXIT.
ELSEIF sy-subrc IS INITIAL.
WRITE : 'File saved in the location' , p_file.
ENDIF.
‎2007 May 25 6:37 PM
You need to use Open dataset command.
data : v_file(128) type c value '/export/SAPtf/aiainc'.
open dataset v_file for output in text mode .
loop at itab.
transfer itab data to v_file.
endloop.
close dataset v-file.
Reward Points if it is helpful
Thanks
Seshu
‎2007 May 25 6:37 PM
dsn = '/export/SAPtf/aiainc'
OPEN DATASET dsn IN TEXT MODE.
LOOP AT M_ITAB.
TRANSFER M_ITAB TO dsn.
ENDLOOP.
CLOSE DATASET.