Skip to Content
0
Former Member
Sep 08, 2009 at 12:36 PM

reading/writing from net storage machine

54 Views

Hi all,

I'm having some problems with a simple requirements: I have to write a report that IN BACKGROUND read a file from a network shared directory folder, do some processing and write some output in a file in the same network folder. I see that I have to use DATASET operation .. this is is my code:

DATA dset_in(256) TYPE c VALUE '\\strg_machine_name\folder\input_file'.
DATA dset_out(256) TYPE c VALUE '\\strg_machine_name\folder\output_file'.
DATA record(80) TYPE c.

" input
OPEN DATASET dset_in FOR INPUT IN TEXT MODE ENCODING DEFAULT .
DO.
  READ DATASET dset INTO RECORD.
  IF sy-subrc NE 0.
    EXIT.
  ELSE.
      " do some processing filling it_table
  ENDIF.
ENDDO.

" output
OPEN DATASET dset_out FOR OUTPUT IN TEXT MODE ENCODING DEFAULT .
LOOP AT it_table INTO record.
   TRANSFER record TO dset_out.
ENDLOOP.

I cannot understand where is my mistake. Also, can I try a piece of code like this from GUI debugging with se38? or it just work in background mode? (I tried both).

Thanks to anyone can help me

Gabriele