Properties SourceCde
txt
1
*&--------------------------------------------------------------------*
2
*&      Form CHECK_ALLOWED_KEYRANGES                                  *
3
*&--------------------------------------------------------------------*
4
* check new entries fitting allowed keyranges                         *
5
*---------------------------------------------------------------------*
6
*                                                                     *
7
*&--------------------------------------------------------------------*
8
FORM check_allowed_keyranges.
9
  DATA: roottab_key LIKE e071k-tabkey,
10
        tablename LIKE vimdesc-viewname,
11
        allowed,
12
        mess_type(1) TYPE c VALUE 'W',
13
        ale_msgty(1) TYPE c VALUE 'E', ale_msgno LIKE sy-msgno,
14
        ale_msgid LIKE sy-msgid, ale_msgv1 LIKE sy-msgv1,
15
        ale_msgv2 LIKE sy-msgv2, ale_msgv3 LIKE sy-msgv3,
16
        ale_msgv4 LIKE sy-msgv4.
17
  FIELD-SYMBOLS: <key_x> TYPE x, <h_old_mkey2> TYPE x.
18
 
19
  CHECK vim_keyrange_alr_checked EQ space.
20
* check ALE keyspecific stuff
21
  IF vim_ale_keyspec_check NE space.
22
    ASSIGN roottab_key TO <key_x> CASTING.
23
    <key_x> = <f1_x>. allowed = 'X'.
24
    LOOP AT vim_ale_keyspec_objtab.
25
      CALL FUNCTION 'ALE_EDIT_KEY_CHECK'
26
        EXPORTING
27
          objecttype          = vim_ale_keyspec_objtab-otype
28
          objectname          = vim_ale_keyspec_objtab-oname
29
          objectkey           = roottab_key
30
        EXCEPTIONS
31
          key_no_maintainance = 1.
32
      IF sy-subrc NE 0.
33
        allowed = 'A'. ale_msgno = sy-msgno. ale_msgid = sy-msgid.
34
        ale_msgv1 = sy-msgv1. ale_msgv2 = sy-msgv2.
35
        ale_msgv3 = sy-msgv3. ale_msgv4 = sy-msgv4.
36
        EXIT.
37
      ENDIF.
38
    ENDLOOP.
39
  ENDIF.
40
  IF allowed <> 'A'.                               "329818/2001
41
    vim_keyrange_alr_checked = 'X'.                "329818/2001
42
  ENDIF.
43
* check namespace
44
  IF vim_ale_keyspec_check EQ space OR                      "SW
45
   ( x_header-customauth CO sap_cust_ctrl_classes AND allowed CO ' X' ).
46
    IF x_header-bastab EQ space.       "view
47
      MOVE x_header-roottab TO tablename.
48
    ELSE.                              "base table
49
      MOVE x_header-viewname TO tablename.
50
    ENDIF.
51
    ASSIGN roottab_key TO <key_x> CASTING.
52
    IF x_header-generictrp <> space.
53
      MOVE <f1_x>(x_header-maxtrkeyln) TO <key_x>.
54
    ELSE.
55
      MOVE <f1_x>(x_header-keylen) TO <key_x>.
56
    ENDIF.
57
    CALL FUNCTION 'CHECK_CUSTOMER_NAMES'
58
      EXPORTING
59
        tablename   = tablename
60
        tablekey    = roottab_key
61
      IMPORTING
62
        key_allowed = allowed.
63
  ENDIF.
64
 
65
  IF allowed CO ' A'.
66
    EXPORT vimviewname FROM x_header-viewname TO MEMORY ID sy-uname.
67
    IF x_header-delmdtflag NE space AND status-mode EQ detail_bild.
68
      mess_type = 'S'.
69
    ELSEIF allowed EQ 'A'.
70
      mess_type = ale_msgty.
71
      PERFORM set_pf_status USING 'ERROR'.
72
    ENDIF.
73
    IF neuer EQ 'J'.                   "add mode
74
      IF x_header-delmdtflag <> space.
75
        ASSIGN <vim_h_old_mkey>(x_header-keylen) TO <h_old_mkey2>.
76
        IF <h_old_mkey2> = <f1_x>.
77
*      IF x_header-delmdtflag NE space AND <f1> EQ vim_old_viewkey.
78
          CHECK check_all_keyr_scnd_time EQ space. "simul. of warning
79
        ENDIF.
80
      ENDIF.
81
*     MESSAGE E019(SV). "Bitte den Schlüssel aus dem zulässigen Namensra
82
      CLEAR: vim_keyrange_alr_checked, vim_key_alr_checked.
83
      IF allowed NE 'A'.
84
        MESSAGE ID 'SV' TYPE mess_type NUMBER '019'.
85
      ELSE.
86
        MESSAGE ID ale_msgid TYPE mess_type NUMBER ale_msgno WITH
87
          ale_msgv1 ale_msgv2 ale_msgv3 ale_msgv4.
88
      ENDIF.
89
      IF x_header-delmdtflag NE space.
90
        IF status-mode EQ detail_bild.
91
          <h_old_mkey2> = <f1_x>.
92
*          vim_old_viewkey = <f1>.
93
          check_all_keyr_scnd_time = allowed.    "simulation of warning
94
          TRANSLATE check_all_keyr_scnd_time USING ' XA '.
95
          TRANSLATE neuer USING 'JX'.
96
          CLEAR: function, ok_code. LEAVE SCREEN.
97
        ENDIF.
98
        <h_old_mkey2> = <f1_x>.
99
*        vim_old_viewkey = <f1_x>.
100
        check_all_keyr_scnd_time = 'X'."simulation of warning
101
      ENDIF.
102
    ELSE.                              "update mode.
103
      IF allowed NE 'A'.
104
        IF vim_special_mode EQ vim_delete.
105
          mess_type = 'S'.
106
        ELSE.
107
          mess_type = 'W'.
108
        ENDIF.
109
        IF vim_system_type NE 'SAP'.
110
          MESSAGE ID 'SV' TYPE mess_type NUMBER '117'.
111
        ELSE.
112
*       MESSAGE W136(SV). "Vorsicht bei Änderungen, Eintrag gehört dem K
113
          MESSAGE ID 'SV' TYPE mess_type NUMBER '136'.
114
        ENDIF.
115
      ELSE.
116
        IF vim_special_mode EQ vim_delete.
117
          mess_type = 'S'.
118
        ELSE.
119
          mess_type = ale_msgty.
120
        ENDIF.
121
        MESSAGE ID ale_msgid TYPE mess_type NUMBER ale_msgno WITH
122
          ale_msgv1 ale_msgv2 ale_msgv3 ale_msgv4.
123
      ENDIF.
124
    ENDIF.
125
    sy-subrc = 8.
126
  ELSE.
127
    CLEAR sy-subrc.
128
  ENDIF.
129
ENDFORM.                    "check_allowed_keyranges