Chapter 108
ABAP TIP - Popup Screen
Source : http://abapjoy.blogspot.com
Normally,
we use the function ‘ POPUP_GET_VALUES’ to implement popup, but
there is a limitation when adding a radio button, checkbox like a below screen.
For this demands, you can make it using the class ‘cl_ci_query_attributes’.
REPORT zpopup_screen.
START-OF-SELECTION.
PERFORM call_popup.
FORM call_popup.
TABLES : sflight.
DATA: lv_carrid TYPE s_carr_id,
lt_werks TYPE
gds_selrange_werks_tab,
lv_check TYPE xfeld,
lv_radio1 TYPE xfeld,
lv_radio2 TYPE xfeld.
DATA : lt_att TYPE sci_atttab
,
ls_att TYPE
sci_attent.
DATA : l_ref TYPE REF TO
data.
CREATE DATA l_ref TYPE REF TO
xfeld.
* parameters
GET REFERENCE OF lv_carrid
INTO l_ref.
ls_att-kind = 'S'.
ls_att-text = 'Parameter'.
ls_att-obligatory = 'Y'.
ls_att-ref = l_ref.
APPEND ls_att TO lt_att.
* SELECT-OPTIONS
GET REFERENCE OF lt_werks
INTO l_ref.
ls_att-kind = 'S'.
ls_att-text = 'Select
Option'.
ls_att-ref = l_ref.
APPEND ls_att TO lt_att.
* Check box
GET REFERENCE OF lv_check
INTO l_ref.
ls_att-kind = 'C'.
ls_att-text = 'Check box'.
ls_att-ref = l_ref.
APPEND ls_att TO lt_att.
* Radio button
GET REFERENCE OF lv_radio1
INTO l_ref.
ls_att-kind = 'R'.
ls_att-text = 'Radio 1'.
ls_att-button_group = 'MOD'.
ls_att-ref = l_ref.
APPEND ls_att TO lt_att.
GET REFERENCE OF lv_radio2
INTO l_ref.
ls_att-kind = 'R'.
ls_att-text = 'Radio 2'.
ls_att-button_group = 'MOD'.
ls_att-ref = l_ref.
APPEND ls_att TO lt_att.
CALL METHOD
cl_ci_query_attributes=>generic
EXPORTING
p_name = 'TEST'
p_title = 'TEST2'
p_attributes = lt_att
* p_message =
p_display = ''
* receiving
* p_break =
.
BREAK-POINT.
ENDFORM.
|
After
execution program, enter the value like below.
And
you can see the variable value in debugger. That is, the data you entered in
the popup screen.
Please,
note that you should create range table type first for select-options.
Let’s see the structure in
T-CODE:SE11
gds_selrange_werks_tab