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

Search Help for selection screen select-option

Former Member
0 Likes
2,397

Hi Friends,

I want have search help for KSCHL with only the condition types starting with Z. I need your help to do that.

Thanks in Advance.

Hi Friends,

I want have search help for KSCHL with only the condition types starting with Z. I need your help to do that.

Thanks in Advance.

5 REPLIES 5
Read only

anversha_s
Active Contributor
0 Likes
1,108

hi,

chek a sample code, for restricting the serach help.

REPORT Z_CONECT_A.

  • Include type pool SSCR

TYPE-POOLS sscr.

TABLES : marc.

  • defining the selection-screen

select-options :

s_matnr for marc-matnr,

s_werks for marc-werks.

  • Define the object to be passed to the RESTRICTION parameter

DATA restrict TYPE sscr_restrict.

  • Auxiliary objects for filling RESTRICT

DATA : optlist TYPE sscr_opt_list,

ass type sscr_ass.

INITIALIZATION.

  • Restricting the MATNR selection to only EQ and 'BT'.

optlist-name = 'OBJECTKEY1'.

optlist-options-eq = 'X'.

optlist-options-bt = 'X'.

APPEND optlist TO restrict-opt_list_tab.

ass-kind = 'S'.

ass-name = 'S_MATNR'.

ass-sg_main = 'I'.

ass-sg_addy = space.

ass-op_main = 'OBJECTKEY1'.

APPEND ass TO restrict-ass_tab.

  • Restricting the WERKS selection to CP, GE, LT, NE.

optlist-name = 'OBJECTKEY2'.

optlist-options-cp = 'X'.

optlist-options-ge = 'X'.

optlist-options-lt = 'X'.

optlist-options-ne = 'X'.

APPEND optlist TO restrict-opt_list_tab.

ass-kind = 'S'.

ass-name = 'S_WERKS'.

ass-sg_main = 'I'.

ass-sg_addy = space.

ass-op_main = 'OBJECTKEY2'.

APPEND ass TO restrict-ass_tab.

CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'

EXPORTING

restriction = restrict

EXCEPTIONS

TOO_LATE = 1

REPEATED = 2

SELOPT_WITHOUT_OPTIONS = 3

SELOPT_WITHOUT_SIGNS = 4

INVALID_SIGN = 5

EMPTY_OPTION_LIST = 6

INVALID_KIND = 7

REPEATED_KIND_A = 8

OTHERS = 9

.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

regards

anver

<b><i>if helped pls mark points</i></b>

Read only

Former Member
0 Likes
1,108

hi

good

go through this link, which ll give you details about the creating search help.

http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21ee86446011d189700000e8322d00/content.htm

thanks

mrutyun^

Read only

Former Member
1,108

Hi saisri,

You create a search help in SE11 and add it to the select-options using a match code object = <Search help name>.

syntax : SELECT-OPTIONS : vbeln FOR vbak-vbeln MATCHCODE OBJECT VMVA.

this will solve your problem.

Read only

0 Likes
1,108

Hi Sandeep,

The default search help is already exiting for that field, just i want to restrict or limit the values for condition types starting with the letter Z. Still i am not clear how to do that. Whether i have to create a new user defined search help with that limited list or i can limit the existing search help to a specific values what i want. Help me.

Thanks.

Read only

0 Likes
1,108

Hi,

did u chk my post.

it will help to restrict the select options erach help.

<b>chk another one to restrci an standard search help.</b>

*&---------------------------------------------------------------------*
*&      Module  user_restrict_search_help  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_restrict_search_help INPUT.

  TYPE-POOLS shlp .

  DATA: f4_ret_val      LIKE ddshretval OCCURS 0 WITH HEADER LINE.
  DATA: f4_shlp         TYPE shlp_descr_t.

  DATA : interface_wa TYPE LINE OF shlp_descr_t-interface.

* DATA : fieldprop_wa TYPE LINE OF shlp_descr_t-fieldprop.

  DATA : selopt_wa TYPE LINE OF shlp_descr_t-selopt.

  DATA :wf_persa TYPE persa.

  DATA : ret LIKE sy-subrc.

  CLEAR f4_shlp.

  wf_persa = 'SAOC'.

  CALL FUNCTION 'F4IF_GET_SHLP_DESCR'
    EXPORTING
      shlpname = 'H_T001P'
      shlptype = 'SH'
    IMPORTING
      shlp     = f4_shlp.


*the field we are giving here will the return field from search help
  clear interface_wa.

  interface_wa-valtabname = interface_wa-valfield = 'X'.

  MODIFY f4_shlp-interface FROM interface_wa
         TRANSPORTING valtabname valfield
         WHERE shlpfield = 'BTRTL'.

***

*---restrict the serch help

  CLEAR selopt_wa.

  selopt_wa-shlpname = 'H_T001P'.
  selopt_wa-shlpfield = 'WERKS'.
  selopt_wa-sign = 'I'.
  selopt_wa-option = 'EQ'.
  selopt_wa-low = wf_persa.

  APPEND selopt_wa TO f4_shlp-selopt.

***********

  CALL FUNCTION 'F4IF_START_VALUE_REQUEST'
    EXPORTING
      shlp                = f4_shlp
*   DISPONLY            = ' '
*     maxrecords          = 500
*     multisel            = ' '
*     cucol               = sy-cucol
*     curow               = sy-curow
   IMPORTING
     rc                  = ret
    TABLES
      return_values      = f4_ret_val.
  .

  CASE ret.

    WHEN 0.

      READ TABLE f4_ret_val INDEX 1 INTO f4_ret_val.

      int_tabc-btrtl = f4_ret_val-fieldval.

  ENDCASE.


ENDMODULE.                 " user_restrict_search_help  INPUT

rgds

Anver

if hlped pls mark points