Selection Screen에서 필드 자체를 disable 시키지 않고

해당 필드 extension의 특정 기능만 disable 시키고자 할때 사용하는 coding.


* equal 과 between 기능만 활성화 시킴.


DATArestrict TYPE sscr_restrict.
* Auxiliary objects for filling RESTRICT
DATAoptlist TYPE sscr_opt_list,
      ass     TYPE sscr_ass.



FORM restrict_sel_field .


  CHECK restrict-opt_list_tab[] IS INITIAL.

  optlist-name       'OBJECTKEY1'.
  optlist-options-eq 'X'.
  optlist-options-bt 'X'.
  APPEND optlist TO restrict-opt_list_tab.    CLEARoptlist.

   ass-kind    'S'.      "A(ll), B(lock), S(elect-Option)

  ass-name    'S_MATNR'.
  ass-sg_main 'I'.      " (only) I, SPACE = both
  ass-sg_addy space.
  ass-op_main 'OBJECTKEY1'.
  APPEND ass TO restrict-ass_tab.    CLEARass.


* 다른 select-option도 추가로 한번에 setting 가능함.

* 추가로 작업하고자 하는 필드를 계속 붙여주면 한꺼번에 여러개 필드 작업이 가능함.


*
*  optlist-name       = 'OBJECTKEY2'.
*  optlist-options-eq = 'X'.       optlist-options-bt = 'X'.
*  APPEND optlist TO restrict-opt_list_tab.    CLEAR: optlist.

*  ass-kind    = 'S'.
*  ass-name    = 'S_MATNR'.
*  ass-sg_main = 'I'.
*  ass-sg_addy = space.
*  ass-op_main = 'OBJECTKEY2'.
*  APPEND ass TO restrict-ass_tab.    CLEAR: ass.
*/

*  optlist-name       = 'OBJECTKEY3'.
*  optlist-options-eq = 'X'.
*  APPEND optlist TO restrict-opt_list_tab.    CLEAR: optlist.
*
*  ass-kind    = 'S'.
*  ass-name    = 'S_MATNR'.
*  ass-sg_main = 'I'.
*  ass-sg_addy = space.
*  ass-op_main = 'OBJECTKEY3'.
*  APPEND ass TO restrict-ass_tab.    CLEAR: ass.
**/
*  optlist-name       = 'OBJECTKEY4'.
*  optlist-options-eq = 'X'.
*  APPEND optlist TO restrict-opt_list_tab.    CLEAR: optlist.
*
*  ass-kind    = 'S'.
*  ass-name    = 'S_BWART'.
*  ass-sg_main = 'I'.
*  ass-sg_addy = space.
*  ass-op_main = 'OBJECTKEY4'.
*  APPEND ass TO restrict-ass_tab.    CLEAR: ass. 

  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.

ENDFORM.

'SAP Program > ABAP' 카테고리의 다른 글

Global Macro  (0) 2017.03.22
SAP Technical Dictionary  (0) 2017.03.22
GM_CODE - BAPI_GOODSMVT_CREATE  (0) 2017.03.16
Search Help 를 parameter setting 해서 사용하는 방법  (0) 2017.03.15
New Open Sql  (0) 2017.03.07

설정

트랙백

댓글