06-17-2009 4:06 PM
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
06-17-2009 4:20 PM
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.
06-17-2009 4:20 PM
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.
06-17-2009 4:31 PM
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
06-17-2009 4:32 PM
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