*& CTS 없이 프로그램 소스를 조정합니다.
*& 반영시에는 절대 주의를 요하니 사용여부를 신중하게 생각하시고
*& 작업하시기 바랍니다.
REPORT Z_MODIFY_PRG_SOURCE.
DATA: itab TYPE STANDARD TABLE OF string,
mess TYPE string,
lin TYPE i,
wrd TYPE string,
dir TYPE trdir.
PARAMETERS: program LIKE trdir-name OBLIGATORY,
dynum LIKE d020s-dnum.
PARAMETERS: p_scrn AS CHECKBOX.
START-OF-SELECTION.
IF p_scrn = 'X' AND dynum IS INITIAL.
MESSAGE s000(38) WITH '스크린 번호를 입력하십시오.'.
STOP.
ENDIF.
IF p_scrn = space.
READ REPORT program INTO itab.
IF sy-subrc <> 0.
MESSAGE s000(38) WITH '프로그램 없는데요?'.
STOP.
ENDIF.
EDITOR-CALL FOR itab.
CHECK sy-ucomm = 'WB_SAVE'.
INSERT REPORT program FROM itab STATE 'A'.
ELSE.
DATA: dynp_header LIKE d020s,
dynp_fields LIKE d021s OCCURS 0 WITH HEADER LINE,
dynp_logic LIKE d022s OCCURS 0 WITH HEADER LINE,
dynp_matchc LIKE d023s OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF dynproname,
prog LIKE d020s-prog,
dnum LIKE d020s-dnum,
END OF dynproname.
dynproname-prog = program.
dynproname-dnum = dynum.
IMPORT DYNPRO dynp_header dynp_fields dynp_logic dynp_matchc
ID dynproname.
itab[] = dynp_logic[].
EDITOR-CALL FOR itab.
CHECK sy-ucomm = 'WB_SAVE'.
REFRESH dynp_logic.
dynp_logic[] = itab[].
EXPORT DYNPRO dynp_header dynp_fields dynp_logic dynp_matchc
ID dynproname.
ENDIF.
TABLES : trdir.
trdir-name = program.
READ TABLE trdir.
IF sy-subrc <> 0.
MESSAGE s000(38) WITH '프로그램 없는데요?'.
STOP.
ENDIF.
DATA: x_inclname TYPE trdir-name,
BEGIN OF maintab_wa,
name TYPE trdir-name,
END OF maintab_wa,
maintab LIKE TABLE OF maintab_wa,
i_rahmen TYPE trdir-name,
lines LIKE sy-index.
DATA: gen_message(250),
gen_include TYPE trdir-name,
gen_line TYPE sy-index,
gen_offset TYPE sy-index,
gen_word(30).
DATA: l_wb_request_ch TYPE REF TO cl_wb_request.
DATA: l_wb_request_s TYPE REF TO cl_wb_request.
DATA: l_wb_request_e TYPE REF TO cl_wb_request.
DATA: l_wb_request_c TYPE REF TO cl_wb_request.
DATA: l_program_state TYPE REF TO cl_wb_program_state.
DATA: l_program_state_corr TYPE REF TO cl_wb_program_state,
l_object_name TYPE seu_objkey,
l_object_name_check TYPE seu_objkey,
l_object_type TYPE seu_objtyp,
l_object_type_check TYPE seu_objtyp,
l_current_operation TYPE seu_action.
DATA: error_message_tab TYPE rsfb_source.
x_inclname = program.
CLEAR maintab.
CLEAR lines.
IF trdir-subc = 'I'. "Include-Programm
CALL FUNCTION 'RS_GET_MAINPROGRAMS'
EXPORTING
dialog = 'X'
name = x_inclname
multiple_select = 'X'
IMPORTING
number_of_mainprograms = lines
TABLES
mainprograms = maintab
EXCEPTIONS
cancelled = 01.
IF sy-subrc NE 0. EXIT. ENDIF.
ELSE.
maintab_wa = program.
APPEND maintab_wa TO maintab.
lines = 1.
ENDIF.
LOOP AT maintab INTO maintab_wa.
GENERATE REPORT maintab_wa-name WITH PRECOMPILED HEADERS
MESSAGE gen_message
INCLUDE gen_include
LINE gen_line
OFFSET gen_offset
WORD gen_word.
IF sy-subrc = 0.
"Generierung OK.
IF lines > 1 AND lines = sy-tabix.
MESSAGE s092(ed).
* Die Programme wurden erfolgreich generiert
ELSEIF lines = 1.
* IF ABAP_EDITOR->EDIT-APP_DISP NE SPACE.
MESSAGE s091(ed) WITH maintab_wa-name.
* Programm $ wurde erfolgreich generiert
* ENDIF.
ENDIF.
ELSEIF sy-subrc = 04 OR "Syntaxfehler
sy-subrc = 08.
MESSAGE s050(ed) WITH maintab_wa-name.
ENDIF.
ENDLOOP.
유용하게 사용하겠습니다. 감사합니다^^