"
"
TABLES: mara, mard, mspr, eban, aufk, afpo, afih.
DATA: gv_ucomm TYPE sy-ucomm.
SELECT-OPTIONS: s_mtart FOR mara-mtart.
SELECT-OPTIONS: s_matnr FOR mara-matnr.
SELECT-OPTIONS: s_mfrpn FOR mara-mfrpn.
PARAMETERS: p_alg_1 TYPE c RADIOBUTTON GROUP gr1 USER-COMMAND com1 DEFAULT 'X'.
PARAMETERS: p_alg_2 TYPE c RADIOBUTTON GROUP gr1 .
PARAMETERS: p_alg_3 TYPE c RADIOBUTTON GROUP gr1.
PARAMETERS: p_alg_4 TYPE c RADIOBUTTON GROUP gr1.
PARAMETERS: p_alg_5 TYPE c RADIOBUTTON GROUP gr1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002 .
SELECT-OPTIONS: s_werks2 FOR mard-werks MODIF ID sc2,
s_lgort2 FOR mard-lgort MODIF ID sc2,
s_sobkz2 FOR mspr-sobkz MODIF ID sc2,
s_pspnr2 FOR mspr-pspnr MODIF ID sc2.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003 .
SELECT-OPTIONS: s_ekgrp3 FOR eban-ekgrp MODIF ID sc3,
s_matkl3 FOR eban-matkl MODIF ID sc3,
s_bsart3 FOR eban-bsart MODIF ID sc3,
s_banfn3 FOR eban-banfn MODIF ID sc3,
s_bnfpo3 FOR eban-bnfpo MODIF ID sc3.
SELECTION-SCREEN END OF BLOCK b3.
SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-004 .
SELECT-OPTIONS: s_auart4 FOR aufk-auart MODIF ID sc4,
s_aufnr4 FOR afpo-aufnr MODIF ID sc4,
s_projn4 FOR afpo-projn MODIF ID sc4,
s_equnr4 FOR afih-equnr MODIF ID sc4.
SELECTION-SCREEN END OF BLOCK b4.
SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-005 .
PARAMETERS: p_req_T TYPE text20 MODIF ID sc5.
PARAMETERS: p_req TYPE text20 MODIF ID sc5.
SELECTION-SCREEN END OF BLOCK b5.
AT SELECTION-SCREEN.
" событие срабатывает, когда нажимаем кнопку
gv_ucomm = sy-ucomm.
AT SELECTION-SCREEN OUTPUT.
" Данное событие срабатывает после AT SELECTION-SCREEN
" но sy-ucomm очищается, поэтому используем ранее сохраненное значение
CHECK gv_ucomm = 'COM1'.
lcl_get_data=>user_comand_1( EXPORTING iv_alg_1 = p_alg_1
iv_alg_2 = p_alg_2
iv_alg_3 = p_alg_3
iv_alg_4 = p_alg_4
iv_alg_5 = p_alg_5
).
"Опишем класс
CLASS lcl_get_data DEFINITION.
PUBLIC SECTION.
user_comand_1 IMPORTING iv_alg_1 TYPE abap_bool
iv_alg_2 TYPE abap_bool
iv_alg_3 TYPE abap_bool
iv_alg_4 TYPE abap_bool
iv_alg_5 TYPE abap_bool.
PRIVATE SECTION.
visible_on_off IMPORTING iv_modif TYPE char3
iv_visible TYPE abap_bool.
ENDCLASS.
CLASS lcl_get_data IMPLEMENTATION.
METHOD user_comand_1.
visible_on_off( EXPORTING iv_modif = 'SC1' iv_visible = iv_alg_1 ).
visible_on_off( EXPORTING iv_modif = 'SC2' iv_visible = iv_alg_2 ).
visible_on_off( EXPORTING iv_modif = 'SC3' iv_visible = iv_alg_3 ).
visible_on_off( EXPORTING iv_modif = 'SC4' iv_visible = iv_alg_4 ).
visible_on_off( EXPORTING iv_modif = 'SC5' iv_visible = iv_alg_5 ).
ENDMETHOD.
METHOD visible_on_off.
DATA lv_invisible TYPE c.
DATA lv_active TYPE c.
DATA lv_output TYPE c.
DATA lv_input TYPE c.
IF iv_visible = abap_true.
lv_invisible = 0.
lv_active = 1.
lv_output = 1.
lv_input = 1.
ELSE.
lv_invisible = 1.
lv_active = 0.
lv_output = 0.
lv_input = 0.
ENDIF.
LOOP AT SCREEN.
IF screen-group1 = iv_modif.
screen-invisible = lv_invisible.
screen-active = lv_active.
screen-output = lv_output.
screen-input = lv_input.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMETHOD.
ENDCLASS.