You are visitor number


View My Stats

Tuesday, October 7, 2008

Edit program in PROD / QA

I got this code 6 years ago from some site. I don't remember where I got this from, but it's really handy when you need to make small changes of ABAP Programs in PROD/QA. You won't need to make unnecessary transports thus you will also save CR numbers.

Just copy paste the next code, let's name it ZEDIT. Transport it and you will be able to change your programs in PROD/QA as many times as you like.

IMPORTANT NOTES:
1. This program can only change the program that is already exist in PROD/QA, so you will need to transport the program you'd like to change to PROD/QA.

2. To maintain the integrity between DEV and PROD/QA, change the program as you need in DEV. After it's successfully activated, run the ZEDIT program in PROD/QA, copy paste your whole program there, then try to execute your changed program again.

Enjoy!



REPORT ZEDIT .


* global data test data
DATA: BEGIN OF t_report OCCURS 9,
line(72),
END OF t_report.

* macro
define mac_check_uname.
*this program can only be used by you
check sy-uname = 'IT-VERA'.
end-of-definition.

* user interface
PARAMETERS: p_cprog LIKE sy-cprog.


* main program
START-OF-SELECTION.
mac_check_uname.
SELECT SINGLE name FROM trdir INTO p_cprog
WHERE name = p_cprog.
IF sy-subrc <> 0.
MESSAGE e000(zz) WITH 'Program name is not valid!'.
ENDIF.

READ REPORT p_cprog INTO t_report.
EDITOR-CALL FOR t_report. "display-mode title 'Test'.
* EDITOR-CALL FOR REPORT p_cprog.
* IF sy-ucomm = 'TTU'.
IF sy-ucomm = 'WB_SAVE'.
INSERT REPORT p_cprog FROM t_report.
IF sy-subrc = 0.
MESSAGE s000(zz) WITH 'Program is saved!'.
ENDIF.
ENDIF.
END-OF-SELECTION.