Properties SourceCde
txt
1
*&--------------------------------------------------------------------*
2
*&      Form CONSISTENCY_PRT_FRKY_FIELDS                              *
3
*&--------------------------------------------------------------------*
4
* make sure, that part. forkey table fields are consistent            *
5
*&--------------------------------------------------------------------*
6
FORM consistency_prt_frky_fields
7
                               USING value(cpff_alert) LIKE tvdir-flag.
8
  DATA:  prtfky_field_changed(1) TYPE c, cur_mkey_found(1) TYPE c,
9
         count TYPE i, offs TYPE i,
10
         formname(19) TYPE c VALUE 'FILL_TEXTTAB_KEY_UC'.
11
  FIELD-SYMBOLS: <dummy1>.
12
  LOCAL: total, extract.
13
 
14
  CHECK status-action NE anzeigen.
15
  CHECK <status>-upd_flag NE space.
16
  MOVE: <f1_x> TO <vim_xtotal_key>,
17
        vim_date_mask TO <vim_enddate_mask>,
18
        <f1_x> TO <vim_h_mkey>,
19
*        <f1> TO <vim_mainkey_mask>,
20
        <vim_xtotal_key> TO <f1_x>.
21
*  vim_mainkey = <f1>.
22
  IF x_header-selection EQ space.
23
    LOOP AT total.
24
      CHECK <vim_xtotal_key> NE <f1_x> AND
25
            <vim_tot_mkey_beforex> EQ <vim_mkey_beforex> AND
26
            ( vim_mkey_after_exists EQ space OR
27
              <vim_tot_mkey_afterx> EQ <vim_mkey_afterx> ).
28
*      CHECK <vim_total_key> NE <f1> AND
29
*            <vim_tot_mkey_before> EQ <vim_mkey_before> AND
30
*            ( vim_mkey_after_exists EQ space OR
31
*              <vim_tot_mkey_after> EQ <vim_mkey_after> ).
32
      MOVE 99 TO count.
33
      EXIT.
34
    ENDLOOP.
35
  ELSE.
36
    MOVE 99 TO count.
37
  ENDIF.
38
  IF count EQ 99. "other entries for mainkey (may be) exist
39
* selections exist or
40
* prüfen: wurden Texte verändert ?????
41
* falls aktueller Text leer und hinzufügen --> text aus Extract nehmen
42
    IF vim_prtfky_assigned CO ' Y'.
43
* partial foreign key not assigned or VIM_PROCESS_ASSIGNS already
44
* processed
45
      CLEAR count.
46
      LOOP AT x_namtab WHERE prtfrkyfld NE space.
47
        CHECK x_namtab-readonly EQ space.
48
        IF vim_prtfky_assigned EQ space.
49
          IF x_header-bastab EQ space             "view
50
           OR x_header-texttbexst EQ space        "no texttable
51
           OR x_namtab-texttabfld EQ space.       "no texttabfield
52
* not a texttablefield in a table & texttable
53
            ASSIGN: COMPONENT x_namtab-viewfield OF STRUCTURE <table1>
54
*            ASSIGN <table1>+x_namtab-position(x_namtab-flength)
55
                    TO <vim_prtfky_wa>.
56
          ELSE.
57
            ASSIGN: COMPONENT x_namtab-viewfield
58
                     OF STRUCTURE <table1_text>
59
*            offs = x_namtab-position - x_header-tablen.
60
*            ASSIGN <table1_text>+offs(x_namtab-flength)
61
                     TO <vim_prtfky_wa>.
62
          ENDIF.
63
        ENDIF.
64
        IF x_header-bastab EQ space               "view
65
           OR x_header-texttbexst EQ space        "no texttable
66
           OR x_namtab-texttabfld EQ space.       "no texttabfield
67
          ASSIGN: COMPONENT x_namtab-viewfield
68
                   OF STRUCTURE <vim_total_struc>
69
                   TO <vim_prtfky_total>,
70
                  COMPONENT x_namtab-viewfield
71
                   OF STRUCTURE <vim_extract_struc>
72
                   TO  <vim_prtfky_extract>.
73
* not a texttablefield in a table & texttable
74
        ELSE.
75
          ASSIGN: COMPONENT x_namtab-viewfield
76
                    OF STRUCTURE <vim_tot_txt_struc>
77
                     TO <vim_prtfky_total>,
78
                    COMPONENT x_namtab-viewfield
79
                     OF STRUCTURE <vim_ext_txt_struc>
80
                     TO  <vim_prtfky_extract>.
81
        ENDIF.
82
*        ASSIGN: total+x_namtab-position(x_namtab-flength)
83
*                                 TO <vim_prtfky_total>,
84
*                extract+x_namtab-position(x_namtab-flength)
85
*                                 TO <vim_prtfky_extract>.
86
        CLEAR prtfky_field_changed.
87
        IF status-action EQ hinzufuegen OR status-action EQ kopieren OR
88
           vim_special_mode EQ vim_upgrade.
89
          CLEAR cur_mkey_found.
90
          LOOP AT total.               "            current mainkey.
91
            CHECK <vim_tot_mkey_beforex> EQ <vim_mkey_beforex> AND
92
                  ( vim_mkey_after_exists EQ space OR
93
                    <vim_tot_mkey_afterx> EQ <vim_mkey_afterx> ).
94
*            CHECK <vim_tot_mkey_before> EQ <vim_mkey_before> AND
95
*                  ( vim_mkey_after_exists EQ space OR
96
*                    <vim_tot_mkey_after> EQ <vim_mkey_after> ).
97
            cur_mkey_found = 'X'. EXIT.
98
          ENDLOOP.
99
          IF cur_mkey_found NE space.
100
            IF <vim_prtfky_wa> IS INITIAL. "no entry -> use exist. value
101
              MOVE <vim_prtfky_total> TO <vim_prtfky_wa>.
102
              TRANSLATE <status>-upd_flag USING 'EY'.
103
              IF <status>-upd_flag EQ 'Y'.
104
                PERFORM (formname) IN PROGRAM (sy-repid)
105
                                   USING <table1> <table1_text>.
106
              ENDIF.
107
            ELSEIF <vim_prtfky_wa> NE <vim_prtfky_total>.
108
              MOVE 'X' TO prtfky_field_changed.
109
            ENDIF.
110
          ENDIF.
111
        ELSEIF <vim_prtfky_wa> NE <vim_prtfky_extract>.
112
          MOVE 'X' TO prtfky_field_changed.
113
        ENDIF.
114
        ADD 1 TO count.
115
      ENDLOOP.
116
      IF count EQ 1.
117
        MOVE 'X' TO vim_prtfky_assigned.
118
      ENDIF.
119
    ELSE.     " vim_prtfky_assigned = 'X'
120
      IF status-action EQ hinzufuegen OR status-action EQ kopieren OR
121
         vim_special_mode EQ vim_upgrade.
122
        LOOP AT total.                 "            current mainkey.
123
          CHECK <vim_tot_mkey_beforex> EQ <vim_mkey_beforex> AND
124
                ( vim_mkey_after_exists EQ space OR
125
                  <vim_tot_mkey_afterx> EQ <vim_mkey_afterx> ).
126
*          CHECK <vim_tot_mkey_before> EQ <vim_mkey_before> AND
127
*                ( vim_mkey_after_exists EQ space OR
128
*                  <vim_tot_mkey_after> EQ <vim_mkey_after> ).
129
          cur_mkey_found = 'X'. EXIT.
130
        ENDLOOP.
131
        IF cur_mkey_found NE space.
132
          IF <vim_prtfky_wa> IS INITIAL. "no entry -> use exist. value
133
            MOVE <vim_prtfky_total> TO <vim_prtfky_wa>.
134
            TRANSLATE <status>-upd_flag USING 'EY'.
135
            IF <status>-upd_flag EQ 'Y'.
136
              PERFORM (formname) IN PROGRAM (sy-repid)
137
                                 USING <table1> <table1_text>.
138
            ENDIF.
139
          ELSEIF <vim_prtfky_wa> NE <vim_prtfky_total>.
140
            MOVE 'X' TO prtfky_field_changed.
141
          ENDIF.
142
        ENDIF.
143
      ELSEIF <vim_prtfky_wa> NE <vim_prtfky_extract>.
144
        MOVE 'X' TO prtfky_field_changed.
145
      ENDIF.
146
    ENDIF.
147
*  if verändert.
148
    IF prtfky_field_changed NE space.
149
      IF cpff_alert NE space.
150
        sy-msgv1 = svim_text_030.
151
        sy-msgv2 = <vim_mainkey_mask>. TRANSLATE sy-msgv2 USING '+ '.
152
        IF x_header-clidep NE space.
153
          SHIFT sy-msgv2 BY client_length PLACES.
154
        ENDIF.
155
        count = strlen( sy-msgv2 ).
156
        ASSIGN sy-msgv2(count) TO <dummy1>.
157
        REPLACE '&' WITH <dummy1> INTO sy-msgv1.
158
        CALL FUNCTION 'POPUP_TO_CONFIRM_WITH_MESSAGE'
159
          EXPORTING
160
            diagnosetext1  = svim_text_031
161
            diagnosetext2  = svim_text_032
162
            diagnosetext3  = svim_text_033
163
            textline1      = svim_text_034
164
            textline2      = svim_text_035
165
            titel          = sy-msgv1
166
            cancel_display = space
167
          IMPORTING
168
            answer         = answer.
169
      ELSE.
170
        answer = 'J'.
171
      ENDIF.
172
      IF answer EQ 'A'.
173
        answer = 'N'.
174
      ENDIF.
175
      CASE answer.
176
*       WHEN 'A'. "cancel --> what to do ? same as NO ?
177
        WHEN 'J'.                      "yes, change all
178
          IF status-action EQ hinzufuegen OR status-action EQ kopieren.
179
            PERFORM check_key.
180
          ELSEIF ( x_header-customauth CO sap_cust_ctrl_classes OR
181
                   vim_ale_keyspec_check NE space ).
182
            PERFORM check_allowed_keyranges.
183
          ENDIF.
184
          LOOP AT total.
185
            CHECK <vim_xtotal_key> NE <f1_x> AND
186
                  <vim_tot_mkey_beforex> EQ <vim_mkey_beforex> AND
187
                  ( vim_mkey_after_exists EQ space OR
188
                    <vim_tot_mkey_afterx> EQ <vim_mkey_afterx> ).
189
*            CHECK <vim_total_key> NE <f1> AND
190
*                  <vim_tot_mkey_before> EQ <vim_mkey_before> AND
191
*                  ( vim_mkey_after_exists EQ space OR
192
*                    <vim_tot_mkey_after> EQ <vim_mkey_after> ).
193
*         move der entsprech. Felder --> gemäß X_NAMTAB, zum PBO füllen
194
            IF vim_prtfky_assigned CO ' Y'.
195
              LOOP AT x_namtab WHERE prtfrkyfld NE space.
196
                IF vim_prtfky_assigned EQ space.
197
                  IF x_header-bastab EQ space          "view
198
                   OR x_header-texttbexst EQ space     "no texttable
199
                   OR x_namtab-texttabfld EQ space.    "no texttabfield
200
* not a texttablefield in a table & texttable
201
                    ASSIGN: COMPONENT x_namtab-viewfield
202
                       OF STRUCTURE <table1>
203
                       TO <vim_prtfky_wa>,
204
                     COMPONENT x_namtab-viewfield
205
                      OF STRUCTURE <vim_total_struc>
206
                      TO <vim_prtfky_total>.
207
                  ELSE.
208
                    ASSIGN: COMPONENT x_namtab-viewfield
209
                             OF STRUCTURE <table1_text>
210
                             TO <vim_prtfky_wa>,
211
                            COMPONENT x_namtab-viewfield
212
                             OF STRUCTURE <vim_tot_txt_struc>
213
                             TO <vim_prtfky_total>.
214
                  ENDIF.
215
                ENDIF.
216
*                  IF x_header-bastab EQ space OR
217
*                     x_header-texttbexst EQ space OR
218
*                     x_namtab-texttabfld EQ space.
219
*                    ASSIGN <table1>+x_namtab-position(x_namtab-flength)
220
*                                              TO <vim_prtfky_wa>.
221
*                  ELSE.
222
*                    offs = x_namtab-position - x_header-tablen.
223
*                    ASSIGN <table1_text>+offs(x_namtab-flength)
224
*                                              TO <vim_prtfky_wa>.
225
*                  ENDIF.
226
*                ENDIF.
227
*                ASSIGN total+x_namtab-position(x_namtab-flength)
228
*                                         TO <vim_prtfky_total>.
229
                MOVE <vim_prtfky_wa> TO <vim_prtfky_total>.
230
              ENDLOOP.
231
            ELSE.
232
              MOVE <vim_prtfky_wa> TO <vim_prtfky_total>.
233
            ENDIF.
234
            MODIFY total.
235
            READ TABLE extract WITH KEY <vim_xtotal_key>.
236
            IF sy-subrc EQ 0.
237
              MOVE total TO extract.
238
              MODIFY extract INDEX sy-tabix.
239
            ENDIF.
240
          ENDLOOP.
241
          vim_prt_fky_flds_updated = 'X'.
242
        WHEN 'N'.
243
*       text aus Extract bzw. Total (hinzuf.) nehmen
244
          IF vim_prtfky_assigned CO ' Y'.
245
            LOOP AT x_namtab WHERE prtfrkyfld NE space.
246
              IF vim_prtfky_assigned EQ space.
247
                IF x_header-bastab EQ space             "view
248
                 OR x_header-texttbexst EQ space        "no texttable
249
               OR x_namtab-texttabfld EQ space.       "no texttabfield
250
* not a texttablefield in a table & texttable
251
                  ASSIGN: COMPONENT x_namtab-viewfield
252
                       OF STRUCTURE <table1>
253
                       TO <vim_prtfky_wa>,
254
                     COMPONENT x_namtab-viewfield
255
                      OF STRUCTURE <vim_total_struc>
256
                      TO <vim_prtfky_total>,
257
                     COMPONENT x_namtab-viewfield
258
                      OF STRUCTURE <vim_extract_struc>
259
                      TO  <vim_prtfky_extract>.
260
                ELSE.
261
                  ASSIGN: COMPONENT x_namtab-viewfield
262
                           OF STRUCTURE <table1_text>
263
                           TO <vim_prtfky_wa>,
264
                          COMPONENT x_namtab-viewfield
265
                           OF STRUCTURE <vim_tot_txt_struc>
266
                           TO <vim_prtfky_total>,
267
                          COMPONENT x_namtab-viewfield
268
                           OF STRUCTURE <vim_ext_txt_struc>
269
                           TO  <vim_prtfky_extract>.
270
                ENDIF.
271
              ENDIF.
272
*                IF x_header-bastab EQ space OR
273
*                   x_header-texttbexst EQ space OR
274
*                   x_namtab-texttabfld EQ space.
275
*                  ASSIGN <table1>+x_namtab-position(x_namtab-flength)
276
*                                            TO <vim_prtfky_wa>.
277
*                ELSE.
278
*                  offs = x_namtab-position - x_header-tablen.
279
*                  ASSIGN <table1_text>+offs(x_namtab-flength)
280
*                                            TO <vim_prtfky_wa>.
281
*                ENDIF.
282
*              ENDIF.
283
*              ASSIGN: total+x_namtab-position(x_namtab-flength)
284
*                                       TO <vim_prtfky_total>,
285
*                      extract+x_namtab-position(x_namtab-flength)
286
*                                       TO <vim_prtfky_extract>.
287
              IF status-action EQ hinzufuegen OR
288
                 status-action EQ kopieren OR
289
                 vim_special_mode EQ vim_upgrade.
290
                MOVE <vim_prtfky_total> TO <vim_prtfky_wa>.
291
              ELSE.
292
                MOVE <vim_prtfky_extract> TO <vim_prtfky_wa>.
293
              ENDIF.
294
            ENDLOOP.
295
          ELSE.
296
            IF status-action EQ hinzufuegen OR
297
               status-action EQ kopieren OR
298
               vim_special_mode EQ vim_upgrade.
299
              MOVE <vim_prtfky_total> TO <vim_prtfky_wa>.
300
            ELSE.
301
              MOVE <vim_prtfky_extract> TO <vim_prtfky_wa>.
302
            ENDIF.
303
          ENDIF.
304
          IF ( x_header-bastab EQ space OR  "view or no texttab and..
305
               x_header-texttbexst EQ space ) AND
306
             <table1_x> EQ <vim_xextract>.     "..no change
307
            CLEAR <status>-upd_flag.
308
          ELSEIF x_header-bastab NE space AND "bastab with texttab and
309
                 x_header-texttbexst NE space AND
310
                 <table1_xtext> EQ <vim_xextract_text>.
311
* no change of text
312
            TRANSLATE <status>-upd_flag USING 'XET '.
313
          ENDIF.
314
      ENDCASE.
315
    ENDIF. "vim_prtfky_field_changed ne space
316
  ENDIF. "COUNT eq 99   other entries for mainkey (may be) exist
317
ENDFORM.                               "consistency_prt_frky_fields