안녕하세요..
인터넷에 돌아다니다가 레포트용 프로그램을 다운로드 할 수 있게 해주는 프로그램을 발견했네요.
스크린은 비록 안되지만 단순히 레포트 프로그램은 다운로드 해줍니다.(Include 포함)
아주 심플하니 받아서 유용하게 사용하세요..
*&---------------------------------------------------------------------*
*& Report Z_PRGRAM_DOWN
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT z_prgram_down
LINE-SIZE 80
LINE-COUNT 64
MESSAGE-ID zz
NO STANDARD PAGE HEADING.
*----------------------------------------------------------------------*
* Tables *
*----------------------------------------------------------------------*
TABLES : tadir.
*----------------------------------------------------------------------*
* Types *
*----------------------------------------------------------------------*
TYPES: BEGIN OF t_type,
line(72),
END OF t_type,
BEGIN OF t_prog,
obj_name TYPE tadir-obj_name,
END OF t_prog.
*----------------------------------------------------------------------*
* Internal Tables *
*----------------------------------------------------------------------*
**--Internal table to hold code
DATA: it_code TYPE TABLE OF t_type,
wa_code TYPE t_type,
**--Internal table to hold the program names
it_obj TYPE TABLE OF t_type,
wa_obj TYPE t_type,
**--Internal table to hold the program that are not downloaded
it_prog TYPE TABLE OF t_prog,
wa_prog TYPE t_prog,
**--Internal table to hold the program that are downloaded
it_dwld TYPE TABLE OF t_prog,
wa_dwld TYPE t_prog.
*----------------------------------------------------------------------*
* Field Symbols *
*----------------------------------------------------------------------*
FIELD-SYMBOLS :
*----------------------------------------------------------------------*
* Constants *
*----------------------------------------------------------------------*
CONSTANTS : gc_ext(4) TYPE c VALUE '.txt', "File Extension
gc_sep TYPE c VALUE '', "Separator
gc_prog TYPE tadir-object VALUE 'PROG'. "Object Type
*----------------------------------------------------------------------*
* Selection Screen *
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS : s_obj FOR tadir-obj_name. "Object Name
PARAMETERS : p_path(200) VISIBLE LENGTH 10 OBLIGATORY. "Folder Path
SELECTION-SCREEN END OF BLOCK b1.
*----------------------------------------------------------------------*
* At selection-screen *
*----------------------------------------------------------------------*
AT SELECTION-SCREEN.
**--Validate Path
PERFORM validate_path.
*----------------------------------------------------------------------*
* Start Of Selection *
*----------------------------------------------------------------------*
START-OF-SELECTION.
**--Get Program Names
PERFORM fetch_prog_names.
**--Process Program Names Internal table
PERFORM process_itab.
*----------------------------------------------------------------------*
* End Of Selection *
*----------------------------------------------------------------------*
END-OF-SELECTION.
**--Display the list of programs that are not downloaded
PERFORM display_itab.
*&---------------------------------------------------------------------*
*& Form FETCH_PROG_NAMES
*&---------------------------------------------------------------------*
* Get Program Names
*----------------------------------------------------------------------*
FORM fetch_prog_names .
**--Get program names
CLEAR : it_obj[].
SELECT obj_name
FROM tadir
INTO TABLE it_obj
WHERE object EQ gc_prog
AND obj_name IN s_obj.
IF sy-subrc NE 0.
MESSAGE i000(zz) WITH 'No programs found'(001).
ENDIF.
ENDFORM. " FETCH_PROG_NAMES
*&---------------------------------------------------------------------*
*& Form PROCESS_ITAB
*&---------------------------------------------------------------------*
* Prepare programs to download
*----------------------------------------------------------------------*
FORM process_itab .
DATA: lv_filename TYPE string.
LOOP AT it_obj INTO wa_obj.
CLEAR : it_code[].
ASSIGN wa_obj-line TO
lv_filename = wa_obj-line.
TRY.
**--Get the code of the program into internal table
READ REPORT
IF sy-subrc = 0.
CONCATENATE p_path gc_sep lv_filename gc_ext INTO lv_filename.
CONDENSE lv_filename NO-GAPS.
**--Download code to given path
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = lv_filename
filetype = 'ASC'
TABLES
data_tab = it_code
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
**--Unable to download program
wa_prog-obj_name = wa_obj-line.
APPEND wa_prog TO it_prog.
CLEAR wa_prog.
ELSE.
wa_dwld-obj_name = wa_obj-line.
APPEND wa_dwld TO it_dwld.
CLEAR wa_dwld.
ENDIF.
ENDIF.
CATCH cx_sy_read_src_line_too_long.
**--Unable to download program as line length > 72
wa_prog-obj_name = wa_obj-line.
APPEND wa_prog TO it_prog.
CLEAR wa_prog.
ENDTRY.
ENDLOOP.
ENDFORM. " PROCESS_ITAB
*&---------------------------------------------------------------------*
*& Form VALIDATE_PATH
*&---------------------------------------------------------------------*
* Validate Directory Path
*----------------------------------------------------------------------*
FORM validate_path .
DATA: lv_exist TYPE c,
lv_isdir TYPE c.
CALL FUNCTION 'TMP_GUI_GET_FILE_EXIST'
EXPORTING
fname = p_path
IMPORTING
exist = lv_exist
isdir = lv_isdir
EXCEPTIONS
fileinfo_error = 1
OTHERS = 2.
IF sy-subrc NE 0 OR lv_exist IS INITIAL.
**--Directory does not exist
SET CURSOR FIELD 'P_PATH'.
MESSAGE e000(zz) WITH 'Invalid Directory Path'(002).
ELSE.
IF lv_isdir IS INITIAL.
**--Given Path is not a directory
SET CURSOR FIELD 'P_PATH'.
MESSAGE e000(zz) WITH 'Input Directory Path'(003).
ENDIF.
ENDIF.
ENDFORM. " VALIDATE_PATH
*&---------------------------------------------------------------------*
*& Form DISPLAY_ITAB
*&---------------------------------------------------------------------*
* Display Programs
*----------------------------------------------------------------------*
FORM display_itab .
LOOP AT it_dwld INTO wa_dwld.
AT FIRST.
WRITE :/ 'List of programs that are downloaded'(006)
COLOR COL_HEADING.
ENDAT.
WRITE :/4 wa_dwld-obj_name.
ENDLOOP.
SKIP 2.
LOOP AT it_prog INTO wa_prog.
AT FIRST.
WRITE:/ 'List of programs that are not downloaded'(005)
COLOR COL_HEADING.
ENDAT.
WRITE :/4 wa_prog-obj_name.
ENDLOOP.
ENDFORM. " DISPLAY_ITAB
이 소스...뭔가 부족하죠?
긁어다 active 시키려면 에러 두두둑 뜨니까...^^