Properties SourceCde
txt
1
***INCLUDE LSVIMFXL.
2
* SW 25.3.1997
3
*    Readonly-Felder in Texttabelle berücksichtigen
4
 
5
* SW 14.7.1998
6
*    Import für Texte in anderen Sprachen    "Textimp
7
 
8
* SW 17.9.1998
9
*    beim Kopieren Texte in anderen Sprachen berücksichtigen   "Textcopy
10
* UF 19.10.1998: DB-Zugriffe in Include LSVIMFL1 verlagert
11
INCLUDE lsvimfl1.
12
*---------------------------------------------------------------------*
13
*       FORM VIM_SET_LANGUAGES                                        *
14
*---------------------------------------------------------------------*
15
* Sprachauswahl expl. über Menue
16
*---------------------------------------------------------------------*
17
FORM vim_set_languages.
18
  DATA: dummy_langus LIKE h_t002 OCCURS 0.
19
  CALL FUNCTION 'VIEW_GET_LANGUAGES'
20
    EXPORTING
21
      new_selection         = 'X'
22
*      called_by_viewmaint   = 'X'
23
    TABLES
24
      languages             = dummy_langus
25
    EXCEPTIONS
26
      no_languages_possible = 1.
27
  IF sy-subrc = 1.
28
    MESSAGE s160(sv).
29
  ENDIF.
30
ENDFORM.                    "vim_set_languages
31
 
32
*---------------------------------------------------------------------*
33
*       FORM VIM_RESET_TEXTTAB                                        *
34
*---------------------------------------------------------------------*
35
* Rücksetzen der internen Texttabelle
36
*---------------------------------------------------------------------*
37
* --> VIEWNAME   Rücksetzen der Texttab für Tab/View VIEWNAME
38
*---------------------------------------------------------------------*
39
FORM vim_reset_texttab USING viewname LIKE tvdir-tabname.
40
 
41
  READ TABLE vim_texttab_container WITH KEY viewname = viewname
42
                         BINARY SEARCH.
43
  IF sy-subrc = 0.
44
    FREE vim_texttab_container-tabdata-tab_us.
45
    FREE vim_texttab_container-tabdata-tab_vs.
46
    FREE vim_texttab_container-tabdata-tab_s.
47
    FREE vim_texttab_container-tabdata-tab_m.
48
    FREE vim_texttab_container-tabdata-tab_l.
49
    FREE vim_texttab_container-tabdata-tab_vl.
50
    FREE vim_texttab_container-tabdata-tab_ul.
51
    FREE vim_texttab_container-sel_langus.
52
    CLEAR vim_texttab_container-all_langus.
53
    MODIFY vim_texttab_container INDEX sy-tabix.
54
*     DELETE VIM_TEXTTAB_CONTAINER INDEX SY-TABIX.
55
  ENDIF.
56
ENDFORM.                               "VIM_RESET_TEXTTAB
57
 
58
*---------------------------------------------------------------------*
59
*       FORM VIM_MULTI_LANGU_TEXT_MAINT                               *
60
*---------------------------------------------------------------------*
61
* Routine zur Behandlung der Funktion:                                *
62
*   "Texterfassung in weiteren Sprachen"                              *
63
*---------------------------------------------------------------------*
64
FORM vim_multi_langu_text_maint.
65
  DATA: langus_selected(1) TYPE c,
66
        curr_sptxt LIKE t002t-sptxt,
67
        sel_langus LIKE h_t002 OCCURS 0 WITH HEADER LINE,
68
        texttab_for_output TYPE vimty_multilangu_texttab,
69
        maint_mode(1) TYPE c,
70
        textmodif(1) TYPE c,
71
        f_called_by_viewmaint TYPE c.  "XB H611377 BCEK070683
72
 
73
 
74
  CALL FUNCTION 'VIEW_GET_LANGUAGES'
75
    IMPORTING
76
      languages_selected    = langus_selected
77
      curr_sptxt            = curr_sptxt
78
    TABLES
79
      languages             = sel_langus
80
    EXCEPTIONS
81
      no_languages_possible = 1.
82
  IF sy-subrc = 1.
83
    MESSAGE s160(sv).
84
    EXIT.
85
  ELSEIF langus_selected = ' '.
86
    MESSAGE s153(sv).
87
    EXIT.
88
  ENDIF.
89
  IF x_header-frm_tl_get NE space.
90
    PERFORM (x_header-frm_tl_get) IN PROGRAM (x_header-fpoolname)
91
                                  TABLES sel_langus.
92
  ELSE.
93
    PERFORM vim_read_texttab_for_langus TABLES sel_langus USING ' '.
94
  ENDIF.
95
 
96
* Falls mehr als 8 Textfelder (noch nicht realisiert)
97
*    -> Popup zur Feldselektion und Dynproattribute aktualisieren
98
* PERFORM VIM_ACTUALIZE_D0100.
99
 
100
  REFRESH texttab_for_output.
101
  PERFORM vim_fill_texttab_for_maint TABLES sel_langus
102
                                     USING curr_sptxt
103
                                     CHANGING texttab_for_output.
104
  IF status-action EQ anzeigen OR status-action EQ transportieren.
105
    maint_mode = 'R'.
106
  ELSE.
107
    maint_mode = 'U'.
108
  ENDIF.
109
* XB H611377B BCEK070683
110
* check if it is called by view maintenance.
111
  IF x_namtab IS NOT INITIAL AND x_header IS NOT INITIAL.
112
    f_called_by_viewmaint = 'X'.
113
  ENDIF.
114
  CALL FUNCTION 'VIEW_MULTI_LANGU_TEXT_MAINT'
115
    EXPORTING
116
      mode                   = maint_mode
117
      ltext_exit_form        = x_header-frm_tltext
118
      called_by_viewmaint   = f_called_by_viewmaint
119
    IMPORTING
120
      vim_texttable_modified = textmodif
121
    TABLES
122
      vim_d0100_fielddescr   = vim_d0100_fdescr_ini
123
      vim_texttable          = texttab_for_output
124
      x_header               = x_header
125
      x_namtab               = x_namtab.
126
* XB H611377E BCE070683
127
  IF maint_mode = 'U' AND textmodif = 'X'.
128
    PERFORM vim_update_texttab USING texttab_for_output.
129
    MODIFY vim_texttab_container INDEX vim_texttab_container_index.
130
  ENDIF.
131
 
132
  IF status-mode = list_bild.          "Entmarkieren
133
    LOOP AT extract.
134
      CHECK <xmark> = markiert.
135
      CLEAR <xmark>.
136
      MODIFY extract.
137
      mark_extract = mark_extract - 1.
138
      READ TABLE total WITH KEY <vim_xextract_key> BINARY SEARCH.
139
      IF sy-subrc = 0 AND <mark> = markiert.
140
        CLEAR <mark>.
141
        MODIFY total INDEX sy-tabix.
142
        mark_total = mark_total - 1.
143
      ENDIF.
144
    ENDLOOP.
145
  ENDIF.
146
 
147
ENDFORM.                               " VIM_MULTI_LANGU_TEXT_MAINT
148
 
149
*---------------------------------------------------------------------*
150
*       FORM VIM_SELECT_TEXTFIELDS                                    *
151
*---------------------------------------------------------------------*
152
* Falls mehr als 8 Textfelder existieren -> Benutzerauswahl
153
*---------------------------------------------------------------------*
154
FORM vim_select_textfields.
155
  DATA: nr_of_fields TYPE i.
156
 
157
  nr_of_fields = 0.
158
  LOOP AT x_namtab WHERE keyflag <> 'X' AND
159
                         ( texttabfld = 'X' OR txttabfldn <> space ) AND
160
                     ( readonly = space OR readonly = 'R' )."SW 25.3.97
161
    "   Textfeld in Tabelle or Textfeld in View
162
    x_namtab-textfldsel = 'X'.
163
    nr_of_fields = nr_of_fields + 1.
164
    MODIFY x_namtab.
165
    IF nr_of_fields >= vim_max_textfields.   " Auswahl über Popup !!!
166
      EXIT.
167
    ENDIF.
168
  ENDLOOP.
169
ENDFORM.                               "VIM_SELECT_TEXTFIELDS
170
 
171
*---------------------------------------------------------------------*
172
*       FORM VIM_INITIALIZE_D0100                                     *
173
*---------------------------------------------------------------------*
174
* Initialierung der Attribute für Dynprofelder des Texterfassungs-    *
175
* Dynpros D0100 (View-unabhängig)                                     *
176
*---------------------------------------------------------------------*
177
FORM vim_initialize_d0100.
178
  DATA: fdescr_wa TYPE vimty_screen_fdescr.
179
 
180
  REFRESH vim_d0100_fdescr_ini.
181
* Keys
182
  CLEAR fdescr_wa.
183
  fdescr_wa-active = 'X'.
184
  fdescr_wa-name = 'VIM_D0100_WORKAREA-KEY1'.
185
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
186
  CLEAR fdescr_wa-active.
187
  fdescr_wa-name = 'VIM_D0100_WORKAREA-KEY2'.
188
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
189
  fdescr_wa-name = 'VIM_D0100_WORKAREA-KEY3'.
190
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
191
  fdescr_wa-name = 'VIM_D0100_WORKAREA-KEY4'.
192
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
193
  fdescr_wa-name = 'VIM_D0100_WORKAREA-KEY5'.
194
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
195
  fdescr_wa-name = 'VIM_D0100_WORKAREA-KEY6'.
196
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
197
  fdescr_wa-name = 'VIM_D0100_WORKAREA-KEY7'.
198
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
199
  fdescr_wa-name = 'VIM_D0100_WORKAREA-KEY8'.
200
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
201
  fdescr_wa-name = 'VIM_D0100_WORKAREA-KEY9'.
202
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
203
  fdescr_wa-name = 'VIM_D0100_WORKAREA-KEY10'.
204
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
205
* Sprache
206
  fdescr_wa-vislength = 10.
207
  fdescr_wa-active = 'X'.
208
  fdescr_wa-name = 'VIM_D0100_WORKAREA-SPTXT'.
209
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
210
* Texte
211
  fdescr_wa-name = 'VIM_D0100_WORKAREA-TEXT1'.
212
  fdescr_wa-textfld = 'X'.
213
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
214
  CLEAR fdescr_wa-active.
215
  fdescr_wa-textfld = 'X'.
216
  fdescr_wa-name = 'VIM_D0100_WORKAREA-TEXT2'.
217
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
218
  fdescr_wa-name = 'VIM_D0100_WORKAREA-TEXT3'.
219
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
220
  fdescr_wa-name = 'VIM_D0100_WORKAREA-TEXT4'.
221
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
222
  fdescr_wa-name = 'VIM_D0100_WORKAREA-TEXT5'.
223
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
224
  fdescr_wa-name = 'VIM_D0100_WORKAREA-TEXT6'.
225
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
226
  fdescr_wa-name = 'VIM_D0100_WORKAREA-TEXT7'.
227
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
228
  fdescr_wa-name = 'VIM_D0100_WORKAREA-TEXT8'.
229
  APPEND fdescr_wa TO vim_d0100_fdescr_ini.
230
ENDFORM.                               " VIM_INITIALIZE_D0100
231
 
232
*---------------------------------------------------------------------*
233
*       FORM VIM_ACTUALIZE_D0100                                      *
234
*---------------------------------------------------------------------*
235
* Attribute für Dynprofelder für aktuellen View aktualisieren         *
236
* (bzw. der ausgewählten Textfelder, falls mehr als 8 ex.             *
237
*          !!! noch nicht unterstützt  !!!                )           *
238
*---------------------------------------------------------------------*
239
FORM vim_actualize_d0100.
240
  DATA: fdescr_wa TYPE vimty_screen_fdescr,
241
        next_tabix LIKE sy-tabix,
242
        nr_of_field TYPE i,
243
        tot_keylen TYPE i,
244
        vislen_0(1) TYPE c,
245
        max_textlen TYPE i,
246
        tmp_len TYPE i,
247
        nr_of_text TYPE i.
248
  FIELD-SYMBOLS: <title> LIKE vimnamtab-scrtext.
249
 
250
  PERFORM vim_select_textfields.
251
  CLEAR: max_textlen, nr_of_text.
252
  LOOP AT x_namtab WHERE textfldsel = 'X'.
253
    nr_of_text = nr_of_text + 1.
254
    IF max_textlen < x_namtab-outputlen.
255
      max_textlen = x_namtab-outputlen.
256
    ENDIF.
257
  ENDLOOP.
258
  IF max_textlen > 30. max_textlen = 30. ENDIF.
259
 
260
  CLEAR: tot_keylen, nr_of_field, vislen_0.
261
  LOOP AT x_namtab WHERE keyflag = 'X' AND texttabfld <> 'X'.
262
    CHECK x_namtab-datatype <> 'CLNT' OR x_namtab-position > 0.
263
    CHECK x_namtab-readonly <> 'S' AND x_namtab-readonly <> 'H'.
264
    CHECK x_header-delmdtflag = space OR x_header-ptfrkyexst = space OR
265
          x_namtab-domname <> vim_delim_date_domain OR
266
          ( x_namtab-rollname NOT in VIM_BEGDA_TYPES and
267
            X_NAMTAB-ROLLNAME not IN vim_endda_types ).
268
    nr_of_field = nr_of_field + 1.
269
    tot_keylen = tot_keylen + x_namtab-outputlen.
270
    IF nr_of_field <= vim_max_keyfields.
271
      READ TABLE vim_d0100_fdescr_ini INDEX nr_of_field INTO fdescr_wa.
272
      fdescr_wa-title = x_namtab-scrtext.
273
      fdescr_wa-active = 'X'.
274
      fdescr_wa-fixlength = x_namtab-outputlen.
275
      tmp_len = tot_keylen + max_textlen.
276
      IF vislen_0 = 'X'.
277
        fdescr_wa-vislength = 0.
278
      ELSEIF tmp_len  > 70.            "???
279
        fdescr_wa-vislength = 70 - max_textlen -
280
                                 ( tot_keylen - x_namtab-outputlen ).
281
        vislen_0 = 'X'.
282
        IF fdescr_wa-vislength < 0.
283
          fdescr_wa-vislength = 0.
284
        ENDIF.
285
      ELSE.
286
        fdescr_wa-vislength = fdescr_wa-fixlength.
287
      ENDIF.
288
      IF nr_of_field < vim_max_keyfields.
289
        MODIFY vim_d0100_fdescr_ini FROM fdescr_wa INDEX nr_of_field.
290
      ENDIF.
291
    ELSE.
292
     fdescr_wa-fixlength = fdescr_wa-fixlength + x_namtab-outputlen + 1.
293
    ENDIF.
294
  ENDLOOP.
295
  IF nr_of_field >= vim_max_keyfields.
296
    fdescr_wa-title = '...'.
297
    fdescr_wa-active = 'X'.
298
    fdescr_wa-vislength = 0.
299
    MODIFY vim_d0100_fdescr_ini FROM fdescr_wa INDEX vim_max_keyfields.
300
  ELSE.
301
    next_tabix = nr_of_field + 1.
302
    LOOP AT vim_d0100_fdescr_ini INTO fdescr_wa
303
            FROM next_tabix TO vim_max_keyfields.
304
      CLEAR fdescr_wa-active.
305
      fdescr_wa-fixlength = 0.
306
      fdescr_wa-vislength = 0.
307
      CLEAR fdescr_wa-title.
308
      MODIFY vim_d0100_fdescr_ini FROM fdescr_wa.
309
    ENDLOOP.
310
  ENDIF.
311
  next_tabix = vim_max_keyfields + 1.                       "Sprachfeld
312
 
313
  LOOP AT x_namtab WHERE textfldsel = 'X'.
314
    IF x_namtab-readonly = space OR x_namtab-readonly = 'R'."SW 25.3.97
315
      next_tabix = next_tabix + 1.
316
      READ TABLE vim_d0100_fdescr_ini INDEX next_tabix INTO fdescr_wa.
317
      IF x_namtab-readonly = space.    "SW 25.3.1997
318
        fdescr_wa-active = 'X'.
319
      ELSEIF x_namtab-readonly = 'R'.  "SW 25.3.1997 ..
320
        fdescr_wa-active = 'R'.
321
      ENDIF.                           ".. SW 25.3.1997
322
      fdescr_wa-title = x_namtab-scrtext.
323
      fdescr_wa-fixlength = x_namtab-outputlen.
324
      fdescr_wa-vislength = x_namtab-outputlen.
325
      MODIFY vim_d0100_fdescr_ini FROM fdescr_wa INDEX next_tabix.
326
    ENDIF.
327
  ENDLOOP.
328
 
329
  next_tabix = next_tabix + 1.
330
  LOOP AT vim_d0100_fdescr_ini INTO fdescr_wa FROM next_tabix.
331
    CLEAR fdescr_wa-active.
332
    fdescr_wa-fixlength = 0.
333
    fdescr_wa-vislength = 0.
334
    CLEAR fdescr_wa-title.
335
    MODIFY vim_d0100_fdescr_ini FROM fdescr_wa.
336
  ENDLOOP.
337
ENDFORM.                               "VIM_ACTUALIZE_D0100
338
 
339
*---------------------------------------------------------------------*
340
*       FORM VIM_READ_TEXTTAB_FOR_LANGUS                              *
341
*---------------------------------------------------------------------*
342
* Texteinträge von der DB nachlesen für alle Sprachen, für die noch   *
343
* nicht eingelesen wurde                                              *
344
*---------------------------------------------------------------------*
345
* --> SEL_LANGUS         ausgewählte Sprachen
346
* --> ALL_LANGUS         'X' alle Sprachen wurden ausgewählt
347
*---------------------------------------------------------------------*
348
FORM vim_read_texttab_for_langus TABLES sel_langus STRUCTURE h_t002
349
                                 USING all_langus TYPE c.
350
  DATA: diff_langus_exist(1) TYPE c,
351
        diff_langus LIKE h_t002 OCCURS 0 WITH HEADER LINE.
352
 
353
  IF vim_texttab_container-all_langus = 'X'. EXIT. ENDIF. "alles eingel.
354
 
355
  vim_texttab_container-all_langus = all_langus.
356
  REFRESH diff_langus. CLEAR diff_langus_exist.
357
  LOOP AT sel_langus.
358
    READ TABLE <vim_read_langus> WITH KEY sel_langus-spras
359
                            TRANSPORTING NO FIELDS BINARY SEARCH.
360
    IF sy-subrc <> 0.
361
      INSERT sel_langus-spras INTO <vim_read_langus> INDEX sy-tabix.
362
      diff_langus = sel_langus-spras.
363
      APPEND diff_langus.
364
      diff_langus_exist = 'X'.
365
    ENDIF.
366
  ENDLOOP.
367
 
368
  IF diff_langus_exist = 'X' OR all_langus = 'X'.
369
    IF diff_langus_exist = 'X'.
370
      PERFORM vim_get_texttab_data TABLES diff_langus
371
                                 CHANGING <vim_texttab>.
372
    ENDIF.
373
    MODIFY vim_texttab_container INDEX vim_texttab_container_index.
374
*                        wegen <vim_read_langus> und <vim_texttab>
375
  ENDIF.
376
ENDFORM.                               " VIM_READ_TEXTTAB_FOR_LANGUS
377
 
378
*---------------------------------------------------------------------*
379
*       FORM VIM_FILL_TEXTTAB_FOR_MAINT                               *
380
*---------------------------------------------------------------------*
381
* Die zur Texterfassung in anderen Sprachen ausgewählten Texte werden *
382
* (anhand der markierten Einträge sowie der ausgewählten Sprachen)    *
383
* in die Tabelle zur Verarbeitung auf dem Dynpro übernommen.          *
384
*---------------------------------------------------------------------*
385
* --> SEL_LANGUS         ausgewählte Sprachen
386
* --> CURR_SPTXT         SPTXT von Sy-Langu
387
* <-- TEXTTAB_FOR_MAINT  Verarbeitungstabelle der ausgewählten Texte
388
*                        auf dem Dynpro
389
*---------------------------------------------------------------------*
390
FORM vim_fill_texttab_for_maint TABLES sel_langus STRUCTURE h_t002
391
               USING curr_sptxt LIKE t002t-sptxt
392
               CHANGING texttab_for_maint TYPE vimty_multilangu_texttab.
393
 
394
  DATA: textmaint_record TYPE vimty_textmaint_record,
395
        textmaint_field TYPE vimty_textfield,
396
        align1 TYPE f,
397
        texttab_wa TYPE vim_line_ul,
398
        align2 TYPE f,
399
        tmp_wa TYPE tabl8000,
400
        condense(1) TYPE c,
401
        texttab_tabix LIKE sy-tabix,
402
        extract_index LIKE sy-tabix,
403
        keylen type i.
404
  FIELD-SYMBOLS: <extract_key> TYPE x,
405
                 <next_spras> TYPE spras,
406
                 <text_rec_key> TYPE x, <h_texttab_wa> TYPE x,
407
                 <viewkey_in_texttab> TYPE x, <txtfld> TYPE ANY,
408
                 <h_tmp> TYPE x, <tmp_struc> TYPE ANY,
409
                 <h_texttab> TYPE x, <texttab_struc> TYPE ANY.
410
 
411
  IF x_header-delmdtflag <> space AND  "zeitabh. & part. Fremdschl.
412
     x_header-ptfrkyexst  = 'X'.       "      -> zeitunabh. Texttab.
413
    condense = 'X'.
414
    ASSIGN <vim_ext_mkey_beforex> TO <extract_key>.
415
*    ASSIGN <vim_ext_mkey_before> TO <extract_key>.
416
    keylen = x_header-after_keyc
417
     - vim_datum_length * cl_abap_char_utilities=>charsize.
418
*    keylen = x_header-keylen - vim_datum_length.
419
    CLEAR <vim_old_mkey_beforex>.
420
  ELSE.
421
    ASSIGN <vim_xextract_key> TO <extract_key>.
422
    keylen = x_header-after_keyc.
423
*    keylen = x_header-keylen.
424
    CLEAR condense.
425
  ENDIF.
426
  ASSIGN: texttab_wa TO <h_texttab_wa> CASTING,
427
          <h_texttab_wa>(keylen) TO <viewkey_in_texttab>,
428
*          texttab_wa+keylen(x_header-textkeylen) TO <texttab_key>,
429
          <h_texttab_wa>+keylen(x_header-texttablen) TO <h_texttab>,
430
          tmp_wa+keylen(x_header-texttablen)
431
           TO <h_tmp>,
432
          <h_texttab> TO <texttab_struc>
433
           CASTING TYPE (x_header-texttab),
434
          <h_tmp> TO <tmp_struc> CASTING TYPE (x_header-texttab),
435
          COMPONENT x_header-sprasfield OF STRUCTURE <texttab_struc>
436
           TO <next_spras>,
437
           textmaint_record-keys TO <text_rec_key> CASTING.
438
*  ASSIGN texttab_wa+offset(vim_spras_length) TO <next_spras>.
439
  IF status-mode = list_bild.
440
    extract_index = 1.
441
  ELSE.
442
    extract_index = nextline.
443
  ENDIF.
444
 
445
  LOOP AT extract FROM extract_index.  "Loop für Detail nicht nötig
446
    CHECK status-mode = detail_bild OR <xmark> = markiert.
447
    CHECK condense = ' ' OR
448
          <vim_old_mkey_beforex> <> <vim_ext_mkey_beforex>.
449
    IF condense = 'X'.
450
      <vim_old_mkey_beforex> = <vim_ext_mkey_beforex>.
451
    ENDIF.
452
*   Texte in Sy-Langu
453
    CLEAR textmaint_record.
454
    <text_rec_key> = <extract_key>.
455
*    textmaint_record-keys = <extract_key>.
456
    PERFORM vim_external_repr_for_key TABLES textmaint_record-keytab
457
                                      USING <vim_xextract_key>.
458
    textmaint_record-spras = sy-langu.
459
    textmaint_record-sptxt = curr_sptxt.
460
    IF x_header-bastab = space.
461
* view
462
      LOOP AT x_namtab WHERE textfldsel = 'X'.
463
        textmaint_field-namtab_idx = sy-tabix.
464
        textmaint_field-outplen = x_namtab-flength.
465
        ASSIGN COMPONENT x_namtab-viewfield OF STRUCTURE
466
         <vim_extract_struc> TO <txtfld>.
467
        textmaint_field-text = <txtfld>.
468
*      textmaint_field-text(x_namtab-flength) =
469
*                          extract+x_namtab-position(x_namtab-flength).
470
        APPEND textmaint_field TO textmaint_record-texttab.
471
      ENDLOOP.
472
    ELSE.
473
* tab + texttab
474
      LOOP AT x_namtab WHERE textfldsel = 'X'.
475
        textmaint_field-namtab_idx = sy-tabix.
476
        textmaint_field-outplen = x_namtab-flength.
477
        ASSIGN COMPONENT x_namtab-viewfield OF STRUCTURE
478
         <vim_ext_txt_struc> TO <txtfld>.
479
        textmaint_field-text = <txtfld>.
480
*      textmaint_field-text(x_namtab-flength) =
481
*                          extract+x_namtab-position(x_namtab-flength).
482
        APPEND textmaint_field TO textmaint_record-texttab.
483
      ENDLOOP.
484
    ENDIF.
485
    APPEND textmaint_record TO texttab_for_maint.
486
 
487
*   Texte in ausgewählten Sprachen
488
************************************************************************
489
    CLEAR: <viewkey_in_texttab>, <texttab_struc>.
490
*    CLEAR texttab_wa.
491
    READ TABLE <vim_texttab> WITH KEY <extract_key>
492
                               INTO texttab_wa. " BINARY SEARCH.
493
    texttab_tabix = sy-tabix.
494
    LOOP AT sel_langus.
495
      CLEAR textmaint_record.
496
      <text_rec_key> = <extract_key>.
497
*      textmaint_record-keys = <extract_key>.             "SW Langtext
498
      textmaint_record-spras = sel_langus-spras.
499
      textmaint_record-sptxt = sel_langus-sptxt.
500
 
501
      IF <viewkey_in_texttab> = <extract_key> AND
502
         <next_spras> < sel_langus-spras.                 "#EC PORTABLE
503
        LOOP AT <vim_texttab> FROM texttab_tabix INTO texttab_wa.
504
          IF <viewkey_in_texttab> <> <extract_key> OR
505
             <next_spras> >= sel_langus-spras.            "#EC PORTABLE
506
            texttab_tabix = sy-tabix.
507
            EXIT.
508
          ENDIF.
509
        ENDLOOP.
510
      ENDIF.   " <next_spras> >= sel_langus-spras oder ex. nicht
511
      IF <next_spras> <> sel_langus-spras OR
512
         <viewkey_in_texttab> <> <extract_key>.  "Text ex. nicht in Spr.
513
        CLEAR <tmp_struc>.
514
*        CLEAR tmp_wa.
515
      ELSE.
516
        tmp_wa = <h_texttab_wa>.
517
      ENDIF.
518
      LOOP AT x_namtab WHERE textfldsel = 'X'.
519
        textmaint_field-namtab_idx = sy-tabix.
520
        textmaint_field-outplen = x_namtab-flength.
521
        ASSIGN COMPONENT x_namtab-bastabfld OF STRUCTURE
522
*        ASSIGN COMPONENT x_namtab-viewfield OF STRUCTURE    "HCG wrong
523
        <tmp_struc> TO <txtfld>.    "HCG for txtfldname in view differs
524
        textmaint_field-text = <txtfld>.
525
*        offset = keylen + x_namtab-texttabpos.
526
*        textmaint_field-text(x_namtab-flength) =
527
*                   tmp_wa+offset(x_namtab-flength).
528
        APPEND textmaint_field TO textmaint_record-texttab.
529
      ENDLOOP.
530
      APPEND textmaint_record TO texttab_for_maint.
531
    ENDLOOP.                           " SEL_LANGUS
532
 
533
    IF status-mode = detail_bild. EXIT. ENDIF.
534
  ENDLOOP.                                                  " EXTRACT
535
ENDFORM.                               " VIM_FILL_TEXTTAB_FOR_MAINT
536
 
537
*&--------------------------------------------------------------------*
538
*&      Form  VIM_EXTERNAL_REPR_FOR_KEY                               *
539
*&--------------------------------------------------------------------*
540
* --> INT_KEY    Interne Darstellung der Schlüsselfelder
541
* <-- KEYTAB     Tabelle, externe      "
542
*&--------------------------------------------------------------------*
543
FORM vim_external_repr_for_key TABLES keytab "TYPE VIMTY_TEXTFIELD
544
                               USING int_key TYPE x.
545
  DATA: keynr TYPE i,
546
        keyfield TYPE vimty_textfield,
547
        namtab_idx LIKE sy-tabix.
548
  FIELD-SYMBOLS: <i_value> TYPE ANY, <e_value> TYPE c.
549
 
550
  CLEAR: keynr, keyfield. REFRESH keytab.
551
  MOVE int_key TO <table1_wax>.
552
  LOOP AT x_namtab WHERE keyflag = 'X' AND texttabfld <> 'X'.
553
    namtab_idx = sy-tabix.
554
*   Mandant nicht anzeigen
555
    CHECK x_namtab-datatype <> 'CLNT' OR x_header-clidep = space.
556
*   Subset- und Readonly-Felder nicht anzeigen
557
    CHECK x_namtab-readonly <> 'S' AND x_namtab-readonly <> 'H'.
558
*   Datum bei zeitunabh. Texttabelle nicht anzeigen
559
    CHECK x_header-delmdtflag = space OR x_header-ptfrkyexst = space OR
560
          x_namtab-domname <> vim_delim_date_domain OR
561
          ( x_namtab-rollname NOT in VIM_BEGDA_TYPES and
562
            X_NAMTAB-ROLLNAME not IN vim_endda_types ).
563
    keynr = keynr + 1.
564
    IF keynr > vim_max_keyfields.
565
      keyfield-text+keyfield-outplen(1) = '|'.
566
      keyfield-outplen = keyfield-outplen + 1.
567
    ENDIF.
568
    ASSIGN COMPONENT x_namtab-viewfield OF STRUCTURE <table1_wa>
569
     TO <i_value>.
570
*    ASSIGN int_key+x_namtab-position(x_namtab-flength) TO <i_value>.
571
    ASSIGN keyfield-text+keyfield-outplen(x_namtab-outputlen)
572
                                                       TO <e_value>.
573
    CALL FUNCTION 'VIEW_CONVERSION_OUTPUT'
574
      EXPORTING
575
        value_intern = <i_value>
576
        tabname      = x_header-maintview
577
        fieldname    = x_namtab-viewfield
578
        outputlen    = x_namtab-outputlen
579
        intlen       = x_namtab-flength
580
      IMPORTING
581
        value_extern = <e_value>.
582
 
583
    IF keynr < vim_max_keyfields.
584
      keyfield-namtab_idx = namtab_idx.
585
      keyfield-outplen = x_namtab-outputlen.
586
      APPEND keyfield TO keytab.
587
      CLEAR keyfield.
588
    ELSE.
589
      keyfield-outplen = keyfield-outplen + x_namtab-outputlen.
590
    ENDIF.
591
  ENDLOOP.
592
 
593
  IF keynr >= vim_max_keyfields.
594
    APPEND keyfield TO keytab.
595
  ENDIF.
596
ENDFORM.                               "VIM_EXTERNAL_REPR_FOR_KEY
597
 
598
*&--------------------------------------------------------------------*
599
*&      Form  VIM_FILL_TEXTTAB_KEY                                    *
600
*&--------------------------------------------------------------------*
601
* UF210800: Not unicode-compatible: Please use form
602
* MAP_VIEWKEY_TO_TEXTTABKEY instead
603
*
604
*&--------------------------------------------------------------------*
605
* --> VIEW_WA  WA of view                                             *
606
* --> SPRAS    Sprachschlüssel                                        *
607
* --> SPRAS_POS Position des Sprachschlüssel in VIEW_WA
608
* <-- TEXT_WA  Key of text table                                      *
609
*&--------------------------------------------------------------------*
610
*FORM vim_fill_texttab_key USING view_wa
611
*                                spras LIKE t002-spras
612
*                                spras_pos LIKE vimdesc-sprasfdpos
613
*                       CHANGING text_wa.
614
*
615
** Sprachschlüssel
616
** TEXT_WA+X_HEADER-SPRASFDPOS(VIM_SPRAS_LENGTH) = SPRAS.
617
*  text_wa+spras_pos(vim_spras_length) = spras.
618
** Schlüsselfelder der Text-Tabelle
619
*  LOOP AT x_namtab WHERE txttabfldn <> space AND keyflag <> space.
620
*    text_wa+x_namtab-texttabpos(x_namtab-flength) =
621
*         view_wa+x_namtab-position(x_namtab-flength).
622
*  ENDLOOP.
623
*ENDFORM.                               "VIM_FILL_TEXTTAB_KEY
624
*
625
*&--------------------------------------------------------------------*
626
*&      Form  VIM_FILL_VIEW_KEY                                       *
627
*&--------------------------------------------------------------------*
628
* Not usable in unicode-systems!!!!
629
* Please use form MAP_TEXTTABKEY_TO_VIEWKEY instead!
630
*&--------------------------------------------------------------------*
631
* --> TEXTTAB_WA  WA of text table                                    *
632
* <-- VIEW_KEY    KEY of view / table                                 *
633
* <-- SPRAS                                                           *
634
*&--------------------------------------------------------------------*
635
FORM vim_fill_view_key USING texttab_wa TYPE vim_line_ul
636
                   CHANGING view_key
637
                            spras LIKE t002-spras.
638
 
639
  LOOP AT x_namtab WHERE txttabfldn <> space AND keyflag <> space.
640
*   alle Schlüsselfelder, zu denen es Felder in der Texttabelle gibt
641
    view_key+x_namtab-position(x_namtab-flength) =
642
         texttab_wa+x_namtab-texttabpos(x_namtab-flength).
643
  ENDLOOP.
644
  spras = texttab_wa+x_header-sprasfdpos(vim_spras_length).
645
ENDFORM.                               "VIM_FILL_VIEW_KEY
646
 
647
*---------------------------------------------------------------------*
648
*       FORM VIM_UPDATE_TEXTTAB                                       *
649
*---------------------------------------------------------------------*
650
* Die vom Benutzer erfaßten/geänderten Texte  werden in die interne   *
651
* Texttabelle <VIM_TEXTTAB> übernommen                                *
652
*---------------------------------------------------------------------*
653
FORM vim_update_texttab
654
                USING texttab_for_maint TYPE vimty_multilangu_texttab.
655
  DATA: textmaint_record TYPE vimty_textmaint_record,
656
        textmaint_field TYPE vimty_textfield,
657
        align TYPE f,
658
        texttab_wa TYPE vim_line_ul,
659
        search_key TYPE tabl8000,
660
        offset LIKE sy-fdpos,
661
        keylen LIKE sy-fdpos,
662
        extract_index LIKE sy-tabix,
663
        total_index   LIKE sy-tabix,
664
        texttab_tabix LIKE sy-tabix,
665
        new_entry(1)  TYPE c,
666
        keylen_char type i.
667
  FIELD-SYMBOLS:
668
        <search_key> TYPE x, <rec_key> TYPE x, <curr_spras> TYPE ANY,
669
        <h_texttab_wa> TYPE x,
670
        <viewkey_in_texttab> TYPE x, "Key aus View/Tab in Texttab
671
        <texttab_key> TYPE x, <texttab_struc> TYPE ANY,
672
        <h_texttab> TYPE x, <tot_fld> TYPE ANY, <ext_fld> TYPE ANY,
673
        <texttab_action> TYPE c,
674
        <t_action>, <e_action>.
675
 
676
  IF x_header-delmdtflag <> space AND     "zeitabh. & part. Fremdschl.
677
     x_header-ptfrkyexst  = 'X'.          "      -> zeitunabh. Texttab.
678
    keylen = x_header-after_keyc
679
     - vim_datum_length * cl_abap_char_utilities=>charsize.
680
  ELSE.
681
    keylen = x_header-after_keyc.
682
  ENDIF.
683
  keylen_char = keylen / cl_abap_char_utilities=>charsize.
684
  ASSIGN: search_key(keylen) TO <search_key>,
685
          textmaint_record-keys(keylen_char) TO <rec_key> CASTING,
686
          texttab_wa TO <h_texttab_wa> CASTING,
687
          <h_texttab_wa>(keylen) TO <viewkey_in_texttab>,
688
          <h_texttab_wa>+keylen(x_header-textkeylen) TO <texttab_key>,
689
          <h_texttab_wa>+keylen(x_header-texttablen) TO <h_texttab>,
690
          <h_texttab> TO <texttab_struc>
691
           CASTING TYPE (x_header-texttab),
692
          COMPONENT x_header-sprasfield OF STRUCTURE <texttab_struc>
693
           TO <curr_spras>.
694
  offset = keylen + x_header-aft_txttbc.
695
  ASSIGN <h_texttab_wa>+offset(cl_abap_char_utilities=>charsize)
696
   TO <texttab_action> CASTING.
697
  IF x_header-bastab = 'X'.
698
* tab+texttab
699
    ASSIGN <action_text> TO <t_action>.
700
    ASSIGN <xact_text> TO <e_action>.
701
  ELSE.
702
    ASSIGN <action> TO <t_action>.
703
    ASSIGN <xact> TO <e_action>.
704
  ENDIF.
705
 
706
  LOOP AT texttab_for_maint INTO textmaint_record.
707
    IF textmaint_record-spras = sy-langu.
708
      <search_key> = <rec_key>.
709
      READ TABLE extract WITH KEY <search_key> BINARY SEARCH.
710
      extract_index = sy-tabix.
711
    ENDIF.
712
    CHECK textmaint_record-action = 'X'.      " Texte wurden modifiziert
713
 
714
    IF textmaint_record-spras = sy-langu.
715
*     Texte in Sy-Langu  => Update in Total und Extract
716
*      READ TABLE EXTRACT WITH KEY <SEARCH_KEY> BINARY SEARCH.
717
*      EXTRACT_INDEX = SY-TABIX.
718
      READ TABLE total WITH KEY <search_key> BINARY SEARCH.
719
      total_index = sy-tabix.
720
      IF x_header-bastab = 'X'
721
       AND <vim_xextract_text> = <text_initial_x>.
722
        PERFORM map_viewkey_to_texttabkey TABLES x_namtab
723
                                          USING x_header
724
                                                sy-langu
725
                                                <vim_xtotal>
726
                                          CHANGING <vim_xextract_text>.
727
        PERFORM map_viewkey_to_texttabkey TABLES x_namtab
728
                                          USING x_header
729
                                                sy-langu
730
                                                <vim_xtotal>
731
                                          CHANGING <vim_xtotal_text>.
732
*        PERFORM vim_fill_texttab_key USING <search_key> sy-langu
733
*                                           x_header-sprasfdpos
734
*                                  CHANGING <extract_text>.
735
*        PERFORM vim_fill_texttab_key USING <search_key> sy-langu
736
*                                           x_header-sprasfdpos
737
*                                  CHANGING <total_text>.
738
        <e_action> = neuer_eintrag.
739
        <t_action> = neuer_eintrag.
740
      ELSEIF <e_action> = original.
741
        <e_action> = aendern.
742
        <t_action> = aendern.
743
*     Else.                     " neuer_eintrag / aendern => ok
744
      ENDIF.
745
      LOOP AT textmaint_record-texttab INTO textmaint_field.
746
        READ TABLE x_namtab INDEX textmaint_field-namtab_idx.
747
        IF x_namtab-lowercase = space.
748
          TRANSLATE textmaint_field-text TO UPPER CASE.
749
        ENDIF.
750
        IF x_header-bastab = 'X'.
751
* tab + texttab
752
          ASSIGN: COMPONENT x_namtab-viewfield OF STRUCTURE
753
                   <vim_ext_txt_struc> TO <ext_fld>,
754
                  COMPONENT x_namtab-viewfield OF STRUCTURE
755
                   <vim_tot_txt_struc> TO <tot_fld>.
756
        ELSE.
757
* view
758
          ASSIGN: COMPONENT x_namtab-viewfield OF STRUCTURE
759
                   <vim_extract_struc> TO <ext_fld>,
760
                  COMPONENT x_namtab-viewfield OF STRUCTURE
761
                   <vim_total_struc> TO <tot_fld>.
762
        ENDIF.
763
        <tot_fld> = textmaint_field-text.
764
        <ext_fld> = textmaint_field-text.
765
*        extract+x_namtab-position(x_namtab-flength) =
766
*           textmaint_field-text(x_namtab-flength).
767
*        total+x_namtab-position(x_namtab-flength) =
768
*           textmaint_field-text(x_namtab-flength).
769
      ENDLOOP.                         "TEXTMAINT_RECORD-TEXTTAB
770
      MODIFY extract INDEX extract_index.
771
      MODIFY total INDEX total_index.
772
 
773
    ELSE.
774
* different language: Update in texttable
775
      CLEAR: <h_texttab_wa>, <texttab_struc>.
776
      READ TABLE <vim_texttab> WITH KEY <search_key>
777
                               INTO texttab_wa BINARY SEARCH.
778
      texttab_tabix = sy-tabix.
779
      IF <viewkey_in_texttab> = <search_key> AND   "Text ex. in and. Spr
780
         <curr_spras> < textmaint_record-spras.
781
        LOOP AT <vim_texttab> FROM texttab_tabix INTO texttab_wa.
782
          IF <viewkey_in_texttab> <> <search_key> OR
783
             <curr_spras> >= textmaint_record-spras.
784
            texttab_tabix = sy-tabix.
785
            EXIT.
786
          ELSEIF <curr_spras> < textmaint_record-spras.
787
            texttab_tabix = sy-tabix + 1.
788
          ENDIF.
789
        ENDLOOP.
790
      ENDIF.   " <next_spras> >= sel_langus-spras oder ex. nicht
791
      IF <viewkey_in_texttab> <> <search_key> OR
792
         <curr_spras> <> textmaint_record-spras.
793
        CLEAR: <texttab_struc>.
794
*        CLEAR texttab_wa.
795
        new_entry = 'X'.
796
        <viewkey_in_texttab> = <search_key>.
797
*        texttab_wa = <search_key>.
798
        <texttab_action> = neuer_eintrag.
799
        PERFORM map_viewkey_to_texttabkey TABLES x_namtab
800
                                          USING x_header
801
                                                textmaint_record-spras
802
                                                <viewkey_in_texttab>
803
                                          CHANGING <texttab_key>.
804
**        PERFORM vim_fill_texttab_key
805
*                            USING <search_key> textmaint_record-spras
806
*                                  x_header-sprasfdpos
807
*                            CHANGING <texttab_key>.
808
      ELSE.
809
        CLEAR new_entry.
810
      ENDIF.
811
*     Text-Values übernehmen
812
      LOOP AT textmaint_record-texttab INTO textmaint_field.
813
        READ TABLE x_namtab INDEX textmaint_field-namtab_idx.
814
*        offset = keylen + x_namtab-texttabpos.
815
        IF x_namtab-lowercase = space.
816
          TRANSLATE textmaint_field-text TO UPPER CASE.
817
        ENDIF.
818
        IF x_header-bastab = 'X'."HCG Custmessage 282684/02------------
819
* tab + texttab
820
          ASSIGN: COMPONENT x_namtab-viewfield OF STRUCTURE
821
*                   <vim_ext_txt_struc> TO <ext_fld>.
822
                   <texttab_struc> TO <ext_fld>. "XB int.40684/02
823
        ELSE.
824
* view, basis table field name.
825
          ASSIGN: COMPONENT x_namtab-BASTABFLD OF STRUCTURE
826
*                   <vim_extract_struc> TO <ext_fld>.
827
                   <texttab_struc> TO <ext_fld>. "XB int.. 40684
828
        ENDIF.
829
*        ASSIGN COMPONENT x_namtab-viewfield OF STRUCTURE
830
*---------      <texttab_struc> TO <ext_fld>."HCG Custmessage 282684/02
831
        <ext_fld> = textmaint_field-text.
832
*        texttab_wa+offset(x_namtab-flength) =
833
*           textmaint_field-text(x_namtab-flength).
834
      ENDLOOP.
835
      IF <texttab_action> = original.
836
        <texttab_action> = aendern.
837
      ENDIF.
838
      IF new_entry = 'X'.
839
        INSERT texttab_wa INTO <vim_texttab> INDEX texttab_tabix.
840
      ELSE.
841
        MODIFY <vim_texttab> FROM texttab_wa INDEX texttab_tabix.
842
      ENDIF.
843
 
844
    ENDIF.                             " Sy-Langu
845
  ENDLOOP.                             " TEXTTAB_FOR_MAINT
846
 
847
ENDFORM.                               " VIM_UPDATE_TEXTTAB
848
 
849
*---------------------------------------------------------------------*
850
*       FORM VIM_TEMP_DELIM_TEXTTAB                                   *
851
*---------------------------------------------------------------------*
852
* Abgrenzen für zeitabh. Texttabelle :                                *
853
*    neuen Eintrag für <vim_xtotal_key> für alle Sprachen in
854
*      Texttabelle erzeugen, bzw. -falls schon ex.- Texte darin ersetzen
855
*      Texte werden aus Originaleintrag ORIG_KEY übernommen
856
*    im Eintrag ENDDATE Texte löschen;
857
*      falls dieser neu ist -> gesammten Eintrag löschen
858
*---------------------------------------------------------------------*
859
* <vim_xtotal_key> = aktuell bearb. Intervall, entstanden durch
860
*                    Abgrenzen
861
* --> ENDDATE   Endedatum des neuen Intervalls
862
* --> ORIG_KEY  altes Endedatum des aktuellen Intervalls vor Abgrenzen
863
*---------------------------------------------------------------------*
864
FORM vim_temp_delim_texttab USING value(enddate)
865
                                  value(orig_key) TYPE x.
866
  DATA: texttab_orig TYPE vim_line_ul,
867
        texttab_new  TYPE vim_line_ul,
868
        align        TYPE f,
869
        old_key      TYPE tabl8000,
870
        orig_tabix LIKE sy-tabix,
871
        new_tabix  LIKE sy-tabix,
872
        len TYPE i,
873
        offset TYPE i,
874
        langus_selected(1) TYPE c,
875
        curr_sptxt LIKE t002t-sptxt,
876
        sel_langus LIKE h_t002 OCCURS 0 WITH HEADER LINE.
877
  FIELD-SYMBOLS: <texttab_orig_x> TYPE x,
878
                 <txttb_orig_struc> TYPE ANY,
879
                 <viewkey_in_orig> TYPE x,    "-> texttab_orig
880
                 <texttab_new_x> TYPE x,
881
                 <txttb_new_struc> TYPE ANY,
882
                 <viewkey_in_new> TYPE x,     "-> texttab_new
883
                 <spras_in_orig> TYPE spras,
884
                 <spras_in_new> TYPE spras,
885
                 <date_in_textkey_new> LIKE sy-datum,
886
                 <action_in_orig>,
887
                 <action_in_new>,
888
                 <textfields_in_new> TYPE x,
889
                 <textfields_in_orig> TYPE x,
890
                 <h_old_key> TYPE x, <old_key_enddate> LIKE sy-datum,
891
                 <old_keyx> TYPE x, <old_key_struc> TYPE ANY.
892
 
893
  CALL FUNCTION 'VIEW_GET_LANGUAGES'
894
    EXPORTING
895
      all_without_selection = 'X'
896
    IMPORTING
897
      languages_selected    = langus_selected
898
      curr_sptxt            = curr_sptxt
899
    TABLES
900
      languages             = sel_langus.
901
  IF x_header-frm_tl_get NE space.
902
    PERFORM (x_header-frm_tl_get) IN PROGRAM (x_header-fpoolname)
903
                                  TABLES sel_langus.
904
  ELSE.
905
    PERFORM vim_read_texttab_for_langus TABLES sel_langus USING 'X'.
906
  ENDIF.
907
 
908
  READ TABLE <vim_texttab> WITH KEY orig_key
909
                           BINARY SEARCH TRANSPORTING NO FIELDS.
910
  CHECK sy-subrc = 0.
911
  orig_tabix = sy-tabix.
912
  ASSIGN: texttab_orig TO <texttab_orig_x> CASTING,
913
          <texttab_orig_x>(x_header-keylen) TO <viewkey_in_orig>,
914
          <texttab_orig_x>+x_header-after_keyc
915
           TO <txttb_orig_struc> CASTING TYPE (x_header-texttab),
916
          COMPONENT x_header-sprasfield OF STRUCTURE <txttb_orig_struc>
917
           TO <spras_in_orig>.
918
  ASSIGN: texttab_new TO <texttab_new_x> CASTING,
919
          <texttab_new_x>(x_header-keylen) TO <viewkey_in_new>,
920
          <texttab_new_x>+x_header-after_keyc
921
           TO <txttb_new_struc> CASTING TYPE (x_header-texttab),
922
          COMPONENT x_header-sprasfield OF STRUCTURE <txttb_new_struc>
923
           TO <spras_in_new>.
924
  offset = x_header-after_keyc + x_header-textkeylen.
925
  len = x_header-aft_txttbc - x_header-textkeylen.
926
  ASSIGN: <texttab_new_x>+offset(len) TO <textfields_in_new>,
927
          <texttab_orig_x>+offset(len) TO <textfields_in_orig>.
928
  ASSIGN: old_key TO <h_old_key> CASTING,
929
          <h_old_key>(x_header-keylen) TO <old_keyx>,
930
          old_key TO <old_key_struc> CASTING TYPE (x_header-maintview).
931
*  ASSIGN texttab_orig(x_header-keylen) TO <viewkey_in_orig>.
932
*  ASSIGN texttab_new(x_header-keylen) TO <viewkey_in_new>.
933
*  offset = x_header-keylen + x_header-sprasfdpos.
934
*  ASSIGN texttab_orig+offset(vim_spras_length) TO <spras_in_orig>.
935
*  ASSIGN texttab_new+offset(vim_spras_length) TO <spras_in_new>.
936
  LOOP AT x_namtab WHERE keyflag = 'X' AND
937
    ( texttabfld = 'X' OR txttabfldn <> space ) AND
938
      domname EQ vim_delim_date_domain AND
939
    ( rollname IN vim_begda_types OR rollname IN vim_endda_types ).
940
*      offset = x_header-keylen + x_namtab-texttabpos.
941
*      len = x_namtab-flength.
942
    EXIT.
943
  ENDLOOP.
944
  ASSIGN COMPONENT x_namtab-viewfield OF STRUCTURE <txttb_new_struc>
945
   TO <date_in_textkey_new>.
946
*    ASSIGN texttab_new+offset(len) TO <date_in_textkey_new> TYPE 'D'.
947
  offset = ( x_header-after_keyc + x_header-aft_txttbc )
948
           / cl_abap_char_utilities=>charsize.
949
*  offset = x_header-keylen + x_header-texttablen.
950
  ASSIGN texttab_orig+offset(1) TO <action_in_orig>.
951
  ASSIGN texttab_new+offset(1) TO <action_in_new>.
952
*  ASSIGN texttab_new+offset(len) TO <textfields_in_new>.
953
*  ASSIGN texttab_orig+offset(len) TO <textfields_in_orig>.
954
 
955
  LOOP AT <vim_texttab> INTO texttab_orig FROM orig_tabix.
956
    IF <viewkey_in_orig> <> orig_key. EXIT. ENDIF.
957
    READ TABLE <vim_texttab> WITH KEY <vim_xtotal_key>
958
                     INTO texttab_new BINARY SEARCH.
959
    new_tabix = sy-tabix.
960
    IF <viewkey_in_new> = <vim_xtotal_key> AND
961
       <spras_in_new> < <spras_in_orig>.                  "#EC PORTABLE
962
      LOOP AT <vim_texttab> FROM new_tabix INTO texttab_new.
963
        IF <viewkey_in_new> <> <vim_xtotal_key> OR
964
           <spras_in_new> >= <spras_in_orig>.             "#EC PORTABLE
965
          new_tabix = sy-tabix.
966
          EXIT.
967
        ELSEIF <spras_in_new> < <spras_in_orig>.          "#EC PORTABLE
968
          new_tabix = sy-tabix + 1.
969
        ENDIF.
970
      ENDLOOP.
971
    ENDIF.
972
    IF <viewkey_in_new> <> <vim_xtotal_key> OR
973
       <spras_in_new> <> <spras_in_orig>.
974
*    es gibt noch keinen Eintrag mit neuem Schlüssel
975
      texttab_new = texttab_orig.
976
      <viewkey_in_new> = <vim_xtotal_key>.
977
      <date_in_textkey_new> = <vim_enddate>.
978
      <action_in_new> = neuer_eintrag.
979
      INSERT texttab_new INTO <vim_texttab> INDEX new_tabix.
980
    ELSE.
981
      IF <action_in_new> = original.
982
        <action_in_new> = aendern.
983
      ENDIF.
984
      <textfields_in_new> = <textfields_in_orig>.
985
      MODIFY <vim_texttab> FROM texttab_new INDEX new_tabix.
986
    ENDIF.
987
  ENDLOOP.
988
 
989
* Text in neuen Eintrag löschen
990
  <old_keyx> = <vim_xtotal_key>.
991
*  ASSIGN old_key(x_header-keylen) TO <old_key>.
992
  LOOP AT x_namtab WHERE keyflag = 'X' AND
993
    ( texttabfld = 'X' OR txttabfldn <> space ) AND
994
    domname EQ vim_delim_date_domain AND
995
    ( rollname IN vim_begda_types OR rollname IN vim_endda_types ).
996
    EXIT.
997
  ENDLOOP.
998
  ASSIGN COMPONENT x_namtab-viewfield OF STRUCTURE <old_key_struc>
999
   TO <old_key_enddate>.
1000
  <old_key_enddate> = enddate.
1001
*  old_key+x_namtab-position(x_namtab-flength) = enddate.
1002
  READ TABLE <vim_texttab> WITH KEY <old_keyx>
1003
                           BINARY SEARCH TRANSPORTING NO FIELDS.
1004
*  READ TABLE <vim_texttab> WITH KEY <old_key>
1005
*                           BINARY SEARCH TRANSPORTING NO FIELDS.
1006
  IF sy-subrc = 0.
1007
    LOOP AT <vim_texttab> INTO texttab_orig FROM sy-tabix.
1008
      IF <viewkey_in_orig> <> <old_keyx>. EXIT. ENDIF.
1009
      IF <action_in_orig> = neuer_eintrag.
1010
        DELETE <vim_texttab>.
1011
      ELSE.
1012
        CLEAR <textfields_in_orig>.
1013
        IF <action_in_orig> = original.
1014
          <action_in_orig> = aendern.
1015
        ENDIF.
1016
        MODIFY <vim_texttab> FROM texttab_orig.
1017
      ENDIF.
1018
    ENDLOOP.
1019
  ENDIF.
1020
  MODIFY vim_texttab_container INDEX vim_texttab_container_index.
1021
ENDFORM.                               " VIM_TEMP_DELIM_TEXTTAB
1022
 
1023
*---------------------------------------------------------------------*
1024
*       FORM VIM_CHECK_UPD_TEXTTAB                                    *
1025
*---------------------------------------------------------------------*
1026
* Setzen von <STATUS>-UPD_FLAG, falls Änderungen in Texttabelle       *
1027
*---------------------------------------------------------------------*
1028
FORM vim_check_upd_texttab.
1029
  DATA: texttab_wa TYPE vim_line_ul,
1030
        offset TYPE i.
1031
  FIELD-SYMBOLS: <texttab_action>.
1032
 
1033
  IF x_header-delmdtflag <> space AND  "zeitabh. & part. Fremdschl.
1034
     x_header-ptfrkyexst  = 'X'.       "      -> zeitunabh. Texttab.
1035
    offset = x_header-after_keyc
1036
     - vim_datum_length * cl_abap_char_utilities=>charsize.
1037
  ELSE.
1038
    offset = x_header-after_keyc.
1039
  ENDIF.
1040
  offset = ( offset + x_header-aft_txttbc )
1041
           / cl_abap_char_utilities=>charsize.
1042
  ASSIGN texttab_wa+offset(1) TO <texttab_action>.
1043
  LOOP AT <vim_texttab> INTO texttab_wa.
1044
    CHECK <texttab_action> <> original.
1045
    MOVE 'X' TO <status>-upd_flag.
1046
    EXIT.
1047
  ENDLOOP.
1048
 
1049
ENDFORM.                               "VIM_CHECK_UPD_TEXTTAB
1050
 
1051
*---------------------------------------------------------------------*
1052
*       FORM VIM_SET_TEXTTAB_ACTION_DELETE                            *
1053
*---------------------------------------------------------------------*
1054
* Für alle als 'GELOESCHT' gekennzeichneten Einträge in TOTAL         *
1055
* entsprechende Einträge in der Texttabelle als 'GELOESCHT' kennz.    *
1056
*---------------------------------------------------------------------*
1057
FORM vim_set_texttab_action_delete.
1058
  DATA: texttab_tabix LIKE sy-tabix,
1059
        offset TYPE i,
1060
        texttab_wa TYPE vim_line_ul.
1061
  FIELD-SYMBOLS: <h_texttab_wa> TYPE x,
1062
                 <texttab_action> TYPE char01,
1063
                 <viewkey_in_texttab> TYPE x,
1064
                 <total_key> TYPE x.
1065
 
1066
  IF x_header-delmdtflag <> space AND  "zeitabh. & part. Fremdschl.
1067
     x_header-ptfrkyexst  = 'X'.       "      -> zeitunabh. Texttab.
1068
    offset = x_header-after_keyc
1069
             - vim_datum_length * cl_abap_char_utilities=>charsize.
1070
    ASSIGN <vim_tot_mkey_beforex> TO <total_key>.
1071
  ELSE.
1072
    offset = x_header-after_keyc.
1073
    ASSIGN <vim_xtotal_key> TO <total_key>.
1074
  ENDIF.
1075
  ASSIGN: texttab_wa TO <h_texttab_wa> CASTING,
1076
          <h_texttab_wa>(offset) TO <viewkey_in_texttab>.
1077
  offset = ( offset + x_header-aft_txttbc )
1078
           / cl_abap_char_utilities=>charsize.
1079
  ASSIGN texttab_wa+offset(1) TO <texttab_action>.
1080
 
1081
* Text-Einträge werden nur in dieser Routine, also in PREPARE_SAVING,
1082
* als gelöscht gekennzeichnet, und nach dem eigentlichen Sichern,
1083
* in AFTER_SAVING, aus der internen Texttabelle gelöscht.
1084
* Hier sollten daher keine Einträge als gelöscht gekennzeichnet sein,
1085
* außer wenn im User_exit vor dem Sichern das Sichern abgebrochen wurde.
1086
  LOOP AT <vim_texttab> INTO texttab_wa.
1087
    CHECK <texttab_action> = geloescht OR
1088
          <texttab_action> = update_geloescht OR
1089
          <texttab_action> = neuer_geloescht.
1090
    TRANSLATE <texttab_action> USING 'D XNYU'.
1091
    MODIFY <vim_texttab> FROM texttab_wa.
1092
  ENDLOOP.
1093
 
1094
  LOOP AT total.
1095
    CHECK <action> = update_geloescht OR
1096
          <action> = geloescht OR
1097
          <action> = neuer_geloescht.
1098
    READ TABLE <vim_texttab> WITH KEY <total_key>
1099
                               BINARY SEARCH TRANSPORTING NO FIELDS.
1100
    IF sy-subrc = 0.
1101
      texttab_tabix = sy-tabix.
1102
      LOOP AT <vim_texttab> FROM texttab_tabix INTO texttab_wa.
1103
        IF <viewkey_in_texttab> <> <total_key>.
1104
          EXIT.
1105
        ENDIF.
1106
        TRANSLATE <texttab_action> USING ' DNXUY'.
1107
        MODIFY <vim_texttab> FROM texttab_wa.
1108
      ENDLOOP.
1109
    ENDIF.
1110
  ENDLOOP.
1111
ENDFORM.                               "VIM_SET_TEXTTAB_ACTION_DELETE
1112
 
1113
*---------------------------------------------------------------------*
1114
*    VIM_TEXTTAB_MODIF_FOR_KEY
1115
*---------------------------------------------------------------------*
1116
* <-- MODIF       'X' -> es gibt mind. einen modifizierten Eintrag
1117
*                        in anderer Sprache
1118
*---------------------------------------------------------------------*
1119
* aktueller Eintrag steht in Kopfzeile von EXTRACT
1120
*---------------------------------------------------------------------*
1121
FORM vim_texttab_modif_for_key CHANGING modif.
1122
  DATA: texttab_wa TYPE vim_line_ul,
1123
        texttab_tabix LIKE sy-tabix,
1124
        keylen TYPE i,
1125
        offset TYPE i.
1126
  FIELD-SYMBOLS: <h_texttab_wa> TYPE x,
1127
                 <texttab_action> type xfeld,
1128
                 <viewkey_in_texttab> type x,
1129
                 <extract_key> type x.
1130
 
1131
  IF x_header-delmdtflag <> space AND  "zeitabh. & part. Fremdschl.
1132
     x_header-ptfrkyexst  = 'X'.       "      -> zeitunabh. Texttab.
1133
    ASSIGN <vim_ext_mkey_beforex> TO <extract_key>.
1134
    keylen = x_header-after_keyc
1135
     - vim_datum_length * cl_abap_char_utilities=>charsize.
1136
  ELSE.
1137
    ASSIGN <vim_xextract_key> TO <extract_key>.
1138
    keylen = x_header-after_keyc.
1139
  ENDIF.
1140
 
1141
  CLEAR modif.
1142
  READ TABLE <vim_texttab> WITH KEY <vim_xextract_key>
1143
                           BINARY SEARCH TRANSPORTING NO FIELDS.
1144
  IF sy-subrc = 0.
1145
    texttab_tabix = sy-tabix.
1146
  ELSE.
1147
    EXIT.     "keine Texte zum Key in anderen Sprachen erfaßt
1148
  ENDIF.
1149
 
1150
  ASSIGN: texttab_wa TO <h_texttab_wa> CASTING,
1151
          <h_texttab_wa>(keylen) TO <viewkey_in_texttab>.
1152
  offset = ( keylen + x_header-aft_txttbc )
1153
           / cl_abap_char_utilities=>charsize.
1154
  ASSIGN texttab_wa+offset(1) TO <texttab_action>.
1155
  LOOP AT <vim_texttab> FROM texttab_tabix INTO texttab_wa.
1156
    IF <viewkey_in_texttab> <> <extract_key>.
1157
      EXIT.
1158
    ELSEIF <texttab_action> <> original.
1159
      modif = 'X'.
1160
      EXIT.
1161
    ENDIF.
1162
  ENDLOOP.
1163
ENDFORM.                               "VIM_TEXTTAB_MODIF_FOR_KEY
1164
 
1165
*---------------------------------------------------------------------*
1166
*       FORM VIM_TEXT_KEYTAB_ENTRIES
1167
*---------------------------------------------------------------------*
1168
* Korrektureinträge für Texttabellenänderungen
1169
* UF170200 Dump DATA_LENGTH_TOO_LARGE: Keylen not changed anymore in
1170
* header line of X_HEADER but received in CORR_UPD and added to
1171
* interface (P_KEYLEN).
1172
*---------------------------------------------------------------------*
1173
FORM vim_text_keytab_entries USING value(vake_action) TYPE c
1174
                                   vake_rc TYPE i
1175
                                   value(p_keylen) TYPE syfleng
1176
                                   value(p_txtkeylen) TYPE syfleng.
1177
  DATA: rc1 LIKE sy-subrc,
1178
        offset TYPE i,
1179
        texttab_wa TYPE vim_line_ul.
1180
  FIELD-SYMBOLS: <h_texttab_wa> type x,
1181
                 <texttab_action> type c, <texttab_key> type x,
1182
                 <x_header2> TYPE vimdesc.
1183
 
1184
  IF x_header-delmdtflag <> space AND  "zeitabh. & part. Fremdschl.
1185
     x_header-ptfrkyexst  = 'X'.       "      -> zeitunabh. Texttab.
1186
    p_keylen = p_keylen
1187
     - vim_datum_length * cl_abap_char_utilities=>charsize.  "UF170200
1188
  ENDIF.
1189
  ASSIGN: texttab_wa to <h_texttab_wa> casting,
1190
          <h_texttab_wa>+p_keylen(x_header-textkeylen) TO <texttab_key>.
1191
  offset = p_keylen + x_header-aft_txttbc.
1192
  ASSIGN <h_texttab_wa>+offset(cl_abap_char_utilities=>charsize)
1193
          TO <texttab_action> casting.
1194
 
1195
  corr_keytab =  e071k.
1196
  corr_keytab-objname = x_header-texttab.
1197
 
1198
  vake_rc = 8.
1199
  LOOP AT <vim_texttab> INTO texttab_wa.
1200
    CHECK <texttab_action> <> original AND
1201
          <texttab_action> <> neuer_geloescht.
1202
    MOVE <texttab_key> TO <vim_corr_keyx>(p_txtkeylen).
1203
*    MOVE <texttab_key> TO corr_keytab-tabkey(p_txtkeylen).
1204
    PERFORM update_corr_keytab USING vake_action rc1.
1205
    IF rc1 = 0.
1206
      CLEAR vake_rc.
1207
    ELSE.
1208
      IF vake_action EQ pruefen. vake_rc = 8. EXIT. ENDIF.
1209
    ENDIF.
1210
  ENDLOOP.
1211
ENDFORM.                               "VIM_TEXT_KEYTAB_ENTRIES
1212
 
1213
*---------------------------------------------------------------------*
1214
*       FORM VIM_TEXT_KEYTAB_ENTRY
1215
*---------------------------------------------------------------------*
1216
* Korrektureintrag für Entry in allen vorhandenen Sprachen
1217
*---------------------------------------------------------------------*
1218
FORM vim_text_keytab_entry USING value(viewkey) TYPE x
1219
                                 value(vake_action) TYPE c
1220
                                 vake_rc TYPE i.
1221
  DATA: rc1 LIKE sy-subrc,
1222
        sys_type(10) TYPE c,
1223
        keylen TYPE i,
1224
        offset TYPE i,
1225
        tbx LIKE sy-tabix,
1226
        align TYPE f,
1227
        texttab_wa TYPE vim_line_ul,
1228
        key_wa TYPE vim_line_ul,
1229
        wheretab LIKE vimwheretb OCCURS 0 WITH HEADER LINE,
1230
        tmp_sellist LIKE vimsellist OCCURS 0 WITH HEADER LINE,
1231
        tmp_texttab TYPE REF TO data, w_tmp_texttab type ref to data.
1232
  FIELD-SYMBOLS: <tmp_texttab> TYPE STANDARD TABLE,
1233
                 <texttab_wax> TYPE x,
1234
                 <texttab_x> TYPE x, <texttab_struc> TYPE ANY,
1235
                 <texttab_key> TYPE x, <texttab_action> TYPE c,
1236
                 <keyvalue> TYPE ANY, <lang> TYPE spras,
1237
                 <viewkey_in_texttab>, <viewkey> TYPE x.
1238
 
1239
  vake_rc = 8.
1240
  corr_keytab =  e071k.
1241
  corr_keytab-objname = x_header-texttab.
1242
 
1243
  IF x_header-generictrp <> space OR x_header-genertxtrp <> space.
1244
    keylen = x_header-maxtrkeyln.
1245
  ELSE.
1246
    keylen = x_header-keylen.
1247
  ENDIF.
1248
  CALL 'C_SAPGPARAM' ID 'NAME'  FIELD 'transport/systemtype'
1249
                     ID 'VALUE' FIELD sys_type.
1250
 
1251
  ASSIGN: viewkey(keylen) TO <viewkey> CASTING.
1252
  IF vim_texttab_container-all_langus = 'X'.
1253
* texts have already been read
1254
    ASSIGN: texttab_wa TO <texttab_wax> CASTING,
1255
            <texttab_wax>+keylen(x_header-texttablen) TO <texttab_x>,
1256
            <texttab_x>(x_header-textkeylen) TO <texttab_key>,
1257
            <texttab_x> TO <texttab_struc>
1258
             CASTING TYPE (x_header-texttab),
1259
            COMPONENT x_header-sprasfield OF STRUCTURE
1260
             <texttab_struc> TO <lang>.
1261
    IF x_header-delmdtflag <> space AND"zeitabh. & part. Fremdschl.
1262
       x_header-ptfrkyexst  = 'X'.     "      -> zeitunabh. Texttab.
1263
      keylen = keylen
1264
                - vim_datum_length * cl_abap_char_utilities=>charsize.
1265
    ENDIF.
1266
    ASSIGN <texttab_wax>(keylen) TO <viewkey_in_texttab>.
1267
    offset = keylen + x_header-aft_txttbc.
1268
    ASSIGN <texttab_wax>+offset(cl_abap_char_utilities=>charsize)
1269
     TO <texttab_action> CASTING.
1270
 
1271
    READ TABLE <vim_texttab> WITH KEY <viewkey>
1272
             BINARY SEARCH TRANSPORTING NO FIELDS.
1273
    IF sy-subrc = 0.
1274
      LOOP AT <vim_texttab> INTO texttab_wa FROM sy-tabix.
1275
        CHECK <texttab_action> <> neuer_eintrag.
1276
        IF <viewkey_in_texttab> <> <viewkey>. EXIT. ENDIF.
1277
        MOVE <texttab_key> TO <vim_corr_keyx>(x_header-textkeylen).
1278
*        WRITE <texttab_key> TO corr_keytab-tabkey(x_header-textkeylen).
1279
        PERFORM update_corr_keytab USING vake_action rc1.
1280
        IF rc1 = 0.
1281
          CLEAR vake_rc.
1282
        ELSE.
1283
          IF vake_action EQ pruefen. vake_rc = 8. EXIT. ENDIF.
1284
        ENDIF.
1285
      ENDLOOP.
1286
    ELSE.
1287
      CLEAR vake_rc.
1288
    ENDIF.
1289
  ELSE.
1290
* Texte direkt von DB lesen
1291
    REFRESH wheretab.
1292
    tmp_sellist-operator = 'EQ'.
1293
    tmp_sellist-and_or = 'AND'.
1294
    MOVE <viewkey> TO <f1_wax>.
1295
    LOOP AT x_namtab WHERE keyflag NE space    "fill sellist for
1296
                       AND txttabfldn <> space.             "texttab
1297
      tmp_sellist-tabix = sy-tabix.
1298
*      ASSIGN viewkey+x_namtab-position(x_namtab-flength) TO <keyvalue>.
1299
      ASSIGN COMPONENT x_namtab-viewfield
1300
       OF STRUCTURE <table1_wa> TO <keyvalue>.
1301
      tmp_sellist-viewfield = x_namtab-txttabfldn.
1302
      IF x_namtab-inttype = 'C' and x_namtab-convexit = space.
1303
        tmp_sellist-value = <keyvalue>.
1304
      ELSE.
1305
        CALL FUNCTION 'VIEW_CONVERSION_OUTPUT'
1306
          EXPORTING
1307
            value_intern = <keyvalue>
1308
            tabname      = x_header-maintview
1309
            fieldname    = x_namtab-viewfield
1310
            inttype      = x_namtab-inttype
1311
            datatype     = x_namtab-datatype
1312
            decimals     = x_namtab-decimals
1313
            convexit     = x_namtab-convexit
1314
            sign         = x_namtab-sign
1315
            outputlen    = x_namtab-outputlen
1316
            intlen       = x_namtab-flength
1317
          IMPORTING
1318
            value_extern = tmp_sellist-value
1319
          EXCEPTIONS
1320
            OTHERS       = 1.
1321
      ENDIF.
1322
      APPEND tmp_sellist.
1323
      tbx   = sy-tabix.
1324
    ENDLOOP.
1325
    IF tbx > 0.
1326
      CLEAR tmp_sellist-and_or.
1327
      MODIFY tmp_sellist INDEX tbx.
1328
      CALL FUNCTION 'VIEW_FILL_WHERETAB'
1329
        EXPORTING
1330
          tablename               = x_header-texttab
1331
          only_cnds_for_keyflds   = 'X'
1332
          is_texttable            = 'X'
1333
        TABLES
1334
          sellist                 = tmp_sellist
1335
          wheretab                = wheretab
1336
          x_namtab                = x_namtab
1337
        EXCEPTIONS
1338
          no_conditions_for_table = 01.
1339
      CREATE DATA tmp_texttab TYPE STANDARD TABLE OF (x_header-texttab).
1340
      CREATE DATA w_tmp_texttab TYPE (x_header-texttab).
1341
      ASSIGN: tmp_texttab->* TO <tmp_texttab>,
1342
              w_tmp_texttab->* to <texttab_struc>,
1343
              <texttab_struc> TO <texttab_wax> CASTING,
1344
              <texttab_wax>(x_header-textkeylen) TO <texttab_key>,
1345
              COMPONENT x_header-sprasfield OF STRUCTURE
1346
               <texttab_struc> TO <lang>.
1347
      SELECT * FROM (x_header-texttab) INTO TABLE <tmp_texttab>
1348
                                      WHERE (wheretab).
1349
      IF sy-subrc = 0.
1350
*        ASSIGN texttab_wa(x_header-textkeylen) TO <texttab_key>.
1351
        LOOP AT <tmp_texttab> INTO <texttab_struc>.
1352
          MOVE <texttab_key> TO <vim_corr_keyx>(x_header-textkeylen).
1353
*          WRITE <texttab_key>
1354
*           TO corr_keytab-tabkey(x_header-textkeylen).
1355
          PERFORM update_corr_keytab USING vake_action rc1.
1356
          IF rc1 = 0.
1357
            CLEAR vake_rc.
1358
          ELSE.
1359
            IF vake_action EQ pruefen. vake_rc = 8. EXIT. ENDIF.
1360
          ENDIF.
1361
        ENDLOOP.
1362
      ELSE.
1363
        CLEAR vake_rc.
1364
      ENDIF.
1365
    ENDIF.
1366
  ENDIF.
1367
 
1368
ENDFORM.                               "VIM_TEXT_KEYTAB_ENTRY
1369
 
1370
* "SW Textcopy
1371
*---------------------------------------------------------------------*
1372
*       FORM VIM_COPY_TEXTTAB_ENTRY                                   *
1373
*---------------------------------------------------------------------*
1374
* Kopieren für Texttabelle :                                          *
1375
*    neuen Eintrag für NEW_KEY für alle Sprachen in Texttabelle erzeugen
1376
*       ?? bzw. -falls schon ex.- Texte darin ersetzen ??
1377
*    Texte werden aus Originaleintrag ORIG_KEY übernommen
1378
*---------------------------------------------------------------------*
1379
* --> NEW_KEY   Schlüssel des neuen Eintrags
1380
* --> ORIG_KEY  Schlüssel des zu kopierenden Eintrags
1381
*---------------------------------------------------------------------*
1382
FORM vim_copy_texttab_entry USING value(new_key) TYPE x
1383
                                  value(orig_key) TYPE x.
1384
  DATA: texttab_orig TYPE vim_line_ul,
1385
        texttab_new  TYPE vim_line_ul,
1386
        orig_tabix LIKE sy-tabix,
1387
        new_tabix  LIKE sy-tabix,
1388
        len TYPE i,
1389
        offset TYPE i,
1390
        langus_selected(1) TYPE c,
1391
        curr_sptxt LIKE t002t-sptxt,
1392
        sel_langus LIKE h_t002 OCCURS 0 WITH HEADER LINE.
1393
  FIELD-SYMBOLS: <texttab_orig_x> TYPE x,
1394
                 <h_texttab_orig_x> TYPE x,
1395
                 <txttb_orig_struc> TYPE ANY,
1396
                 <viewkey_in_orig> TYPE x,    "-> texttab_orig
1397
                 <texttab_new_x> TYPE x,
1398
                 <h_texttab_new_x> TYPE x,
1399
                 <txttb_new_struc> TYPE ANY,
1400
                 <viewkey_in_new> TYPE x,     "-> texttab_new
1401
                 <spras_in_orig> TYPE spras,
1402
                 <spras_in_new> TYPE spras,
1403
                 <action_in_orig>,
1404
                 <action_in_new>,
1405
                 <textfields_in_new> TYPE x,
1406
                 <textfields_in_orig> TYPE x,
1407
                 <textkey_in_new> TYPE x.
1408
 
1409
  CALL FUNCTION 'VIEW_GET_LANGUAGES'
1410
    EXPORTING
1411
      all_without_selection = 'X'
1412
    IMPORTING
1413
      languages_selected    = langus_selected
1414
      curr_sptxt            = curr_sptxt
1415
    TABLES
1416
      languages             = sel_langus.
1417
  IF x_header-frm_tl_get NE space.
1418
    PERFORM (x_header-frm_tl_get) IN PROGRAM (x_header-fpoolname)
1419
                                  TABLES sel_langus.
1420
  ELSE.
1421
    PERFORM vim_read_texttab_for_langus TABLES sel_langus USING 'X'.
1422
  ENDIF.
1423
 
1424
  READ TABLE <vim_texttab> WITH KEY orig_key
1425
                           BINARY SEARCH TRANSPORTING NO FIELDS.
1426
  CHECK sy-subrc = 0.
1427
  orig_tabix = sy-tabix.
1428
  ASSIGN: texttab_orig TO <texttab_orig_x> CASTING,
1429
          <texttab_orig_x>(x_header-keylen) TO <viewkey_in_orig>,
1430
          <texttab_orig_x>+x_header-after_keyc(x_header-texttablen)
1431
           TO <h_texttab_orig_x>,
1432
          <h_texttab_orig_x>
1433
           TO <txttb_orig_struc> CASTING TYPE (x_header-texttab),
1434
          COMPONENT x_header-sprasfield OF STRUCTURE <txttb_orig_struc>
1435
           TO <spras_in_orig>.
1436
  ASSIGN: texttab_new TO <texttab_new_x> CASTING,
1437
          <texttab_new_x>(x_header-keylen) TO <viewkey_in_new>,
1438
          <texttab_new_x>+x_header-after_keyc(x_header-textkeylen)
1439
           TO <textkey_in_new>,
1440
          <texttab_new_x>+x_header-after_keyc(x_header-texttablen)
1441
           TO <h_texttab_new_x>,
1442
          <h_texttab_new_x>
1443
           TO <txttb_new_struc> CASTING TYPE (x_header-texttab),
1444
          COMPONENT x_header-sprasfield OF STRUCTURE <txttb_new_struc>
1445
           TO <spras_in_new>.
1446
  offset = x_header-after_keyc + x_header-textkeylen.
1447
  len = x_header-aft_txttbc - x_header-textkeylen.
1448
  ASSIGN: <texttab_new_x>+offset(len) TO <textfields_in_new>,
1449
          <texttab_orig_x>+offset(len) TO <textfields_in_orig>.
1450
  offset = ( x_header-after_keyc + x_header-aft_txttbc )
1451
           / cl_abap_char_utilities=>charsize.
1452
  ASSIGN texttab_orig+offset(1) TO <action_in_orig>.
1453
  ASSIGN texttab_new+offset(1) TO <action_in_new>.
1454
*  ASSIGN texttab_orig(x_header-keylen) TO <viewkey_in_orig>.
1455
*  ASSIGN texttab_new(x_header-keylen) TO <viewkey_in_new>.
1456
*  ASSIGN texttab_new+x_header-keylen(x_header-textkeylen)
1457
*                                       TO <textkey_in_new>.
1458
*  offset = x_header-keylen + x_header-sprasfdpos.
1459
*  ASSIGN texttab_orig+offset(vim_spras_length) TO <spras_in_orig>.
1460
*  ASSIGN texttab_new+offset(vim_spras_length) TO <spras_in_new>.
1461
*  offset = x_header-keylen + x_header-texttablen.
1462
*  ASSIGN texttab_new+offset(1) TO <action_in_new>.
1463
*  offset = x_header-keylen + x_header-textkeylen.
1464
*  len = x_header-texttablen - x_header-textkeylen.
1465
*  ASSIGN texttab_new+offset(len) TO <textfields_in_new>.
1466
*  ASSIGN texttab_orig+offset(len) TO <textfields_in_orig>.
1467
 
1468
  LOOP AT <vim_texttab> INTO texttab_orig FROM orig_tabix.
1469
    IF <viewkey_in_orig> <> orig_key. EXIT. ENDIF.
1470
    READ TABLE <vim_texttab> WITH KEY new_key
1471
                     INTO texttab_new BINARY SEARCH.
1472
    new_tabix = sy-tabix.
1473
    IF <viewkey_in_new> = new_key AND
1474
       <spras_in_new> < <spras_in_orig>.                  "#EC PORTABLE
1475
      LOOP AT <vim_texttab> FROM new_tabix INTO texttab_new.
1476
        IF <viewkey_in_new> <> new_key OR                 "#EC PORTABLE
1477
           <spras_in_new> >= <spras_in_orig>.
1478
          new_tabix = sy-tabix.
1479
          EXIT.
1480
        ELSEIF <spras_in_new> < <spras_in_orig>.          "#EC PORTABLE
1481
          new_tabix = sy-tabix + 1.
1482
        ENDIF.
1483
      ENDLOOP.
1484
    ENDIF.
1485
    IF <viewkey_in_new> <> new_key OR
1486
       <spras_in_new> <> <spras_in_orig>.
1487
*    es gibt noch keinen Eintrag mit neuem Schlüssel
1488
      texttab_new = texttab_orig.
1489
      <viewkey_in_new> = new_key.
1490
      PERFORM map_viewkey_to_texttabkey TABLES x_namtab
1491
                                        USING x_header
1492
                                              <spras_in_orig>
1493
                                              new_key
1494
                                        CHANGING <textkey_in_new>.
1495
*      PERFORM vim_fill_texttab_key USING new_key
1496
*                          <spras_in_orig> x_header-sprasfdpos
1497
*                                   CHANGING <textkey_in_new>.
1498
      <action_in_new> = neuer_eintrag.
1499
      INSERT texttab_new INTO <vim_texttab> INDEX new_tabix.
1500
    ELSE.
1501
      IF <action_in_new> = original.
1502
        <action_in_new> = aendern.
1503
      ENDIF.
1504
      <textfields_in_new> = <textfields_in_orig>.
1505
      MODIFY <vim_texttab> FROM texttab_new INDEX new_tabix.
1506
    ENDIF.
1507
  ENDLOOP.
1508
  MODIFY vim_texttab_container INDEX vim_texttab_container_index.
1509
ENDFORM.                               " VIM_COPY_TEXTTAB_ENTRY