Tip

Restricting selection options

The function module SELECT_OPTIONS_RESTRICT can be used for restricting possible selection options and signs. By calling this function module, we can restrict the number of selection options available for a field. For more information,refer to the function module documentation.
The code was written in 4.6C.


REPORT selectoptionsrestrict.

* Author   :  Lakshmi Sunitha
* Date     :  February 19, 2003 

* 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'.

    Requires Free Membership to View

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.

This was first published in February 2003

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.