Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[ABAP] Set Select-Option to invisble via Radiobuttons and MODIF ID

REPORT ztest.

TABLES pa0002.

*-----------------------------------------------------------------------
* Selection screen
*-----------------------------------------------------------------------
PARAMETERS: p_radio1               RADIOBUTTON GROUP rad1 DEFAULT 'X' USER-COMMAND rad. "set s_pernr visible
PARAMETERS: p_radio2               RADIOBUTTON GROUP rad1.                              "set s_pernr invisible

SELECT-OPTIONS : s_pernr           FOR pa0002-pernr MODIF ID 100.

*----------------------------------------------------------------------
* AT SELECTION-SCREEN
*----------------------------------------------------------------------
AT SELECTION-SCREEN OUTPUT. " PBO

  LOOP AT SCREEN.
    CASE screen-group1.
      WHEN '100'.
        screen-invisible = COND #( WHEN p_radio1 = abap_true THEN 0 ELSE 1 ).
        MODIFY SCREEN.
    ENDCASE.
  ENDLOOP.

[ABAP] Select-Option for ALV Layout

Create a ALV Layout Variant
Select-Option for Layout Variant on Selectionscreen
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-b03.
PARAMETERS: p_vari TYPE slis_vari.
SELECTION-SCREEN END OF BLOCK b3.

INITIALIZATION.

  "Load default layout
  DATA: ls_layout TYPE salv_s_layout_info,
        ls_key    TYPE salv_s_layout_key.

  ls_key-report = sy-repid.

  ls_layout = cl_salv_layout_service=>get_default_layout( s_key    = ls_key
                                                          restrict = '1' ).
  p_vari = ls_layout-layout.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.

  "Value Help
  DATA: ls_layout TYPE salv_s_layout_info,
        ls_key    TYPE salv_s_layout_key.

  ls_key-report = sy-repid.

  ls_layout = cl_salv_layout_service=>f4_layouts( s_key    = ls_key
                                                  restrict = '1' ).
  p_vari = ls_layout-layout.

[ABAP] Fill table rows into range table

DATA(pernrs) = VALUE pernr_tab( ( |00000001| )
                                ( |00000002| )
                                ( |00000003| ) ).

DATA(lr_pernr) = VALUE cchry_pernr_range( FOR pernr IN pernrs ( sign   = 'I'
                                                                option = 'EQ'
                                                                low    = pernr
                                                                high   = '' ) ).
"Append row to range

APPEND VALUE #( option = 'EQ'
                sign   = 'I'
                low    = pernr ) TO lr_pernr.

[ABAP] Radiobutton with label (comment) and input field

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-b01.

* Schnittstelle
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: p_server RADIOBUTTON GROUP rad1.
SELECTION-SCREEN COMMENT 6(26) text-t01 FOR FIELD p_server.
PARAMETERS: p_sname(8) TYPE c DEFAULT ''. 
SELECTION-SCREEN END OF LINE.

* Filename (optional)
PARAMETERS: p_fname TYPE j_3sdsn.

* Lokale Datei
PARAMETERS: p_local  RADIOBUTTON GROUP rad1 DEFAULT 'X'.
* Dateiauswahl
PARAMETERS: p_up     TYPE dxfile-filename DEFAULT ''.

SELECTION-SCREEN END OF BLOCK b1.

[ABAP] Restrict Select-Option to single values

INITIALIZATION.

  DATA: ls_restrictions TYPE sscr_restrict.

  APPEND VALUE #( name = 'CP' options-cp = abap_true ) TO ls_restrictions-opt_list_tab.

  APPEND VALUE #( kind    = 'S' name    = 'S_GRUND' sg_main = 'I'
                  sg_addy = ' ' op_main = 'CP'      op_addy = 'CP' ) TO ls_restrictions-ass_tab.

  CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
    EXPORTING
      restriction = ls_restrictions.