SAP screen designer topic: drop-down list box (4)

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.