SAP---ABAP

Monday, October 8, 2007




Protect Selection/Parameters


An easy way of making a standard reports selection/parameters to be read-only/protected. (like an option NO-INPUT).

You can add a "Module Protect Output." module with code to the program, where it sets the screen-input = 0 as required, and add the line "Module Protect Output." to the PBO, and it works fine, until you re-generate the code and
this line is removed (the PBO PAI in SE51 screen 1000) as known, this code is also re-generated and any changes made will be ineffective.

If you tried using one of the PBO generated module names, it will says its does not exist, so if you generate it with the code, and run the program it will tell you "Module PBO_REPORT is already defined as a OUTPUT module".

The purpose: To calculate and set up the parameters in INITIALIZATION. You want to show them to the user, and use them in SELECTs, use them as Headings, but you want to stop the user from changing some of them.


The solution is as follows :


AT SELECTION-SCREEN OUTPUT.
PERFORM protect.
.
.
.
FORM protect.
LOOP at SCREEN
CASE screen-name.
WHEN 'UNAME' OR 'UNUMB' OR 'DESCR'. screen-input = 0.
WHEN 'XNAME' OR 'XNUMB' OR 'DESCX'. screen-input = 0.
ENDCASE.
ENDLOOP.
ENDFORM.

No comments: