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

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