Application Development 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 and write data from Application server

Former Member
0 Kudos
523

Hi,

I want to know how to read and write data into application server.

I am new to this and i want a simple code for reading datas from application server and also write datas into application server.

Please help me its very urgent.

Thanks in advance.

Ramya

3 REPLIES 3

Former Member
0 Kudos
169

Incorrect...

Message was edited by:

Rob Burbank

0 Kudos
169

Hi Rob,

What is incorrect? Culd u plz explain??

Former Member
0 Kudos
169

Ramya,

check this sample code...

this is for uploading data into apllicn server

OPEN DATASET <file name> FOR {OUTPUT/INPUT/APPENDING}

IN {TEXT/BINARY} MODE

chk this program..

DATA: i_file like rlgrap-filename value '/usr/sap/tmp/file.txt'.

OPEN DATASET i_file FOR INPUT IN TEXT MODE.

IF sy-subrc NE 0.

MESSAGE e999(za) WITH 'Error opening file' i_file.

ENDIF.

DO.

  • Reads each line of file individually

READ DATASET i_file INTO wa_datatab.

  • Perform processing here

  • .....

ENDDO.

Downloading files to SAP(Application Server)

  • Download internal table to Application server file(Unix)

DATA: e_file like rlgrap-filename value '/usr/sap/tmp/file.txt'.

open dataset e_file for output in text mode.

lOOP AT it_datatab......

transfer it_datatab to e_file.

ENDLOOP.

close dataset e_file.

~~Guduri