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

application server to internal table

Former Member
0 Likes
553

Hi All.

i have to download dataa from application serer to internal table ,as the program has to be run in background we cannot use function module download.what to do in this case.

4 REPLIES 4
Read only

Former Member
0 Likes
534

hi Abhishek,

You can OPEN DATASET, READ DATASET, CLOSE DATASET to download data from application server to internal table.

Thanks,

Arun

Read only

Former Member
0 Likes
534

Hi,

OPEN DATASET FNAME FOR INPUT IN TEXT MODE ENCODING DEFAULT.

IF sy-subrc NE 0.

MESSAGE s107(yaero_ps) DISPLAY LIKE c_e.

message e008.

ELSE.

DO.

CLEAR: l_string.

READ DATASET FNAME INTO l_string LENGTH l_wllength.

IF sy-subrc NE 0.

EXIT.

ELSE.

SPLIT l_string AT con_tab INTO wa_data_file-ebeln

wa_data_file-ebelp.

APPEND wa_data_file TO fp_flatfile.

ENDIF.

ENDDO.

CLOSE DATASET FNAME.

and to get the file name use FM

CALL FUNCTION 'FILE_GET_NAME'

EXPORTING

LOGICAL_FILENAME = FP_FILE

OPERATING_SYSTEM = SY-OPSYS

IMPORTING

FILE_NAME = FNAME

EXCEPTIONS

FILE_NOT_FOUND = 1

OTHERS = 2.

Regards,

KIRAN

Read only

venkat_o
Active Contributor
0 Likes
534

Hi Abhishek Kumar, Check the following program to interact with application server. How to send data to Application server and how to get from there . comments are included wherever those are neeeded.

REPORT  ovtest.
DATA:
      fname(60) VALUE 'myfile',
      num TYPE i.

OPEN DATASET fname FOR OUTPUT.
"opens the file for writing(OUTPUT)
DO 10 TIMES.
  num = num + 1.
  TRANSFER num TO fname.
  "This statement passes the content of data object(num) to the file specified in fname.
ENDDO.
CLOSE DATASET fname.
"This statement closes the file specified in fname.

OPEN DATASET fname FOR INPUT.
"The addition FOR INPUT opens the file for reading.
DO.
  READ DATASET fname INTO num.
  "This statement exports data from the file specified in fname into the data object num
  IF sy-subrc <> 0.
    EXIT.
  ENDIF.
  WRITE / num.
ENDDO.
Once it is executed in SE38 go to AL11 to check the file specified in the program . I hope that it helps you . Regards, Venkat.O

Read only

Former Member
0 Likes
534

Hi,

Files on application server are sequential files. Three steps are involved in sequential file handling

OPEN

PROCESS

CLOSE

Here processing is reading a file or writing on to a file.

syntax:

Open dataset filename for input in text mode.

Do.

read dataset filename into workarea.

if sy-subrc <> 0.

exit.

else.

append workarea to itab.

endif.

enddo.

close dataset filename.

The function modules ws_download and gui_download ws_upload, gui_upload are used to process the presentation server files.

Reward.