Exercise 1: Reserving an Area for a Control
Prerequisites
You have created an executable program as a local object.
Procedure
-
Add the following lines to the source code of your main program:
START-OF-SELECTION SET SCREEN '100'.
Then create the screen with the following attributes:
Screen Type: Normal
Next Dynpro: 100
-
Edit the layout of your screen in the Screen Painter and mark an area for your custom control.
If you use the alphanumeric mode of the Screen Painter, follow these steps:
-
Place your cursor on a line of the screen and choose .
-
To select the bottom right corner of the area, you can either double-click the corresponding line and column, or choose the Mark End of CTRLpushbutton. The system displays a dialog box for the element attributes.
-
Enter the name MYCONTAINER1 and copy your settings.
If you use the graphical mode of the Screen Painter, follow these steps:
-
Choose the custom control icon (which you can recognize by the letter 'C') and mark an area on the screen.
-
Enter the name MYCONTAINER1 in the Name field. You can also define the name on the attributes dialog box that is displayed when you double-click the element you have created.
-
-
To be able to exit the screen after the program has started, add a pushbutton to your screen and determine the function code in the PAI module:
-
In the Layout editor of the Screen Painter, define a pushbutton with function code EXIT and place it on the screen.
-
In the element list, enter the name OK_CODE for the element of type OK.
-
Create PAI module user_command_0100 and use it to determine the function code of the pushbutton:
MODULE USER_COMMAND_0100 INPUT. CASE OK_CODE. WHEN 'EXIT'. LEAVE TO SCREEN 0. ENDCASE. ENDMODULE. " USER_COMMAND_0100 INPUT -
Declare OK_CODE as a global data field by double-clicking it and adding the following line to your main program:
DATA ok_code LIKE sy-ucomm.
-
-
Save your settings, and activate all your objects.
Check Your Work
When you start your program, the system displays your screen with one pushbutton. The container for the custom control is not displayed. If you click the pushbutton, the system returns you to your main program.

