1 |
2 |
3 |
4 | * |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | FORM vim_get_texttab_data TABLES langus STRUCTURE h_t002 |
17 | CHANGING texttab TYPE table. |
18 |
19 | DATA: tgd_sellist LIKE vimsellist OCCURS 10, tgd_sel LIKE vimsellist, |
20 | wheretab_line LIKE vimwheretb, |
21 | spras_value(3) TYPE c, |
22 |
23 | keylen TYPE i, |
24 | l TYPE i, sellist_l TYPE i, tbx TYPE i, |
25 | and_or_str(6) TYPE c, left_par(1) TYPE c, |
26 | tmp_texttab TYPE REF TO data, |
27 | tmp_texttab_wa TYPE REF TO data, |
28 |
29 | texttab_tabix LIKE sy-tabix, |
30 | align1 type f, |
31 | texttab_wa TYPE vim_line_ul, |
32 | align2 type f, |
33 | view_wa TYPE tabl8000, map_error TYPE xfeld. |
34 | FIELD-SYMBOLS: <tmp_texttab> TYPE STANDARD TABLE, |
35 | <tmp_texttab_wa> TYPE ANY, <tmp_texttab_wax> TYPE x, |
36 | <view_key> TYPE x, <next_spras> TYPE spras, |
37 | <curr_spras> TYPE spras, |
38 | <h_texttab> TYPE x, <h_texttab_wa> TYPE x, |
39 | <viewkey_in_texttab> TYPE x, <texttab_struc> TYPE ANY. |
40 | |
41 | CREATE DATA: tmp_texttab TYPE STANDARD TABLE OF (x_header-texttab), |
42 | tmp_texttab_wa TYPE (x_header-texttab). |
43 | ASSIGN: tmp_texttab->* TO <tmp_texttab>, |
44 | tmp_texttab_wa->* TO <tmp_texttab_wa>, |
45 | <tmp_texttab_wa> TO <tmp_texttab_wax> CASTING. |
46 | |
47 | IF x_header-selection NE space. |
48 | LOOP AT dba_sellist INTO tgd_sel "UFProbl251070/1998 |
49 | WHERE value <> space OR initial = 'X'. |
50 | LOOP AT x_namtab WHERE viewfield EQ tgd_sel-viewfield |
51 | AND keyflag NE space AND txttabfldn NE space. |
52 | tgd_sel-viewfield = x_namtab-txttabfldn. |
53 | tgd_sel-tabix = sy-tabix. |
54 | APPEND tgd_sel TO tgd_sellist. |
55 | EXIT. |
56 | ENDLOOP. |
57 | ENDLOOP. "UFProbl251070/1998 |
58 | ENDIF. "X_HEADER-SELECTION |
59 | |
60 | DESCRIBE TABLE tgd_sellist LINES sellist_l. |
61 | IF sellist_l > 0. |
62 | READ TABLE tgd_sellist INDEX sellist_l INTO tgd_sel. |
63 | IF tgd_sel-and_or NE space. |
64 | CLEAR tgd_sel-and_or. |
65 | MODIFY tgd_sellist INDEX sellist_l FROM tgd_sel. |
66 | ENDIF. |
67 | CALL FUNCTION 'VIEW_FILL_WHERETAB' |
68 | EXPORTING |
69 | tablename = x_header-texttab |
70 | only_cnds_for_keyflds = 'X' |
71 | is_texttable = 'X' |
72 | TABLES |
73 | sellist = tgd_sellist |
74 | wheretab = vim_wheretab |
75 | x_namtab = x_namtab |
76 | EXCEPTIONS |
77 | no_conditions_for_table = 01. |
78 | IF sy-subrc = 1. sellist_l = 0. ENDIF. |
79 | ELSE. |
80 | REFRESH vim_wheretab. |
81 | ENDIF. |
82 | |
83 |
84 | DESCRIBE TABLE langus LINES l. |
85 | IF l > 1. |
86 | and_or_str = 'OR'. |
87 | IF sellist_l > 0. |
88 | left_par = '('. |
89 | ENDIF. |
90 | ENDIF. |
91 | tbx = 1. |
92 | spras_value = ''' '''. |
93 | LOOP AT langus. |
94 | spras_value+1(1) = langus-spras. |
95 | IF tbx = l. " letzte Zeile für Sprachselektion |
96 | IF l > 1 AND sellist_l > 0. |
97 | and_or_str = ' ) AND'. |
98 | ELSEIF l = 1 AND sellist_l > 0. |
99 | and_or_str = ' AND'. |
100 | ELSE. |
101 | CLEAR and_or_str. |
102 | ENDIF. |
103 | ENDIF. |
104 | CONCATENATE left_par x_header-sprasfield 'EQ' spras_value and_or_str |
105 | INTO wheretab_line SEPARATED BY space. |
106 | INSERT wheretab_line INTO vim_wheretab INDEX tbx. |
107 | CLEAR left_par. |
108 | tbx = tbx + 1. |
109 | ENDLOOP. |
110 | |
111 | SELECT * FROM (x_header-texttab) INTO TABLE <tmp_texttab> |
112 | WHERE (vim_wheretab). |
113 | |
114 |
115 | IF x_header-delmdtflag <> space AND "zeitabh. & part. Fremdschl. |
116 | x_header-ptfrkyexst = 'X'. " -> zeitunabh. Texttab. |
117 | keylen = x_header-after_keyc |
118 | - vim_datum_length * cl_abap_char_utilities=>charsize. |
119 | ELSE. |
120 | keylen = x_header-after_keyc. |
121 | ENDIF. |
122 | ASSIGN: view_wa(keylen) TO <view_key>, |
123 | texttab_wa TO <h_texttab_wa> CASTING, |
124 | <h_texttab_wa>(keylen) TO <viewkey_in_texttab>, |
125 | <h_texttab_wa>+keylen(x_header-texttablen) TO <h_texttab>, |
126 | <h_texttab> TO <texttab_struc> |
127 | CASTING TYPE (x_header-texttab), |
128 | COMPONENT x_header-sprasfield OF STRUCTURE <texttab_struc> |
129 | TO <next_spras>, |
130 | COMPONENT x_header-sprasfield OF STRUCTURE <tmp_texttab_wa> |
131 | TO <curr_spras>. |
132 | LOOP AT <tmp_texttab> INTO <tmp_texttab_wa>. |
133 | PERFORM map_texttabkey_to_viewkey TABLES x_namtab |
134 | USING x_header |
135 | <tmp_texttab_wax> |
136 | x_header-textkeylen |
137 | x_header-genertxtrp |
138 | CHANGING <view_key> |
139 | map_error. |
140 | CHECK map_error = space. |
141 |
142 |
143 | CLEAR texttab_wa. |
144 | READ TABLE texttab WITH KEY <view_key> INTO texttab_wa |
145 | BINARY SEARCH. |
146 | texttab_tabix = sy-tabix. |
147 | IF sy-subrc = 0 AND |
148 | <viewkey_in_texttab> = <view_key> AND "Text ex. in weiteren Spr |
149 | <next_spras> < <curr_spras>. "#EC PORTABLE |
150 | LOOP AT texttab FROM texttab_tabix INTO texttab_wa. |
151 | IF <viewkey_in_texttab> <> <view_key> OR |
152 | <next_spras> >= <curr_spras>. "#EC PORTABLE |
153 | texttab_tabix = sy-tabix. |
154 | EXIT. |
155 | ELSEIF <next_spras> < <curr_spras>. "#EC PORTABLE |
156 | texttab_tabix = sy-tabix + 1. |
157 | ENDIF. |
158 | ENDLOOP. |
159 | ENDIF. " <next_spras> >= <curr_spras> oder ex. nicht |
160 | IF <next_spras> <> <curr_spras> OR |
161 | <viewkey_in_texttab> <> <view_key>. "Text ex. nicht in Sprache |
162 | CLEAR texttab_wa. |
163 | <viewkey_in_texttab> = <view_key>. |
164 | <texttab_struc> = <tmp_texttab_wa>. |
165 | INSERT texttab_wa INTO texttab INDEX texttab_tabix. |
166 | ELSE. |
167 | <texttab_struc> = <tmp_texttab_wa>. |
168 | MODIFY texttab FROM texttab_wa INDEX texttab_tabix. |
169 | ENDIF. |
170 | |
171 | ENDLOOP. " tmp_texttab |
172 | ENDFORM. "VIM_GET_TEXTTAB_DATA |
173 | |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 | FORM vim_read_texttab_entry. |
182 | DATA: texttab_wa TYPE vim_line_ul, |
183 | texttab_tabix LIKE sy-tabix, |
184 | keylen TYPE i, |
185 | offset TYPE i, |
186 | modify_texttab(1) TYPE c, |
187 | tmp_texttab TYPE ref to data, |
188 | w_tmp_texttab type ref to data. |
189 | FIELD-SYMBOLS: <h_texttab_wa> type x, |
190 | <viewkey_in_texttab> type x, |
191 | <texttab_key> type x, |
192 | <texttab_fields>, <texttab_action> type c, |
193 | <extract_key> type x, |
194 | <tmp_texttab> type standard table, |
195 | <w_tmp_texttab> type any, |
196 | <w_tmp_texttab_x> type x. |
197 | |
198 | IF x_header-delmdtflag <> space AND "zeitabh. & part. Fremdschl. |
199 | x_header-ptfrkyexst = 'X'. " -> zeitunabh. Texttab. |
200 | ASSIGN <vim_ext_mkey_beforex> TO <extract_key>. |
201 |
202 | keylen = x_header-keylen |
203 | - vim_datum_length * cl_abap_char_utilities=>charsize. |
204 | ELSE. |
205 | ASSIGN <vim_xextract_key> TO <extract_key>. |
206 | keylen = x_header-after_keyc. |
207 |
208 | ENDIF. |
209 | |
210 | READ TABLE <vim_texttab> WITH KEY <extract_key> |
211 | BINARY SEARCH TRANSPORTING NO FIELDS. |
212 | IF sy-subrc = 0. |
213 | texttab_tabix = sy-tabix. |
214 | ELSE. |
215 | EXIT. "keine Texte zum Key in anderen Sprachen erfaßt |
216 | ENDIF. |
217 | |
218 | ASSIGN: texttab_wa TO <h_texttab_wa> casting, |
219 | <h_texttab_wa>+keylen(x_header-textkeylen) TO <texttab_key>, |
220 | <h_texttab_wa>+keylen(x_header-texttablen) |
221 | TO <texttab_fields>. |
222 |
223 |
224 |
225 | offset = ( keylen + x_header-texttablen ) |
226 | / cl_abap_char_utilities=>charsize. |
227 |
228 | ASSIGN texttab_wa+offset(1) TO <texttab_action>. |
229 | |
230 | create data tmp_texttab type standard table of (x_header-texttab). |
231 | create data w_tmp_texttab type (x_header-texttab). |
232 | assign: tmp_texttab->* to <tmp_texttab>, |
233 | w_tmp_texttab->* to <w_tmp_texttab>, |
234 | <w_tmp_texttab> to <w_tmp_texttab_x> casting. |
235 | LOOP AT <vim_texttab> FROM texttab_tabix INTO texttab_wa. |
236 | IF <viewkey_in_texttab> <> <extract_key>. EXIT. ENDIF. |
237 | IF <texttab_action> = neuer_eintrag. |
238 | DELETE <vim_texttab>. |
239 | modify_texttab = 'X'. |
240 | ELSEIF <texttab_action> <> original. |
241 | refresh <tmp_texttab>. |
242 |
243 | CALL FUNCTION 'DB_SELECT_GENERIC_TABLE' |
244 | EXPORTING |
245 | genkey = <texttab_key> |
246 | genkey_ln = x_header-textkeylen |
247 | tablename = x_header-texttab |
248 | TABLES |
249 | inttab = <tmp_texttab> |
250 |
251 | EXCEPTIONS |
252 | db_error = 12 |
253 | not_found = 04 |
254 | wrong_param = 08. |
255 | IF sy-subrc > 4. RAISE get_table_error. ENDIF. |
256 | |
257 | READ TABLE <tmp_texttab> into <w_tmp_texttab> INDEX 1. |
258 |
259 | IF sy-subrc = 0. |
260 | <texttab_fields> = <w_tmp_texttab_x>(x_header-texttablen). |
261 |
262 | <texttab_action> = original. |
263 | MODIFY <vim_texttab> FROM texttab_wa. |
264 | modify_texttab = 'X'. |
265 | ELSE. "NOT_FOUND |
266 | DELETE <vim_texttab>. |
267 | modify_texttab = 'X'. |
268 | ENDIF. |
269 | ENDIF. |
270 | ENDLOOP. |
271 | IF modify_texttab = 'X'. |
272 | MODIFY vim_texttab_container INDEX vim_texttab_container_index. |
273 | CLEAR sy-subrc. |
274 | ELSE. |
275 | sy-subrc = 4. |
276 | ENDIF. |
277 | ENDFORM. "VIM_READ_TEXTTAB_ENTRY |
278 | |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 | FORM vim_texttab_db_update. |
287 | DATA: modified_entries TYPE i, |
288 | texttab_modified(1) TYPE c, |
289 | keylen TYPE i, |
290 | offset TYPE i, |
291 | align type f, texttab_wa TYPE vim_line_ul, "HCG never separate |
292 | tmp_texttab TYPE REF TO data, |
293 | w_tmp_texttab TYPE REF TO data. |
294 |
295 | FIELD-SYMBOLS: <tmp_texttab> TYPE STANDARD TABLE, |
296 | <w_tmp_texttab> TYPE ANY, |
297 | <h_texttab_wa> TYPE x, <h_texttab_fields> TYPE x, |
298 | <texttab_fields> TYPE ANY, <texttab_action>. |
299 | |
300 | CLEAR texttab_modified. |
301 | CHECK x_header-texttbexst <> space. |
302 | IF x_header-delmdtflag <> space AND "zeitabh. & part. Fremdschl. |
303 | x_header-ptfrkyexst = 'X'. " -> zeitunabh. Texttab. |
304 | keylen = x_header-after_keyc |
305 | - vim_datum_length * cl_abap_char_utilities=>charsize. |
306 | ELSE. |
307 | keylen = x_header-after_keyc. |
308 | ENDIF. |
309 | |
310 | CREATE DATA: tmp_texttab TYPE STANDARD TABLE OF (x_header-texttab), |
311 | w_tmp_texttab TYPE (x_header-texttab). |
312 | ASSIGN: tmp_texttab->* TO <tmp_texttab>, |
313 | w_tmp_texttab->* TO <w_tmp_texttab>, |
314 | texttab_wa TO <h_texttab_wa> CASTING, |
315 | <h_texttab_wa>+keylen(x_header-texttablen) |
316 | TO <h_texttab_fields>, |
317 | <h_texttab_fields> TO <texttab_fields> |
318 | CASTING TYPE (x_header-texttab). |
319 | offset = ( keylen + x_header-aft_txttbc ) |
320 | / cl_abap_char_utilities=>charsize. |
321 | ASSIGN texttab_wa+offset(1) TO <texttab_action>. |
322 | |
323 |
324 | LOOP AT <vim_texttab> INTO texttab_wa. |
325 | CHECK <texttab_action> EQ geloescht OR |
326 | <texttab_action> EQ neuer_geloescht OR |
327 | <texttab_action> EQ update_geloescht. |
328 | DELETE <vim_texttab>. |
329 | texttab_modified = 'X'. |
330 | ENDLOOP. "<VIM_TEXTTAB> |
331 | |
332 |
333 | CLEAR modified_entries. REFRESH <tmp_texttab>. |
334 | LOOP AT <vim_texttab> INTO texttab_wa. |
335 | CHECK <texttab_action> EQ aendern. |
336 | APPEND <texttab_fields> TO <tmp_texttab>. |
337 |
338 |
339 | modified_entries = modified_entries + 1. |
340 | <texttab_action> = original. |
341 | MODIFY <vim_texttab> FROM texttab_wa. |
342 | ENDLOOP. "<VIM_TEXTTAB> |
343 | IF modified_entries > 0. |
344 | UPDATE (x_header-texttab) FROM TABLE <tmp_texttab>. |
345 | texttab_modified = 'X'. |
346 | ENDIF. |
347 | |
348 |
349 | CLEAR modified_entries. REFRESH <tmp_texttab>. |
350 | LOOP AT <vim_texttab> INTO texttab_wa. |
351 | CHECK <texttab_action> EQ neuer_eintrag. |
352 | APPEND <texttab_fields> TO <tmp_texttab>. |
353 |
354 |
355 | modified_entries = modified_entries + 1. |
356 | <texttab_action> = original. |
357 | MODIFY <vim_texttab> FROM texttab_wa. |
358 | ENDLOOP. "<VIM_TEXTTAB> |
359 | IF modified_entries > 0. |
360 | INSERT (x_header-texttab) FROM TABLE <tmp_texttab> |
361 | ACCEPTING DUPLICATE KEYS. "um RABAX bei unzulässigem |
362 | "Texttab-Aufbau zu vermeiden |
363 | texttab_modified = 'X'. |
364 | ENDIF. |
365 | |
366 | IF texttab_modified = 'X'. |
367 | MODIFY vim_texttab_container INDEX vim_texttab_container_index. |
368 | ENDIF. |
369 | ENDFORM. "VIM_TEXTTAB_DB_UPDATE |
370 | |
371 |
372 |
373 |
374 |
375 |
376 |
377 | FORM vim_read_texttab_all_langus. |
378 | DATA: langus_selected(1) TYPE c, |
379 | curr_sptxt LIKE t002t-sptxt, |
380 | sel_langus LIKE h_t002 OCCURS 0 WITH HEADER LINE. |
381 | |
382 | CALL FUNCTION 'VIEW_GET_LANGUAGES' |
383 | EXPORTING |
384 | all_without_selection = 'X' |
385 | IMPORTING |
386 | languages_selected = langus_selected |
387 | curr_sptxt = curr_sptxt |
388 | TABLES |
389 | languages = sel_langus. |
390 | IF x_header-frm_tl_get NE space. |
391 | PERFORM (x_header-frm_tl_get) IN PROGRAM (x_header-fpoolname) |
392 | TABLES sel_langus. |
393 | ELSE. |
394 | PERFORM vim_read_texttab_for_langus TABLES sel_langus USING ' '. |
395 | ENDIF. |
396 | ENDFORM. "VIM_READ_TEXTTAB_ALL_LANGUS |
397 | |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 | FORM vim_call_ltext_exit |
413 | USING maint_mode TYPE c |
414 | exitform TYPE vimfrmname |
415 | CHANGING texttable_entry TYPE vimty_textmaint_record |
416 | modified TYPE c. |
417 | DATA: text_wa TYPE vim_line_ul, |
418 | textmaint_field TYPE vimty_textfield, |
419 | pgm_name LIKE sy-repid, |
420 | offset LIKE sy-fdpos. |
421 | |
422 | FIELD-SYMBOLS: <text_wa> TYPE x, <text_wa_struc> TYPE ANY, |
423 | <texttabkey> TYPE x, <txtfld> TYPE ANY. |
424 | |
425 | CLEAR modified. |
426 | IF vim_internal_ltext_call = space. |
427 | PERFORM (exitform) IN PROGRAM (sy-repid). |
428 | ELSE. |
429 | READ TABLE x_header INDEX 1. |
430 | ASSIGN: text_wa TO <text_wa> CASTING, |
431 | <text_wa> TO <text_wa_struc> |
432 | CASTING TYPE (x_header-texttab), |
433 | texttable_entry-keys TO <texttabkey> CASTING. |
434 | |
435 | PERFORM map_viewkey_to_texttabkey TABLES x_namtab |
436 | USING x_header |
437 | texttable_entry-spras |
438 | <texttabkey> |
439 | CHANGING <text_wa>. |
440 |
441 |
442 |
443 |
444 | LOOP AT texttable_entry-texttab INTO textmaint_field. |
445 | READ TABLE x_namtab INDEX textmaint_field-namtab_idx. |
446 |
447 | IF x_namtab-lowercase = space. |
448 | TRANSLATE textmaint_field-text TO UPPER CASE. |
449 | ENDIF. |
450 | IF x_namtab-txttabfldn = space. |
451 |
452 | ASSIGN COMPONENT x_namtab-bastabfld |
453 | OF STRUCTURE <text_wa_struc> TO <txtfld>. |
454 | ELSE. |
455 |
456 | ASSIGN COMPONENT x_namtab-txttabfldn |
457 | OF STRUCTURE <text_wa_struc> TO <txtfld>. |
458 | ENDIF. |
459 | <txtfld> = textmaint_field-text. |
460 |
461 |
462 | ENDLOOP. |
463 | PERFORM (exitform) IN PROGRAM (x_header-fpoolname) |
464 | USING maint_mode |
465 | CHANGING text_wa modified. |
466 | IF modified = 'X'. |
467 | IF maint_mode = 'U'. |
468 | LOOP AT texttable_entry-texttab INTO textmaint_field. |
469 | READ TABLE x_namtab INDEX textmaint_field-namtab_idx. |
470 | ASSIGN COMPONENT x_namtab-txttabfldn |
471 | OF STRUCTURE <text_wa_struc> TO <txtfld>. |
472 | textmaint_field-text = <txtfld>. |
473 |
474 |
475 |
476 | MODIFY texttable_entry-texttab FROM textmaint_field. |
477 | ENDLOOP. |
478 | texttable_entry-action = 'X'. |
479 | ELSE. |
480 | CLEAR modified. |
481 | ENDIF. |
482 | ENDIF. |
483 | ENDIF. |
484 | ENDFORM. " VIM_CALL_LTEXT_EXIT |