SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Restrict select-options to only allow specific restrictions



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dialog Programming
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sun Oct 14, 2007 6:33 pm    Post subject: Restrict select-options to only allow specific restrictions Reply with quote

Example program to demonstrates how to restrict select-options to only allow specific restriction options i.e.. EQ, NE, CP, BT etc..

Code:
*.......................................................................
*: Report:  ZRESTRICT_SELOPT                                           :
*:                                                                     :
*: Author:  www.SAPdev.co.uk                                           :
*:                                                                     :
*: Date  :  2004                                                       :
*:                                                                     :
*: Description: Demonstrates how to restrict select options to only    :
*:              allow specific restriction options:                    :
*:                                     i.e.. EQ, NE, BT etc..          :
*:.....................................................................:

REPORT ZRESTRICT_SELOPT.

* Include type pool SSCR
TYPE-POOLS sscr.

TABLES: EKPO.

* Selection-screen
select-options : so_ebeln for ekpo-ebeln,
                 so_ebelp for ekpo-ebelp.

* Variables for populating restriction data
DATA: gd_restrict TYPE sscr_restrict.   "structure containing 2 tables
DATA: gd_optlist  TYPE sscr_opt_list,   "header line for table 1
      gd_ass      TYPE sscr_ass.        "header line for table 2


************************************************************************
*INITIALIZATION.
INITIALIZATION.

* Restrict SO_EBELN to only except EQ, BT and NE.
  gd_optlist-name = 'KEY1'.      "Can be anything
  gd_optlist-options-eq = 'X'.
  gd_optlist-options-bt = 'X'.
  gd_optlist-options-ne = 'X'.
  APPEND gd_optlist TO gd_restrict-opt_list_tab.
  clear: gd_optlist.

  gd_ass-kind = 'S'.
  gd_ass-name = 'SO_EBELN'.
  gd_ass-sg_main = 'I'.
  gd_ass-sg_addy = SPACE.
  gd_ass-op_main = 'KEY1'.       "Must be same as above
  APPEND gd_ass TO gd_restrict-ass_tab.
  clear: gd_ass.

* Restrict SO_EBELP to only except CP, GE, LT.
  gd_optlist-name = 'KEY2'.      "Can be anything
  gd_optlist-options-cp = 'X'.
  gd_optlist-options-ge = 'X'.
  gd_optlist-options-lt = 'X'.
  APPEND gd_optlist TO gd_restrict-opt_list_tab.
  clear: gd_optlist.

  gd_ass-kind = 'S'.
  gd_ass-name = 'SO_EBELP'.
  gd_ass-sg_main = 'I'.
  gd_ass-sg_addy = SPACE.
  gd_ass-op_main = 'KEY2'.       "Must be same as above
  APPEND gd_ass TO gd_restrict-ass_tab.
  clear: gd_ass.


  CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
   EXPORTING
*    PROGRAM                      =
    restriction                  = gd_restrict
*    DB                           = ' '
   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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dialog Programming All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.