Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function Module to write internal table to Application server file

Former Member
0 Likes
2,873

Hi,

Is there any function module to write an internal table to <b>Application Server file</b>?

Regards,

Madhu

8 REPLIES 8
Read only

Former Member
0 Likes
1,176

Hi

You can try FM WS_DOWNLOAD to download an internal table to Application server. You may also try WS_EXCEL to download internal table to an excel file.

Please assign points if its helpful.

Thanx

Read only

Former Member
0 Likes
1,176

Hi,

There is no direct function module.

You will have to use OPEN DATASET statement.

Regards,

Shashank

Read only

Former Member
0 Likes
1,176

Hi,

U need to write a below program :

open dataset <dataset name> for output in text mode encoding default.

loop at itab.

transfer itab to <dataset name>.

endloop.

close dataset <dataset name>.

Sreedhar

Read only

Former Member
0 Likes
1,176

Hi Bhat,

You can use Open Dataset Statement in tOutput Mode and then Use Transfer Statement to Write the Datas into the Application Server.

Prashanth

Read only

Former Member
0 Likes
1,176

HI Madhu,

There is no such Function modules to pass the data from Internal table to Appliation server, you need to use the Datasets to pass the data.

open dataset <<b>dataset name</b>> for output in text mode encoding default.

loop at itab.
<b>transfer itab to <dataset name>.</b>
endloop.

close dataset <dataset name>.

but the other way, you can use a Function module to get the data from the Application server to internal table

Thanks

Sudheer

Read only

0 Likes
1,176

<b>

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.

</b>

Read only

Former Member
0 Likes
1,176

Hi,

There is no such Function module to pass the data from Internal table to Appliation server, you have to use the Datasets statement as follows-

u can press F1 n see the various other options,

open dataset <dataset name> for output in text mode.

loop at itab.

transfer itab to <dataset name>.

endloop.

Hope this helps,

Regards,

Seema.

close dataset <dataset name>.

Read only

Former Member
0 Likes
1,176

hi,

there are some upload & download function modules,

UPLOAD

WS_UPLOAD

GUI_UPLOAD

DOWNLOAD

WS_DOWNLOAD

GUI_DOWNLOAD

check out,

best of luck,

regards,

kcc