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

[ABAP] Selection Screen Tabbed Block

SELECTION-SCREEN BEGIN OF BLOCK bl4 WITH FRAME TITLE TEXT-t01.
SELECTION-SCREEN BEGIN OF TABBED BLOCK tbl FOR 10 LINES.
SELECTION-SCREEN TAB (15) tbl_tab1 USER-COMMAND tab1 DEFAULT SCREEN 1001.
SELECTION-SCREEN TAB (15) tbl_tab2 USER-COMMAND tab2 DEFAULT SCREEN 1002.
SELECTION-SCREEN TAB (15) tbl_tab3 USER-COMMAND tab3 DEFAULT SCREEN 1003.
SELECTION-SCREEN END OF BLOCK tbl.
SELECTION-SCREEN END OF BLOCK bl4.

* Subscreen 1001 Tab1
SELECTION-SCREEN BEGIN OF SCREEN 1001 AS SUBSCREEN.
PARAMETERS p_bool1 TYPE abap_bool AS CHECKBOX.
SELECTION-SCREEN END OF SCREEN 1001.

* Subscreen 1002 Tab2
SELECTION-SCREEN BEGIN OF SCREEN 1002 AS SUBSCREEN.
PARAMETERS p_btp1 TYPE flag RADIOBUTTON GROUP rbg DEFAULT 'X'.
PARAMETERS p_btp2 TYPE flag RADIOBUTTON GROUP rbg.
PARAMETERS p_btp3 TYPE flag RADIOBUTTON GROUP rbg.
SELECTION-SCREEN END OF SCREEN 1002.

* Subscreen 1003 Tab3
SELECTION-SCREEN BEGIN OF SCREEN 1003 AS SUBSCREEN.
PARAMETERS p_bool2 TYPE flag AS CHECKBOX.
SELECTION-SCREEN END OF SCREEN 1003.

INITIALIZATION.

  " provide tab names
  tbl_tab1 = 'Tab1'.
  tbl_tab2 = 'Tab2'.
  tbl_tab3 = 'Tab3'.

  " set active tab (activetab value must be in uppercase)
  tbl-activetab = 'TAB2'.
  tbl-dynnr     = 1002.
  tbl-prog      = sy-repid.

AT SELECTION-SCREEN.

  " click on tabstrip event
  CASE sy-ucomm.
    WHEN 'TAB1'.
      MESSAGE 'TAB1' TYPE 'S'.
    WHEN 'TAB2'.
      MESSAGE 'TAB2' TYPE 'S'.
    WHEN 'TAB3'.
      MESSAGE 'TAB3' TYPE 'S'.
  ENDCASE.

[ABAP] Provide values of a domain in a dropdown list on selection screen

  
  PARAMETER p_test TYPE c OBLIGATORY AS LISTBOX VISIBLE LENGTH 32 DEFAULT 1.

  INITIALIZATION.

  cl_reca_ddic_doma=>get_values( EXPORTING id_name   = 'Z_MYDOMAIN'
                                 IMPORTING et_values = DATA(lt_rsdomaval) ).

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id     = 'P_TEST'
      values = VALUE vrm_values( FOR dvalue IN lt_rsdomaval ( key  = dvalue-domvalue_l 
                                                              text = dvalue-ddtext ) ).

[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] Dropdown list on selection screen

PARAMETER p_list  TYPE c AS LISTBOX VISIBLE LENGTH 32.  "Add OBLIGATORY to get rid of the empty line. Use DEFAULT to set the inital selection.

INITIALIZATION.

  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id              = 'P_LIST'
      values          = VALUE vrm_values( ( key = '1' text = 'Case 1' )
                                          ( key = '2' text = 'Case 2' )
                                          ( key = '3' text = 'Case 3' ) )
    EXCEPTIONS
      id_illegal_name = 1
      OTHERS          = 2.


AT SELECTION-SCREEN ON p_list.

  DATA(dynprofields) = VALUE dynpread_tabtype( ( fieldname = 'P_LIST' ) ).
  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname             = sy-cprog
      dynumb             = sy-dynnr
      translate_to_upper = 'X'
    TABLES
      dynpfields         = dynprofields.  "find your selected value in column fieldvalue or directly in p_list

[ABAP] Activate and deactivate input fields via radiobuttons

*-----------------------------------------------------------------------
* SELEKTIONSBILD
*-----------------------------------------------------------------------
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

* Radiobutton 1 -> Deactivate Fields
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: p_radio1 RADIOBUTTON GROUP rad1 DEFAULT 'X' USER-COMMAND rad.
SELECTION-SCREEN COMMENT 6(37) text-t01 FOR FIELD p_radio1.  
SELECTION-SCREEN : END OF LINE.

* Radiobutton 2 -> Activate Fields
SELECTION-SCREEN : BEGIN OF LINE.
PARAMETERS: p_radio2 RADIOBUTTON GROUP rad1.
SELECTION-SCREEN COMMENT 6(37) text-t02 FOR FIELD p_radio2.
SELECTION-SCREEN : END OF LINE.

* Input fields
PARAMETERS:
  p_vorna TYPE vorna OBLIGATORY DEFAULT 'Max',
  p_nachn TYPE nachn OBLIGATORY DEFAULT 'Mustermann'.

SELECTION-SCREEN END OF BLOCK b1.


*----------------------------------------------------------------------
* AT SELECTION-SCREEN
*----------------------------------------------------------------------
AT SELECTION-SCREEN OUTPUT. " PBO
  LOOP AT SCREEN.
    CASE screen-name.
      WHEN 'P_VORNA' OR 'P_NACHN'.
        screen-input = COND #( WHEN p_radio2 = abap_true THEN 1 ELSE 0 ).
        MODIFY SCREEN.
    ENDCASE.
  ENDLOOP.

[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.