ABAP checkbox and ListBox User Guide

Source: Internet
Author: User

1. What is checkbox:
Is a check box, which can be defined by like or type. It is a variable of the fixed type. It is an option of parameter. Parameter xxx As checkbox can display a check box on the selection screen.
2. What is ListBox:
Is a drop-down list, you can select a record in this list for some operation. It is also an option of parameter. Parameter xxx As ListBox can display a drop-down list on the selection screen.

3. How to use:
Next we will use a program to describe how to use the two.

Report z_text
Type-pools: VRM. "Type pool for storing ComboBox content
Data: Name type vrm_id, "name of list box
List type vrm_values, "value of list box
Value like line of list. "list box structure
* Define the checkbox and specify the command. In order to be able to respond to the change in the selected screen value
Parameters: p_cb1 Type C as checkbox default 'X' user-command Check,
P_cb2 Type C as checkbox default 'X' user-command Check.
* Define ListBox. visible length must be specified.
Parameters: p_list1 (10) Type C as ListBox
Visible length 15,
P_list2 (20) Type C as ListBox
Visible length 25.
* Start execution
At selection-screen output.
* --> Select 1 instead of 2.
If p_cb1 = 'X' and p_cb2 = ''.
* ---> Add a value to ListBox
Refresh list.
Value-Key = '000000'. "This is the value of the variable p_list.
Value-TEXT = '000000'. "This is text.
Append value to list.
Value-Key = '000000 '.
Value-TEXT = '000000 '.
Append value to list.
Value-Key = '000000 '.
Value-TEXT = '000000 '.
Append value to list.
* ---> Call a function to display values in ListBox
Call function 'vrm _ set_values'
Exporting
Id = 'P _ list1'
Values = List.
* ---> Clears the value of the second ListBox and cannot be entered.
Clear p_list2.
Loop at screen.
If screen-name = 'P _ list2 '.
Screen-input = 0.
Modify screen.
Endif.
Endloop.
* --> Select 2. 1 is not selected. Same as above.
Elseif p_cb2 = 'X' and p_cb1 = ''.
Refresh list.
Value-Key = 'aaaaaaaaaaaaaaaaaaaaa '.
Value-TEXT = 'aaaaaaaaaaaaaaaaaaaaa '.
Append value to list.
Value-Key = 'bbbbbbbbbbbbbbbbbbbbbbbbbb '.
Value-TEXT = 'bbbbbbbbbbbbbbbbbbbbbbbbbb '.
Append value to list.
Value-Key = 'cccccccccccccccccccccccccccccc '.
Value-TEXT = 'cccccccccccccccccccccccccccccc '.
Append value to list.
Append value to list.
Call function 'vrm _ set_values'
Exporting
Id = 'P _ list2'
Values = List.
* ---> Clear the value of ListBox 1
Clear p_list1.
Loop at screen.
If screen-name = 'P _ list1 '.
Screen-input = 0.
Modify screen.
Endif.
Endloop.
* --> None of them are selected. They are all cleared and cannot be entered.
Elseif p_cb1 = ''and p_cb2 = ''.
Clear: p_list1, p_list2.
Loop at screen.
If screen-name = 'P _ list1 '.
Screen-input = 0.
Modify screen.
Endif.
Endloop.
Loop at screen.
If screen-name = 'P _ list2 '.
Screen-input = 0.
Modify screen.
Endif.
Endloop.
* --> Select all and execute
Elseif p_cb1 = 'X' and p_cb2 = 'x '.
Refresh list.
Value-Key = '000000 '.
Value-TEXT = '000000 '.
Append value to list.
Value-Key = '000000 '.
Value-TEXT = '000000 '.
Append value to list.
Value-Key = '000000 '.
Value-TEXT = '000000 '.
Append value to list.
Call function 'vrm _ set_values'
Exporting
Id = 'P _ list1'
Values = List.
Refresh list.
Value-Key = 'aaaaaaaaaaaaaaaaaaaaa '.
Value-TEXT = 'aaaaaaaaaaaaaaaaaaaaa '.
Append value to list.
Value-Key = 'bbbbbbbbbbbbbbbbbbbbbbbbbb '.
Value-TEXT = 'bbbbbbbbbbbbbbbbbbbbbbbbbb '.
Append value to list.
Value-Key = 'cccccccccccccccccccccccccccccc '.
Value-TEXT = 'cccccccccccccccccccccccccccccc '.
Append value to list.
Call function 'vrm _ set_values'
Exporting
Id = 'P _ list2'
Values = List.
Endif.
Start-of-selection.
* --> Output to the second screen
Write: p_list1,/p_list2.

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.