Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

fieldvalue only from search help

Former Member
0 Likes
649

hi,

there is a a field (select options) and the requirement is the user

may only choose the values what has been suggested from the search help .

It should not be possible to type in any other value.

Reagrds

sas

1 ACCEPTED SOLUTION
Read only

GauthamV
Active Contributor
0 Likes
614

Append the values you required for that field into an internal table and use this function module.

F4IF_INT_TABLE_VALUE_REQUEST ,raise a message if user enters something else.

check this for sample.


TABLES : tadir.
SELECT-OPTIONS: s_devc FOR tadir-devclass NO INTERVALS NO-EXTENSION.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_devc-low .
  REFRESH: it_sel.
  CLEAR: it_sel.
  it_sel-devclass = 'ZBASIS'.
  it_sel-ctext = 'Development Class For BASIS'.
  APPEND it_sel.
  CLEAR: it_sel.
  it_sel-devclass = 'ZMM'.
  it_sel-ctext = 'Development Class For Material Management'.
  APPEND it_sel.
  CLEAR: it_sel.
  it_sel-devclass = 'ZHR'.
  it_sel-ctext = 'Customer Developments for HR '.
  APPEND it_sel.
  CLEAR: it_sel.
  it_sel-devclass = 'ZFI'.
  it_sel-ctext = 'Development Class for FI'.
  APPEND it_sel.
  CLEAR: it_sel.
  it_sel-devclass = 'ZCO'.
  it_sel-ctext = 'Development Class for CO'.
  APPEND it_sel.
  CLEAR: it_sel.
  it_sel-devclass = 'ZPS'.
  it_sel-ctext = 'Development Class For Project System'.
  APPEND it_sel.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
*   DDIC_STRUCTURE         = ' '
      retfield               = 'DEVCLASS'
*   PVALKEY                = ' '
     dynpprog               = sy-repid
     dynpnr                 = sy-dynnr
     dynprofield            = 'S_DEVC-LOW'
*   STEPL                  = 0
*   WINDOW_TITLE           =
*   VALUE                  = ' '
     value_org              = 'S'
*   MULTIPLE_CHOICE        = ' '
*   DISPLAY                = ' '
*   CALLBACK_PROGRAM       = 'SY-REPID'
*   CALLBACK_FORM          = ' '
*   MARK_TAB               =
* IMPORTING
*   USER_RESET             =
    TABLES
      value_tab              =  it_sel
*   FIELD_TAB              =
*   RETURN_TAB             =
*   DYNPFLD_MAPPING        =
* EXCEPTIONS
*   PARAMETER_ERROR        = 1
*   NO_VALUES_FOUND        = 2
*   OTHERS                 = 3
            .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  READ TABLE it_sel INDEX sy-index.

AT SELECTION-SCREEN.

  LOOP AT s_devc .
    IF (  s_devc-low = 'ZBASIS' OR s_devc-low = 'ZFI' OR s_devc-low = 'ZMM'
     OR s_devc-low = 'ZHR' OR s_devc-low = 'ZCO' OR s_devc-low = 'ZPS' ).
    ELSE.
*      refresh s_devc.
      CLEAR s_devc.
      MESSAGE 'Enter the correct package' TYPE 'E'.
    ENDIF.
  ENDLOOP.

Append the values you required for that field into an internal table and use this function module.

F4IF_INT_TABLE_VALUE_REQUEST ,raise a message if user enters something else.

check this for sample.


TABLES : tadir.
SELECT-OPTIONS: s_devc FOR tadir-devclass NO INTERVALS NO-EXTENSION.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_devc-low .
  REFRESH: it_sel.
  CLEAR: it_sel.
  it_sel-devclass = 'ZBASIS'.
  it_sel-ctext = 'Development Class For BASIS'.
  APPEND it_sel.
  CLEAR: it_sel.
  it_sel-devclass = 'ZMM'.
  it_sel-ctext = 'Development Class For Material Management'.
  APPEND it_sel.
  CLEAR: it_sel.
  it_sel-devclass = 'ZHR'.
  it_sel-ctext = 'Customer Developments for HR '.
  APPEND it_sel.
  CLEAR: it_sel.
  it_sel-devclass = 'ZFI'.
  it_sel-ctext = 'Development Class for FI'.
  APPEND it_sel.
  CLEAR: it_sel.
  it_sel-devclass = 'ZCO'.
  it_sel-ctext = 'Development Class for CO'.
  APPEND it_sel.
  CLEAR: it_sel.
  it_sel-devclass = 'ZPS'.
  it_sel-ctext = 'Development Class For Project System'.
  APPEND it_sel.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
*   DDIC_STRUCTURE         = ' '
      retfield               = 'DEVCLASS'
*   PVALKEY                = ' '
     dynpprog               = sy-repid
     dynpnr                 = sy-dynnr
     dynprofield            = 'S_DEVC-LOW'
*   STEPL                  = 0
*   WINDOW_TITLE           =
*   VALUE                  = ' '
     value_org              = 'S'
*   MULTIPLE_CHOICE        = ' '
*   DISPLAY                = ' '
*   CALLBACK_PROGRAM       = 'SY-REPID'
*   CALLBACK_FORM          = ' '
*   MARK_TAB               =
* IMPORTING
*   USER_RESET             =
    TABLES
      value_tab              =  it_sel
*   FIELD_TAB              =
*   RETURN_TAB             =
*   DYNPFLD_MAPPING        =
* EXCEPTIONS
*   PARAMETER_ERROR        = 1
*   NO_VALUES_FOUND        = 2
*   OTHERS                 = 3
            .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  READ TABLE it_sel INDEX sy-index.

AT SELECTION-SCREEN.

  LOOP AT s_devc .
    IF (  s_devc-low = 'ZBASIS' OR s_devc-low = 'ZFI' OR s_devc-low = 'ZMM'
     OR s_devc-low = 'ZHR' OR s_devc-low = 'ZCO' OR s_devc-low = 'ZPS' ).
    ELSE.
*      refresh s_devc.
      CLEAR s_devc.
      MESSAGE 'Enter the correct package' TYPE 'E'.
    ENDIF.
  ENDLOOP.

3 REPLIES 3
Read only

Former Member
0 Likes
614

Hi erdem,

You have one possible solution for that.

Validate what ever entered in that select option based on the F4 help values.

if not there you can give the error message.

i don't thnk we do have aprat from this solution.

Regards!

Read only

GauthamV
Active Contributor
0 Likes
615

Append the values you required for that field into an internal table and use this function module.

F4IF_INT_TABLE_VALUE_REQUEST ,raise a message if user enters something else.

check this for sample.


TABLES : tadir.
SELECT-OPTIONS: s_devc FOR tadir-devclass NO INTERVALS NO-EXTENSION.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_devc-low .
  REFRESH: it_sel.
  CLEAR: it_sel.
  it_sel-devclass = 'ZBASIS'.
  it_sel-ctext = 'Development Class For BASIS'.
  APPEND it_sel.
  CLEAR: it_sel.
  it_sel-devclass = 'ZMM'.
  it_sel-ctext = 'Development Class For Material Management'.
  APPEND it_sel.
  CLEAR: it_sel.
  it_sel-devclass = 'ZHR'.
  it_sel-ctext = 'Customer Developments for HR '.
  APPEND it_sel.
  CLEAR: it_sel.
  it_sel-devclass = 'ZFI'.
  it_sel-ctext = 'Development Class for FI'.
  APPEND it_sel.
  CLEAR: it_sel.
  it_sel-devclass = 'ZCO'.
  it_sel-ctext = 'Development Class for CO'.
  APPEND it_sel.
  CLEAR: it_sel.
  it_sel-devclass = 'ZPS'.
  it_sel-ctext = 'Development Class For Project System'.
  APPEND it_sel.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
*   DDIC_STRUCTURE         = ' '
      retfield               = 'DEVCLASS'
*   PVALKEY                = ' '
     dynpprog               = sy-repid
     dynpnr                 = sy-dynnr
     dynprofield            = 'S_DEVC-LOW'
*   STEPL                  = 0
*   WINDOW_TITLE           =
*   VALUE                  = ' '
     value_org              = 'S'
*   MULTIPLE_CHOICE        = ' '
*   DISPLAY                = ' '
*   CALLBACK_PROGRAM       = 'SY-REPID'
*   CALLBACK_FORM          = ' '
*   MARK_TAB               =
* IMPORTING
*   USER_RESET             =
    TABLES
      value_tab              =  it_sel
*   FIELD_TAB              =
*   RETURN_TAB             =
*   DYNPFLD_MAPPING        =
* EXCEPTIONS
*   PARAMETER_ERROR        = 1
*   NO_VALUES_FOUND        = 2
*   OTHERS                 = 3
            .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  READ TABLE it_sel INDEX sy-index.

AT SELECTION-SCREEN.

  LOOP AT s_devc .
    IF (  s_devc-low = 'ZBASIS' OR s_devc-low = 'ZFI' OR s_devc-low = 'ZMM'
     OR s_devc-low = 'ZHR' OR s_devc-low = 'ZCO' OR s_devc-low = 'ZPS' ).
    ELSE.
*      refresh s_devc.
      CLEAR s_devc.
      MESSAGE 'Enter the correct package' TYPE 'E'.
    ENDIF.
  ENDLOOP.

Read only

Former Member
0 Likes
614

There is a problem

I am using this FM . Range field -> r_nsize is defined as:

DATA:
NSNAME(5),           "Also Dynprofield
RANGES: r_nsize  FOR NSNAME,

 CALL FUNCTION 'COMPLEX_SELECTIONS_DIALOG'
      EXPORTING
        title             = 'Auswahl Normal Size'
        text              = 'Normal Size'
        SEARCH_HELP       = lv_sh_1
      TABLES
        range             = r_nsize
      EXCEPTIONS
        no_range_tab      = 1
        cancelled         = 2
        internal_error    = 3
        invalid_fieldname = 4
        OTHERS            = 5.