Properties SourceCde
txt
1
*---------------------------------------------------------------------*
2
*       FORM ANZG_TO_AEND                                             *
3
*---------------------------------------------------------------------*
4
*       ........                                                      *
5
*---------------------------------------------------------------------*
6
FORM anzg_to_aend.
7
  DATA: rc LIKE sy-subrc, dummy TYPE scpr_id, value(200) TYPE c,
8
        value_is_external TYPE xfeld, lfieldname TYPE fnam_____4,
9
        keyvalues TYPE occheckkeyflds, w_keyvalue TYPE occheckkey,
10
        oc_rangetab TYPE TABLE OF vimsellist, lines TYPE i,
11
        any_substflds_initial TYPE xfeld, field1 LIKE sy-msgv1,
12
        field2 LIKE sy-msgv2, field3 LIKE sy-msgv3,
13
        field4 LIKE sy-msgv4.
14
  FIELD-SYMBOLS: <w_dba_sel> TYPE vimsellist, <x_namtab> TYPE vimnamtab,
15
                 <value> TYPE c.
16
 
17
  IF status-action NE anzeigen AND status-action NE transportieren.
18
    MESSAGE i001(sv).
19
  ELSE.
20
    IF status-action EQ anzeigen.
21
* check authority
22
      IF x_header-newgener EQ space. "4.5a: support individual auth.chck
23
        CALL FUNCTION 'VIEW_AUTHORITY_CHECK'
24
           EXPORTING
25
                view_action                = aendern
26
                view_name                  = view_name
27
                no_warning_for_clientindep = vim_no_warning_for_cliindep
28
           CHANGING
29
                org_crit_inst              = vim_oc_inst
30
           EXCEPTIONS
31
                no_authority                   = 8
32
                no_clientindependent_authority = 9
33
                no_linedependent_authority     = 11.
34
        rc = sy-subrc.
35
        IF sy-subrc = 11.
36
          MOVE: sy-msgid TO vim_auth_msgid,
37
                sy-msgno TO vim_auth_msgno,
38
                sy-msgv1 TO vim_auth_msgv1,
39
                sy-msgv2 TO vim_auth_msgv2,
40
                sy-msgv3 TO vim_auth_msgv3,
41
                sy-msgv4 TO vim_auth_msgv4.
42
        ENDIF.
43
      ENDIF.
44
      IF x_header-frm_on_aut NE space.
45
        vim_auth_action = aendern.
46
        vim_auth_event = vim_auth_switch_to_update_mode.
47
        ASSIGN <vim_ck_sellist> TO <vim_auth_sellist>.
48
        PERFORM (x_header-frm_on_aut) IN PROGRAM.
49
        IF vim_auth_rc NE 0. rc = 10. ENDIF.
50
      ENDIF.
51
    ENDIF.
52
    CASE rc.
53
      WHEN 0.
54
        IF NOT vim_oc_inst IS INITIAL AND vim_called_by_cluster = space.
55
* check line-dependent authorisation (viewclusters: will be done in
56
* viewcluster maintenance.)
57
* 1st: check non-subset-values
58
          INSERT LINES OF dba_sellist[] INTO TABLE oc_rangetab.
59
          LOOP AT x_namtab ASSIGNING <x_namtab> WHERE keyflag <> space
60
           AND readonly = subset.
61
            DELETE oc_rangetab WHERE viewfield = <x_namtab>-viewfield.
62
          ENDLOOP.
63
          IF sy-subrc = 0.
64
            DESCRIBE TABLE oc_rangetab LINES lines.
65
            if lines > 0.
66
              READ TABLE oc_rangetab ASSIGNING <w_dba_sel> INDEX lines.
67
              CLEAR <w_dba_sel>-and_or.
68
            endif.
69
          ENDIF.
70
          CALL METHOD vim_oc_inst->check_oc_auth_vim_sellist
71
            EXPORTING
72
              sellist    = oc_rangetab
73
              action     = '02'
74
*          CHANGING
75
*            KEY_FIELDS =
76
            EXCEPTIONS
77
              no_auth    = 1
78
              OTHERS     = 2.
79
          IF sy-subrc <> 0.
80
            MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
81
             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
82
            EXIT.
83
          ENDIF.
84
          IF x_header-subsetflag <> space.
85
* 2nd: check subset values
86
            CALL METHOD vim_oc_inst->build_key_value_tab
87
              EXPORTING
88
                entry     = <initial>
89
              IMPORTING
90
                keyvalues = keyvalues.
91
            LOOP AT keyvalues INTO w_keyvalue.
92
              READ TABLE x_namtab ASSIGNING <x_namtab>
93
               WITH KEY viewfield = w_keyvalue-keyname.
94
              CHECK <x_namtab>-readonly <> subset.
95
              DELETE keyvalues.
96
            ENDLOOP.
97
            CALL METHOD vim_oc_inst->check_oc_authority
98
              EXPORTING
99
                activity        = '02'
100
              CHANGING
101
                key_values      = keyvalues
102
              EXCEPTIONS
103
                no_auth         = 1
104
                key_incomplete  = 2
105
*              WRONG_PARAMETER = 3
106
                OTHERS          = 4.
107
            IF sy-subrc = 1.
108
              MOVE: sy-msgv1 TO field1, sy-msgv2 TO field2,
109
                    sy-msgv3 TO field3, sy-msgv4 TO field4.
110
* no authorisation for current subset values
111
              MESSAGE i763(sv) WITH field1 field2 field3 field4.
112
*   Sie haben keine Pflegeberechtigung für die angezeigten Datensätze.
113
              LOOP AT keyvalues INTO w_keyvalue WHERE noauth <> space.
114
                READ TABLE dba_sellist ASSIGNING <w_dba_sel>
115
                 WITH KEY viewfield = w_keyvalue-keyname.
116
                CLEAR: <w_dba_sel>-value, <w_dba_sel>-initial,
117
                       <w_dba_sel>-from_auth.                "UF210200
118
              ENDLOOP.
119
*              CALL METHOD vim_oc_inst->convert_oc_selections
120
*                        EXPORTING
121
*                            activity   = '02'
122
*                        IMPORTING
123
*                            oc_vimsell = oc_rangetab.
124
** if possible: fill subset selection in RANGETAB from authority
125
** (authority object S_TABU_LIN)
126
*              PERFORM vim_merge_sellists USING    oc_rangetab
127
*                                                  x_namtab[]
128
*                                                  'X'
129
*                                         CHANGING x_header[]
130
*                                                  dba_sellist
131
*                                                  rc.
132
*              PERFORM check_all_substfields TABLES dba_sellist
133
*                      CHANGING any_substflds_initial.
134
*              IF any_substflds_initial <> space.
135
              CALL FUNCTION 'TABLE_RANGE_INPUT'
136
                   EXPORTING
137
                        table             = x_header-viewname
138
                        oc_inst           = vim_oc_inst
139
                   TABLES
140
                        sellist           = dba_sellist
141
                        x_header          = x_header
142
                        x_namtab          = x_namtab
143
                   EXCEPTIONS
144
                        cancelled_by_user = 1
145
                        no_input          = 2
146
                        OTHERS            = 3.
147
              IF sy-subrc <> 0.
148
                EXIT.
149
              ENDIF.
150
*              refresh vim_dba_sel_kept.            "UF210200
151
*              ENDIF.
152
            ENDIF.
153
          ELSE.
154
* new selection because of different authorisation? --> Message
155
* >>>check whether there's really a difference between upd and show<<<
156
            MESSAGE s764(sv).
157
*   Veränderte Auswahl von Datensätzen.
158
          ENDIF.                       "subsets exist
159
        ENDIF.                         "oc exists
160
        IF status-action EQ transportieren.
161
          function = switch_transp_to_upd_mode.
162
          CLEAR <status>-crcntsknwn.
163
          IF <status>-corr_enqud NE space.
164
            CALL FUNCTION 'DEQUEUE_E_TRKORR'
165
                 EXPORTING
166
                      trkorr = <status>-corr_nbr.
167
*             X_TRKORR = E02.
168
            CLEAR <status>-corr_enqud.
169
          ENDIF.
170
          IF x_header-cursetting NE space.
171
            CLEAR: vim_corr_obj_viewname, <status>-tr_alrchkd.
172
          ENDIF.
173
        ELSE.
174
          CLEAR vim_corr_obj_viewname.
175
          IF <status>-prof_found = vim_profile_found    "UF profileb
176
             AND vim_pr_records = 0.
177
* get records the profile contains
178
            PERFORM get_pr_nbr_records USING vim_profile_values
179
                                             x_header
180
                                       CHANGING rc
181
                                                dummy
182
                                                vim_pr_records
183
                                                vim_pr_tab
184
                                                vim_pr_fields.
185
* check key-status
186
            PERFORM get_profile_status CHANGING vim_pr_tab
187
                                                vim_pr_fields.
188
            PERFORM bcset_key_check_in_total.
189
          ENDIF.                       "UF profileb
190
        ENDIF.
191
*       SET SCREEN 0.
192
*       LEAVE SCREEN.
193
        vim_next_screen = 0. vim_leave_screen = 'X'.
194
      WHEN 8.                          "no authority for update
195
        MESSAGE i051(sv).              "only show allowed
196
      WHEN 9.
197
        MESSAGE ID 'TB' TYPE 'I' NUMBER 109.      "no cli-indep auth
198
      WHEN 10 OR 11.
199
        MESSAGE ID vim_auth_msgid TYPE 'I' NUMBER vim_auth_msgno
200
                WITH vim_auth_msgv1 vim_auth_msgv2  vim_auth_msgv3
201
                     vim_auth_msgv4.
202
    ENDCASE.
203
  ENDIF.
204
ENDFORM.