Since it is a screen designer, there must naturally be a drop-down list box. Here we will do it.
First, SE38 creates a program. SE51 pulls a text box control and sets the property of the drop-down box to Listbox with the name "VALUE:
Drag a text box and set it to read-only, as shown below:
The screen design page is as follows:
The code for the screen design attribute is as follows:
Process on value-REQUEST. defines the event triggered by calling F4 help or clicking this field.
Field value module setvalue. assign values to the drop-down list box.
In SE38, remember to enter the following code as the Key at the beginning of the program:
TYPE-POOLS: VRM. This is used to reference the drop-down list box.
Next, declare the variable, which corresponds to the control name.
DATA: VALUE (10) type c, "drop-down list
DESC (10) type c. "Description
START-OF-SELECTION.
Call screen 100. "load SCREEN
Load the MODULE in the drop-down list box:
Module setvalue input.
DATA: LV_NAME TYPE VRM_ID,
LT_LIST TYPE VRM_VALUES,
LW_VALUE like line of LT_LIST.
CLEAR: LT_LIST, LW_VALUE.
LV_NAME = 'value '.
"Read data table content to internal table
Select value into LW_VALUE-KEY FROM ZCODE_MSTR where fidname = 'LIST '.
LW_VALUE-TEXT = LW_VALUE-KEY.
APPEND LW_VALUE TO LT_LIST.
ENDSELECT.
Call function 'vrm _ SET_VALUES '"call function filling content
EXPORTING
ID = LV_NAME
VALUES = LT_LIST.
ENDMODULE. "SETVALUE INPUT
"Read the corresponding description based on the value of the drop-down box
Form getdesc.
Select cmt into desc from ZCODE_MSTR where fidname = 'LIST' and value = VALUE.
ENDSELECT.
ENDFORM. "GETDESC
"User operation code
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'back' OR 'exit 'OR 'cancel '.
Leave program.
WHEN 'save'. "display the value of the drop-down box
Message value type 'I '.
WHEN 'thelist' OR 'enter'. "action after the drop-down list box Content Changes
Perform getdesc.
ENDCASE.
ENDMODULE. "USER_COMMAND_0100 INPUT
The ZCODE_MSTR content is as follows:
Finally, the program running result is as follows:
The program achieves good interaction. After the content in the drop-down list box is changed, the corresponding content is automatically displayed.