Google Search - Blog...........

ABAP - Downloading All Custom Reports From The Server Using FM GUI_DOWNLOAD.

*--------------------------------------------------------*
* This simple program will give you a brief idea how to download
* a bunch of custom reports to your desktop
*--------------------------------------------------------*

REPORT ztest.


parameters: p_file type rlgrap-filename.

DATA: it_data TYPE TABLE OF string WITH HEADER LINE,
prog TYPE c LENGTH 30,
itab TYPE TABLE OF string,
v_lines TYPE i.

TYPES: BEGIN OF ty_name,
objname TYPE tadir-obj_name,
END OF ty_name.

DATA: it_name TYPE TABLE OF ty_name WITH HEADER LINE.

*at selection screen on value-request for p_file.

start-of-selection.

SELECT obj_name FROM tadir INTO TABLE it_name
WHERE object = 'PROG'
AND obj_name LIKE 'Z%'.

LOOP AT it_name.
prog = it_name-objname.
READ REPORT prog INTO itab.

describe table itab lines v_lines.

IF sy-subrc = 0.

*---this is to identify the program from another with this gap

APPEND LINES OF itab FROM 1 TO v_lines TO it_data.
append '*************************************************************' to it_data.
do 3 times.
append '' to it_data.
enddo.
REFRESH itab.
clear v_lines.
ENDIF.
ENDLOOP.

data: l_file type string.

l_file = p_file.

CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_file

tables
data_tab = it_data .

No comments:

Post a Comment