CLASS lcl_dynamic_popup DEFINITION.
PUBLIC SECTION.
CLASS-METHODS
show
RETURNING VALUE(rv_ok) TYPE abap_bool.
ENDCLASS.
CLASS lcl_dynamic_popup IMPLEMENTATION.
METHOD show.
rv_ok = abap_true.
* Werte für Selektionbild definieren
DATA: p_carrid TYPE s_carr_id.
DATA: so_werks TYPE gds_selrange_werks_tab.
DATA: p_werks_no TYPE werks.
DATA: p_check TYPE xfeld.
DATA: rb_1 TYPE xfeld.
DATA: rb_2 TYPE xfeld.
DATA: lb_language TYPE spras.
lb_language = sy-langu.
* Selektionsbildelemente für das Popup
* die Eingabewerte werden mit den Variablen über die Felder "ref" verknüpft
DATA(it_attr) = VALUE sci_atttab(
* Group1 für die folgenden Felder
(
kind = 'G'
text = 'Gruppe1'
ref = REF #( sy-index )
)
* Parameter
(
kind = 'S'
text = 'Carrid'
obligatory = abap_true
ref = REF #( p_carrid )
)
* SELECT-OPTIONS
(
kind = 'S'
text = 'Werk'
ref = REF #( so_werks )
)
* SELECT-OPTIONS NO INTERVALS
(
kind = 'T'
text = 'Werk2'
ref = REF #( p_werks_no )
)
* Group2 für die folgenden Felder
(
kind = 'G'
text = 'Gruppe2'
ref = REF #( sy-index )
)
* Checkbox
(
kind = 'C'
text = 'Check'
ref = REF #( p_check )
)
* Radiobuttons mit Group
(
kind = 'R'
text = 'Radiobutton1'
button_group = 'GR1'
ref = REF #( rb_1 )
)
(
kind = 'R'
text = 'Radiobutton2'
button_group = 'GR1'
ref = REF #( rb_2 )
)
* Listbox
(
kind = 'L'
text = 'Sprache'
ref = REF #( lb_language )
)
).
* Selektionsbild erzeugen und Popup anzeigen
IF abap_true = cl_ci_query_attributes=>generic( p_name = CONV #( sy-repid )
p_title = 'Dynamisches Popup'
p_display = abap_false " abap_true: Anzeige im READONLY-Modus
p_attributes = it_attr ).
rv_ok = abap_false.
ENDIF.
* Werte ausgeben
WRITE: / 'CARRID:', p_carrid.
WRITE: / 'WERKS:', COND string( WHEN lines( so_werks ) > 0 THEN so_werks[ 1 ]-low ELSE '' ).
WRITE: / 'WERKS2:', p_werks_no.
WRITE: / 'Check:', p_check.
WRITE: / 'RB1:', rb_1.
WRITE: / 'RB2:', rb_2.
WRITE: / 'LANGUAGE:', lb_language.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
IF abap_true = lcl_dynamic_popup=>show( ).
WRITE: / 'Ok.'.
ELSE.
WRITE: / 'Abbruch.'.
ENDIF.