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: 

How to save the data of ABAP report into a notepad in desktop location???

Former Member
0 Kudos

HI all,

Can any one tell me how to transfer the data of ABAP report into a Notepad.

Actually I have to schedule a ABAP report in background on daily basis and I want to transfer the

whole record into Notepad.

If any program is available for this..please clearify the relevent code for transferring.

Thanks

Rajeev

1 ACCEPTED SOLUTION

Former Member
0 Kudos

declare a character type internal table.

now move your data from it_data ( internal table with data ) into table itab.

since you are running this report in background, you cannot save it to the desktop. Instead give any app server location

data: itab(400) occurs 0 with header line. 
field-symbols: <fs1> type any.
data: gv_file type rlgrap-filename default 'TEST.TXT'.
data: gv_filepath type rlgrap-filename default <path>.
LOOP AT it_data.
    DO 100 TIMES.
      ASSIGN COMPONENT sy-index OF STRUCTURE it_data TO <fs1>.
      IF sy-subrc = 0.
        CONCATENATE itab <fs1> INTO itab SEPARATED BY ' '.
      ELSE.
        EXIT.
      ENDIF.
    ENDDO.
    SHIFT itab LEFT DELETING LEADING ' '.
    APPEND itab.
    CLEAR itab.
  ENDLOOP.

  concatenate gv_filepath '/' gv_file into gv_file.
  OPEN DATASET gv_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
  IF sy-subrc = 0.
    LOOP AT itab.
      TRANSFER itab TO gv_file.
    ENDLOOP.
    CLOSE DATASET gv_file.
  ENDIF.

3 REPLIES 3

Former Member
0 Kudos

declare a character type internal table.

now move your data from it_data ( internal table with data ) into table itab.

since you are running this report in background, you cannot save it to the desktop. Instead give any app server location

data: itab(400) occurs 0 with header line. 
field-symbols: <fs1> type any.
data: gv_file type rlgrap-filename default 'TEST.TXT'.
data: gv_filepath type rlgrap-filename default <path>.
LOOP AT it_data.
    DO 100 TIMES.
      ASSIGN COMPONENT sy-index OF STRUCTURE it_data TO <fs1>.
      IF sy-subrc = 0.
        CONCATENATE itab <fs1> INTO itab SEPARATED BY ' '.
      ELSE.
        EXIT.
      ENDIF.
    ENDDO.
    SHIFT itab LEFT DELETING LEADING ' '.
    APPEND itab.
    CLEAR itab.
  ENDLOOP.

  concatenate gv_filepath '/' gv_file into gv_file.
  OPEN DATASET gv_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
  IF sy-subrc = 0.
    LOOP AT itab.
      TRANSFER itab TO gv_file.
    ENDLOOP.
    CLOSE DATASET gv_file.
  ENDIF.

0 Kudos

Hi,

Exactly I have also done like this only for one of my requirement.

Else, the another way is :

Send the output to the spool at run time.

Get the spool and save it on our required place

Rgds,

Ramani N

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Rajeev,

Actually I have to schedule a ABAP report in background on daily basis and I want to transfer the

whole record into Notepad.

I think you cannot put any file on your local directory in background. You have to use the option of transferring the file to the application server.

BR,

Suhas