Properties SourceCde
txt
1
*---------------------------------------------------------------------*
2
*       FORM UPDATE_CORR                                              *
3
*---------------------------------------------------------------------*
4
*       update correction command file                                *
5
* UF230499: no changing of X_HEADER-KEYLEN if key is to long for
6
*           transport. Move appropriate key length to KEYLEN instead.
7
* UF170200: same for translated text fields
8
*---------------------------------------------------------------------*
9
* CORR_ACTION ->(glob) action: D - delete from, A - add to command file
10
*---------------------------------------------------------------------*
11
FORM update_corr.
12
  LOCAL: x_header.
13
  DATA: rc LIKE sy-subrc, fails TYPE i, flag TYPE c, rc1 LIKE sy-subrc,
14
        uc_addr_71ktab LIKE e071k OCCURS 0, addr_e071k LIKE e071k,
15
        object_key TYPE ad_objkey, keylen TYPE syfleng,
16
        txtkeylen TYPE syfleng, sys_type(10) TYPE c,
17
        texttab_wa TYPE REF TO data,
18
        max_trsp_keylength_in_byte type i.
19
  FIELD-SYMBOLS: <adr_obj_key> TYPE x, <texttab_wa> TYPE ANY,
20
                 <texttab_wax> TYPE x, <lang> TYPE ANY.
21
 
22
  CHECK maint_mode EQ aendern OR maint_mode EQ transportieren.
23
  CHECK x_header-flag NE vim_transport_denied.
24
  max_trsp_keylength_in_byte = vim_max_trsp_keylength
25
   * cl_abap_char_utilities=>charsize.
26
  CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'transport/systemtype'
27
                     ID 'VALUE' FIELD sys_type.
28
  IF x_header-keylen GT max_trsp_keylength_in_byte.
29
    keylen = x_header-maxtrkeyln.                           "UF230499
30
  ELSE.                                                     "UF230499
31
    keylen = x_header-keylen.                               "UF230499
32
  ENDIF.
33
  IF x_header-textkeylen GT max_trsp_keylength_in_byte.
34
    txtkeylen = x_header-maxtrtxkln.                        "UF230499
35
  ELSE.                                                     "UF230499
36
    txtkeylen = x_header-textkeylen.                        "UF230499
37
  ENDIF.
38
  IF x_header-adrnbrflag EQ 'N'.
39
    ASSIGN object_key TO <adr_obj_key> CASTING.
40
    LOOP AT vim_addr_e071k_tab INTO addr_e071k.
41
      e071k-trkorr = <status>-corr_nbr.
42
    ENDLOOP.
43
  ENDIF.
44
  IF status-action EQ transportieren.
45
* force marked entries
46
************************************************************************
47
    CHECK vim_client_state NE vim_local_clnt.
48
    IF status-mode EQ list_bild.
49
* overview_screen
50
      IF ( x_header-frm_e071ks NE space OR x_header-flag EQ space ) AND
51
         vim_called_by_cluster NE space.
52
        PERFORM vim_store_state_info.
53
        CALL FUNCTION 'VIEWCLUSTER_TRANS_DEPENDENT'
54
          EXPORTING
55
            view_name   = x_header-viewname
56
            action      = corr_action
57
            status_mode = status-mode
58
            workarea    = extract
59
            no_dialog   = vim_external_mode
60
            corr_number = <status>-corr_nbr.
61
      ENDIF.
62
      CLEAR counter.
63
      LOOP AT extract.
64
        CHECK <xmark> EQ markiert.
65
        PERFORM move_extract_to_view_wa.
66
        IF x_header-flag EQ space.     "standard logging required
67
          IF x_header-bastab EQ space. "view
68
            PERFORM (corr_formname) IN PROGRAM (sy-repid)
69
                                                   USING corr_action rc.
70
          ELSE.                        "base table
71
            corr_keytab =  e071k.
72
            corr_keytab-objname = x_header-maintview.
73
            MOVE <vim_xextract_key> TO <vim_corr_keyx>(keylen).
74
            PERFORM update_corr_keytab USING corr_action rc.
75
            IF x_header-texttbexst NE space AND  "base table with
76
            <vim_xextract_text> NE <text_initial_x>.     "text table
77
* only texttable's original language shall be transported internally
78
              corr_keytab =  e071k.
79
              corr_keytab-objname = x_header-texttab.
80
              MOVE <vim_xextract_text> TO <vim_corr_keyx>(txtkeylen).
81
              PERFORM update_corr_keytab USING corr_action rc1.
82
              IF rc1 EQ 0. MOVE rc1 TO rc. ENDIF.
83
            ENDIF.
84
          ENDIF.
85
          IF x_header-texttbexst <> space AND        "SW Texttransl ..
86
             vim_texttab_is_ro EQ space.
87
            PERFORM vim_text_keytab_entry
88
                    USING <vim_xextract_key> corr_action rc1.
89
            IF rc1 EQ 0. MOVE rc1 TO rc. ENDIF.
90
          ENDIF.                       ".. Texttransl
91
          IF x_header-adrnbrflag EQ 'O' AND <address_number> NE space.
92
            PERFORM vim_address_keytab_entries USING corr_action rc1.
93
            IF rc1 EQ 0. MOVE rc1 TO rc. ENDIF.
94
          ELSEIF x_header-adrnbrflag EQ 'N' AND
95
                 <address_number> NE space.
96
            APPEND LINES OF vim_addr_e071k_tab TO uc_addr_71ktab.
97
*            object_key = <vim_total_key>.
98
            <adr_obj_key>(keylen) = <vim_xextract_key>. "UF474925/2000
99
            CALL FUNCTION 'ADDR_TRANSPORT_ENTRIES'
100
              EXPORTING
101
                addrnumber = <address_number>
102
                table_name = vim_addr_basetable
103
                field_name = vim_addr_bastab_field
104
                objkey     = object_key
105
              TABLES
106
                e071k_tab  = uc_addr_71ktab.
107
            vim_exit_11_12_active = 'X'.
108
            LOOP AT uc_addr_71ktab INTO corr_keytab WHERE
109
             mastername = vim_addr_e071k_master_46 OR    "UF688403/2000
110
             mastername = vim_addr_e071k_master.
111
* Rel < 4.6A: ignore old type address entries inserted only for downward
112
*             compatibility
113
              PERFORM update_corr_keytab USING corr_action rc1.
114
              IF rc1 EQ 0. MOVE rc1 TO rc. ENDIF.
115
            ENDLOOP.
116
            REFRESH uc_addr_71ktab.
117
            CLEAR vim_exit_11_12_active.
118
          ENDIF.
119
        ENDIF.                         "standard logging required
120
        IF x_header-frm_e071ks NE space.
121
          vim_exit_11_12_active = 'X'.
122
          PERFORM (x_header-frm_e071ks) IN PROGRAM (sy-repid).
123
          IF sy-subrc EQ 0. MOVE sy-subrc TO rc. ENDIF.
124
          CLEAR vim_exit_11_12_active.
125
        ELSE.
126
          IF x_header-frm_e071 NE space AND
127
             x_header-frm_e071ka EQ space.
128
            <status>-keytbmodfd = 'X'.
129
          ENDIF.
130
          IF x_header-flag NE space.
131
            EXIT.
132
          ENDIF.
133
        ENDIF.
134
        IF rc NE 0.
135
          ADD 1 TO fails.
136
          IF replace_mode NE space.
137
            READ TABLE total WITH KEY <vim_xextract_key> BINARY SEARCH.
138
            <mark> = <xmark> = nicht_markiert.
139
            MODIFY total INDEX sy-tabix.
140
            MODIFY extract.
141
            SUBTRACT: 1 FROM mark_total, 1 FROM mark_extract.
142
            ok_code = 'IGN '.
143
          ENDIF.
144
        ELSE.
145
          READ TABLE total WITH KEY <vim_xextract_key> BINARY SEARCH.
146
          <mark> = <xmark> = nicht_markiert.
147
*          IF rc EQ 0.                          "??? UF222098
148
          CASE corr_action.
149
            WHEN hinzufuegen.
150
              MOVE transportieren TO <action>.
151
            WHEN geloescht.
152
              CLEAR <action>.
153
          ENDCASE.
154
          <xact> = <action>.
155
*          ENDIF.
156
          MODIFY total INDEX sy-tabix.
157
          MODIFY extract.
158
          SUBTRACT: 1 FROM mark_total, 1 FROM mark_extract.
159
        ENDIF.
160
        ADD 1 TO counter.
161
      ENDLOOP.
162
      IF counter GT fails.
163
        IF fails GT 0.
164
          MOVE 4 TO rc.
165
        ELSE.
166
          CLEAR rc.
167
        ENDIF.
168
      ELSE.
169
        MOVE 8 TO rc.
170
      ENDIF.
171
      IF replace_mode EQ space.
172
        IF corr_action EQ hinzufuegen.
173
          IF counter EQ 1.
174
            IF rc EQ 0.
175
          MESSAGE s098(sv) WITH <status>-corr_nbr. "Eintr. in K. aufgen.
176
            ELSE.
177
          MESSAGE s107(sv) WITH <status>-corr_nbr. "Eintr. schon enthal.
178
            ENDIF.
179
          ELSE.
180
            SUBTRACT fails FROM counter.
181
            CASE rc.
182
              WHEN 0.
183
                MESSAGE s105(sv) WITH counter
184
                                <status>-corr_nbr. "Eintr. in K. aufgen.
185
              WHEN 4.
186
                MESSAGE s109(sv) WITH counter fails
187
                                  <status>-corr_nbr. "Eintr. schon enth.
188
              WHEN 8.
189
                MESSAGE s108(sv) WITH fails
190
                                  <status>-corr_nbr. "Eintr. schon enth.
191
            ENDCASE.
192
          ENDIF.
193
        ELSE.
194
          IF counter EQ 1.
195
            IF rc EQ 0.
196
          MESSAGE s099(sv) WITH <status>-corr_nbr. "Eintr.aus K. gelösch
197
            ELSE.
198
          MESSAGE s110(sv) WITH <status>-corr_nbr. "Eintr. schon enthal.
199
            ENDIF.
200
          ELSE.
201
            SUBTRACT fails FROM counter.
202
            CASE rc.
203
              WHEN 0.
204
                MESSAGE s106(sv) WITH counter
205
                               <status>-corr_nbr. "Eintr. aus K. gelösch
206
              WHEN 4.
207
                MESSAGE s111(sv) WITH counter fails
208
                                  <status>-corr_nbr. "Eintr. nicht enth.
209
              WHEN 8.
210
                MESSAGE s112(sv) WITH fails
211
                                  <status>-corr_nbr. "Eintr. nicht enth.
212
            ENDCASE.
213
          ENDIF.
214
        ENDIF.
215
      ENDIF.                           "replace_mode eq space
216
    ELSE.
217
* detail screen
218
      IF x_header-flag EQ space.
219
* standard logging required
220
        IF x_header-bastab EQ space.
221
* view
222
          PERFORM (corr_formname) IN PROGRAM (sy-repid)
223
                                                   USING corr_action rc.
224
        ELSE.
225
* base table
226
          corr_keytab =  e071k.
227
          corr_keytab-objname = x_header-maintview.
228
*          MOVE <table1> TO corr_keytab-tabkey(x_header-keylen).
229
          MOVE <table1_x> TO <vim_corr_keyx>(keylen).
230
          PERFORM update_corr_keytab USING corr_action rc.
231
          IF x_header-texttbexst NE space
232
           AND <table1_text> NE <text_initial>.
233
* base table with text table
234
            corr_keytab =  e071k.
235
            corr_keytab-objname = x_header-texttab.
236
            MOVE <table1_xtext> TO <vim_corr_keyx>(txtkeylen).
237
            PERFORM update_corr_keytab USING corr_action rc1.
238
            IF rc1 EQ 0. MOVE rc1 TO rc. ENDIF.
239
          ENDIF.
240
        ENDIF.
241
        IF x_header-texttbexst <> space AND        "SW Texttransl ..
242
           vim_texttab_is_ro EQ space.
243
          PERFORM vim_text_keytab_entry
244
                  USING <table1_x> corr_action rc1.
245
          IF rc1 EQ 0. MOVE rc1 TO rc. ENDIF.
246
        ENDIF.                         ".. Texttransl
247
        IF x_header-adrnbrflag EQ 'O' AND <address_number> NE space.
248
          PERFORM vim_address_keytab_entries USING corr_action rc1.
249
          IF rc1 EQ 0. MOVE rc1 TO rc. ENDIF.
250
        ELSEIF x_header-adrnbrflag EQ 'N' AND
251
               <address_number> NE space.
252
* transport addresses
253
          APPEND LINES OF vim_addr_e071k_tab TO uc_addr_71ktab.
254
*          object_key = <vim_extract_key>.
255
          <adr_obj_key>(keylen) = <vim_xextract_key>.
256
          CALL FUNCTION 'ADDR_TRANSPORT_ENTRIES'
257
            EXPORTING
258
              addrnumber = <address_number>
259
              table_name = vim_addr_basetable
260
              field_name = vim_addr_bastab_field
261
              objkey     = object_key
262
            TABLES
263
              e071k_tab  = uc_addr_71ktab.
264
          vim_exit_11_12_active = 'X'.
265
          LOOP AT uc_addr_71ktab INTO corr_keytab WHERE
266
           mastername = vim_addr_e071k_master_46 OR    "UF688403/2000
267
           mastername = vim_addr_e071k_master.
268
* Rel < 4.6A: ignore old type address entries inserted only for downward
269
*             compatibility
270
            PERFORM update_corr_keytab USING corr_action rc1.
271
            IF rc1 EQ 0. MOVE rc1 TO rc. ENDIF.
272
          ENDLOOP.
273
          REFRESH uc_addr_71ktab.
274
          CLEAR vim_exit_11_12_active.
275
        ENDIF.
276
      ENDIF.                           "standard logging required
277
      IF x_header-frm_e071ks NE space.
278
        vim_exit_11_12_active = 'X'.
279
        PERFORM (x_header-frm_e071ks) IN PROGRAM (sy-repid).
280
        IF sy-subrc EQ 0. MOVE sy-subrc TO rc. ENDIF.
281
        CLEAR vim_exit_11_12_active.
282
      ELSE.
283
        IF x_header-frm_e071 NE space AND
284
           x_header-frm_e071ka EQ space.
285
          IF x_header-flag NE space.
286
            <status>-keytbmodfd = 'E'.
287
          ELSE.
288
            <status>-keytbmodfd = 'X'.
289
          ENDIF.
290
        ENDIF.
291
      ENDIF.
292
      IF <status>-keytbmodfd NE 'E'.
293
        IF vim_called_by_cluster NE space.
294
          PERFORM vim_store_state_info.
295
          CALL FUNCTION 'VIEWCLUSTER_TRANS_DEPENDENT'
296
            EXPORTING
297
              view_name   = x_header-viewname
298
              action      = corr_action
299
              status_mode = status-mode
300
              workarea    = extract
301
              no_dialog   = vim_external_mode
302
              corr_number = <status>-corr_nbr.
303
        ENDIF.
304
      ELSE.
305
        <status>-keytbmodfd = 'X'.
306
      ENDIF.
307
      READ TABLE total WITH KEY <vim_xextract_key> BINARY SEARCH.
308
      IF rc EQ 0.
309
        CASE corr_action.
310
          WHEN hinzufuegen.
311
            MOVE transportieren TO <action>.
312
          WHEN geloescht.
313
            CLEAR <action>.
314
        ENDCASE.
315
        <xact> = <action>.
316
        MOVE 'X' TO flag.
317
      ELSE.
318
        IF replace_mode NE space.
319
          ok_code = 'IGN '.
320
        ENDIF.
321
      ENDIF.
322
      IF <xmark> EQ markiert.
323
        <mark> = <xmark> = nicht_markiert.
324
        SUBTRACT: 1 FROM mark_total, 1 FROM mark_extract.
325
        MOVE 'X' TO flag.
326
      ENDIF.
327
      IF flag NE space.
328
        MODIFY total INDEX sy-tabix.
329
        MODIFY extract INDEX nextline.
330
      ENDIF.
331
      IF replace_mode EQ space.
332
        IF corr_action EQ hinzufuegen.
333
          IF rc EQ 0.
334
            MESSAGE s098(sv) WITH <status>-corr_nbr."Eintr. in K. aufg.
335
          ELSE.
336
            MESSAGE s107(sv) WITH <status>-corr_nbr."Eintr. schon enthl.
337
          ENDIF.
338
        ELSE.
339
          IF rc EQ 0.
340
            MESSAGE s099(sv) WITH <status>-corr_nbr."Eintr.aus K. gelösc
341
          ELSE.
342
            MESSAGE s110(sv) WITH <status>-corr_nbr."Eintr. schon enthl.
343
          ENDIF.
344
        ENDIF.
345
      ENDIF.
346
    ENDIF.
347
  ELSE.
348
* logging of changed entries
349
***********************************************************************
350
    CHECK vim_client_state EQ vim_log.
351
    corr_action = hinzufuegen.
352
*   REFRESH CORR_KEYTAB. "only delete all keys for current object
353
    LOOP AT vim_corr_objtab WHERE objfunc NE space.
354
      LOOP AT corr_keytab WHERE mastertype EQ vim_corr_objtab-object
355
                            AND mastername EQ vim_corr_objtab-obj_name.
356
        DELETE corr_keytab.
357
      ENDLOOP.
358
    ENDLOOP.
359
    LOOP AT total.
360
      IF x_header-flag EQ space.       "standard logging required
361
        IF x_header-bastab EQ space.   "view
362
          CHECK <action> NE original AND <action> NE neuer_geloescht.
363
          MOVE <vim_total_struc> TO <table1>.
364
          PERFORM (corr_formname) IN PROGRAM (sy-repid)
365
                                                  USING corr_action rc.
366
        ELSE.                          "base table
367
          IF x_header-texttbexst EQ space.
368
            CHECK <action> NE original AND <action> NE neuer_geloescht.
369
          ELSE.
370
          CHECK <action> NE original AND <action> NE neuer_geloescht OR
371
                                         <action_text> NE original AND
372
                                       <action_text> NE neuer_geloescht.
373
          ENDIF.
374
          MOVE <vim_total_struc> TO <table1>.
375
          corr_keytab =  e071k.
376
          corr_keytab-objname = x_header-maintview.
377
          MOVE <vim_xtotal_key> TO <vim_corr_keyx>(keylen).
378
          PERFORM update_corr_keytab USING corr_action rc.
379
          IF x_header-texttbexst NE space AND       "base table with
380
             <vim_xtotal_text> NE <text_initial_x>. "text table
381
            corr_keytab =  e071k.
382
            corr_keytab-objname = x_header-texttab.
383
            MOVE <vim_xtotal_text> TO <vim_corr_keyx>(txtkeylen).
384
            PERFORM update_corr_keytab USING corr_action rc1.
385
          ENDIF.
386
        ENDIF.                         "base table or view
387
        IF x_header-adrnbrflag EQ 'O' AND <address_number> NE space.
388
          PERFORM vim_address_keytab_entries USING corr_action rc1.
389
        ELSEIF x_header-adrnbrflag EQ 'N' AND <address_number> NE space.
390
          READ TABLE vim_addresses_to_save
391
                        WITH KEY viewname = x_header-viewname
392
                                 addrnumber = <address_number>
393
                        BINARY SEARCH TRANSPORTING NO FIELDS.
394
          IF sy-subrc NE 0.            "only existing addresses possible
395
            APPEND LINES OF vim_addr_e071k_tab TO uc_addr_71ktab.
396
*            object_key = <vim_extract_key>.
397
            <adr_obj_key>(keylen) = <vim_xtotal_key>. "UF686454/2000
398
            CALL FUNCTION 'ADDR_TRANSPORT_ENTRIES'
399
              EXPORTING
400
                addrnumber = <address_number>
401
                table_name = vim_addr_basetable
402
                field_name = vim_addr_bastab_field
403
                objkey     = object_key
404
              TABLES
405
                e071k_tab  = uc_addr_71ktab.
406
            vim_exit_11_12_active = 'X'.
407
            LOOP AT uc_addr_71ktab INTO corr_keytab WHERE
408
             mastername = vim_addr_e071k_master_46 OR    "UF688403/2000
409
             mastername = vim_addr_e071k_master.
410
* Rel < 4.6A: ignore old type address entries inserted only for downward
411
*             compatibility
412
              PERFORM update_corr_keytab USING corr_action rc1.
413
              IF rc1 EQ 0. MOVE rc1 TO rc. ENDIF.
414
            ENDLOOP.
415
            REFRESH uc_addr_71ktab.
416
            CLEAR vim_exit_11_12_active.
417
          ENDIF.
418
        ENDIF.
419
      ENDIF.                           "standard logging required
420
      IF x_header-frm_e071ks NE space.
421
        vim_exit_11_12_active = 'X'.
422
        PERFORM (x_header-frm_e071ks) IN PROGRAM (sy-repid).
423
        CLEAR vim_exit_11_12_active.
424
      ELSE.
425
        IF x_header-flag NE space.
426
          EXIT.
427
        ENDIF.
428
      ENDIF.
429
    ENDLOOP.
430
    IF x_header-flag EQ space AND      "standard logging required
431
       x_header-texttbexst <> space.   "SW Texttransl ..
432
      PERFORM vim_text_keytab_entries USING corr_action rc1
433
                                            keylen          "UF170200
434
                                            txtkeylen.      "UF170200
435
    ENDIF.                             ".. Texttransl
436
  ENDIF.                               "maint_mode transport or update
437
  IF x_header-frm_e071ka NE space.
438
    vim_exit_11_12_active = 'X'.
439
    PERFORM (x_header-frm_e071ka) IN PROGRAM (sy-repid).
440
    CLEAR vim_exit_11_12_active.
441
    IF status-action EQ transportieren AND x_header-flag NE space AND
442
       x_header-frm_e071 NE space AND x_header-frm_e071ks EQ space AND
443
       vim_called_by_cluster NE space.
444
      PERFORM vim_store_state_info.
445
      CALL FUNCTION 'VIEWCLUSTER_TRANS_DEPENDENT'
446
        EXPORTING
447
          view_name   = x_header-viewname
448
          action      = corr_action
449
          status_mode = status-mode
450
          workarea    = extract
451
          no_dialog   = vim_external_mode
452
          corr_number = <status>-corr_nbr.
453
    ENDIF.
454
  ENDIF.
455
ENDFORM.                    "update_corr