1 |
2 |
3 |
4 |
5 |
6 | FORM address_maintain. |
7 | DATA: mode, return TYPE i, kz, answer, am_save(1) TYPE c, |
8 | am_pos LIKE sy-fdpos, am_length LIKE sy-fdpos, |
9 | func_name TYPE rs38l_fnam. |
10 | DATA: am_handletab LIKE addr1_dia OCCURS 1 WITH HEADER LINE, |
11 | am_sel LIKE addr1_sel, am_address LIKE addr1_val, |
12 | am_ucomm LIKE sy-ucomm, am_title LIKE sy-title. |
13 | DATA: keytab TYPE TABLE OF vimty_textfield, |
14 | keytab_wa TYPE vimty_textfield, |
15 | am_key TYPE vimty_max_textline. |
16 | |
17 | FIELD-SYMBOLS: <am_title> TYPE c, <am_key> TYPE c, |
18 | <am_handle_x> TYPE x, |
19 | <namtab> TYPE vimnamtab, <keyfld> TYPE ANY. |
20 | IF x_header-adrnbrflag EQ space. |
21 | MESSAGE e001(sv). |
22 | EXIT. |
23 | ENDIF. |
24 | IF status-action NE anzeigen AND status-action NE transportieren AND |
25 | adrnbr_roflag EQ space. |
26 | MOVE svim_text_012 TO am_title. "Adresse bearbeiten |
27 | ELSE. |
28 | MOVE svim_text_017 TO am_title. "Adresse anzeigen |
29 | ENDIF. |
30 | am_pos = strlen( am_title ). |
31 | am_length = 70 - am_pos. |
32 | ASSIGN am_title+am_pos(am_length) TO <am_title>. |
33 | MOVE ':' TO <am_title>. |
34 | ADD 2 TO am_pos. |
35 | SUBTRACT 2 FROM am_length. |
36 | ASSIGN am_title+am_pos(am_length) TO <am_title>. |
37 | CLEAR am_pos. |
38 | PERFORM vim_external_repr_for_key TABLES keytab |
39 | USING <f1_x>. |
40 | LOOP AT keytab INTO keytab_wa. |
41 | CONCATENATE am_key keytab_wa-text INTO am_key SEPARATED BY space. |
42 | am_pos = am_pos + keytab_wa-outplen + 1. |
43 | IF am_pos > am_length. EXIT. ENDIF. |
44 | ENDLOOP. |
45 | IF sy-subrc = 0. |
46 | ASSIGN am_key(am_pos) TO <am_key>. |
47 |
48 |
49 |
50 |
51 |
52 |
53 | MOVE <am_key> TO <am_title>. |
54 | ENDIF. |
55 | ASSIGN am_handletab-handle TO <am_handle_x> CASTING. |
56 | IF x_header-adrnbrflag EQ 'O'. "use old technique |
57 |
58 | IF <address_number> NE space. |
59 | SELECT adrnr FROM sadr INTO sadr-adrnr |
60 | WHERE adrnr EQ <address_number>. |
61 | EXIT. |
62 | ENDSELECT. |
63 | IF sy-subrc NE 0. |
64 | CALL FUNCTION 'ADDR_CONVERT_ADRC_TO_SADR' |
65 | CHANGING |
66 | address_number = <address_number>. |
67 |
68 |
69 |
70 |
71 | ENDIF. |
72 | ENDIF. |
73 |
74 | MOVE <address_number> TO sadr-adrnr. |
75 | kz = space. |
76 | IF status-action NE anzeigen AND status-action NE transportieren AND |
77 | adrnbr_roflag EQ space. |
78 | IF <address_number> EQ space. |
79 | mode = 'A'. |
80 | ELSE. |
81 | mode = 'M'. |
82 | ENDIF. |
83 | IF status-action EQ kopieren. |
84 | IF <address_number> NE space. |
85 | SELECT * FROM sadr WHERE adrnr EQ <address_number>. |
86 | kz = 'X'. |
87 | EXIT. |
88 | ENDSELECT. |
89 | ELSE. |
90 | CLEAR sadr. |
91 | ENDIF. |
92 | CLEAR <address_number>. |
93 | mode = 'A'. |
94 | ENDIF. |
95 | ELSE. |
96 | mode = 'D'. |
97 | ENDIF. |
98 | func_name = 'ADDRESS_MAINTAIN'. "struggling against extended check |
99 | DO. |
100 | CALL FUNCTION func_name |
101 | EXPORTING |
102 | adrswa_in = sadr |
103 | processing_status = mode |
104 | kennzeichen = kz |
105 | save_intern = 'X' |
106 | title = am_title |
107 | IMPORTING |
108 | adrswa_out = sadr |
109 | returncode = return |
110 | update_flag = am_save |
111 | EXCEPTIONS |
112 | not_found = 4. |
113 | IF sy-subrc NE 0. |
114 | IF status-action NE anzeigen AND |
115 | status-action NE transportieren AND |
116 | adrnbr_roflag EQ space. |
117 | CALL FUNCTION 'POPUP_TO_CONFIRM_WITH_MESSAGE' |
118 | EXPORTING |
119 | diagnosetext1 = svim_text_013 "Die Adresse für das |
120 | diagnosetext2 = <am_key> |
121 | diagnosetext3 = svim_text_014 "wurde nicht gefunden. |
122 | textline1 = svim_text_015"Möchten Sie eine neue er |
123 | titel = svim_text_016"Adresse nicht vorhanden |
124 | IMPORTING |
125 | answer = answer. |
126 | IF answer EQ 'J'. |
127 | mode = 'A'. |
128 | ELSE. |
129 | return = 4. |
130 | EXIT. |
131 | ENDIF. |
132 | ELSE. |
133 | MESSAGE i055(sv) WITH <am_key>. |
134 | return = 4. |
135 | EXIT. |
136 | ENDIF. |
137 | ELSE. |
138 | EXIT. |
139 | ENDIF. |
140 | ENDDO. |
141 | IF status-action NE anzeigen AND status-action NE transportieren AND |
142 | adrnbr_roflag EQ space. |
143 | IF return NE 4 AND sadr-adrnr NE <address_number> OR |
144 | am_save NE space. "transport for address changes is requested |
145 | MOVE: 'X' TO <status>-upd_flag, |
146 | sadr-adrnr TO <address_number>. |
147 | ENDIF. |
148 | ENDIF. |
149 | CLEAR am_ucomm. |
150 | ELSE. "4.0: use new version of address maintenance |
151 | IF status-action NE anzeigen AND status-action NE transportieren AND |
152 | adrnbr_roflag EQ space. |
153 | IF status-action EQ kopieren. |
154 | IF <address_number> NE space. |
155 | IF <address_number> NP '@NEW*'. |
156 | am_sel-addrnumber = <address_number>. |
157 | ELSE. |
158 | am_sel-addrhandle = <f1_x>. |
159 | ENDIF. |
160 | CALL FUNCTION 'ADDR_GET' |
161 | EXPORTING |
162 | address_selection = am_sel |
163 | IMPORTING |
164 | address_value = am_address |
165 | EXCEPTIONS |
166 | parameter_error = 1 |
167 | address_not_exist = 2 |
168 | version_not_exist = 3 |
169 | internal_error = 4. |
170 | IF sy-subrc EQ 0. |
171 | MOVE-CORRESPONDING am_address TO am_handletab. "#EC * |
172 | ENDIF. |
173 | ENDIF. |
174 | CLEAR <address_number>. |
175 | am_handletab-maint_mode = 'CREATE'. |
176 | ELSE. |
177 | IF <address_number> EQ space. |
178 | am_handletab-maint_mode = 'CREATE'. |
179 | ELSE. |
180 | am_handletab-maint_mode = 'CHANGE'. |
181 | ENDIF. |
182 | ENDIF. "status-action eq kopieren. |
183 | ELSE. |
184 | IF <address_number> IS INITIAL. "no address assigned |
185 | MESSAGE i055(sv) WITH <am_key>. |
186 | EXIT. |
187 | ENDIF. |
188 | am_handletab-maint_mode = 'DISPLAY'. |
189 | ENDIF. |
190 | IF am_handletab-maint_mode EQ 'CREATE' OR |
191 | <address_number> CP '@NEW*'. |
192 | <am_handle_x>(x_header-keylen) = <f1_x>. |
193 |
194 | ELSE. |
195 | CLEAR am_handletab-handle. |
196 | ENDIF. |
197 | IF <address_number> NP '@NEW*'. |
198 | am_handletab-addrnumber = <address_number>. |
199 | ELSE. |
200 | CLEAR am_handletab-addrnumber. |
201 | ENDIF. |
202 | am_handletab-addr_group = vim_addr_group. |
203 | APPEND am_handletab. |
204 |
205 | CLEAR: vim_addr_field_selection, |
206 | vim_addr_keywords, |
207 | vim_addr_chng_deflt_comm_types, |
208 | vim_addr_frame_text, |
209 | vim_addr_excluded_functions. |
210 | REFRESH vim_addr_excluded_functions. |
211 | vim_addr_titlebar = am_title. |
212 | CLEAR vim_skip_adr_maint. "UF120400 |
213 | IF x_header-frm_bf_adr NE space. "...yes |
214 | PERFORM (x_header-frm_bf_adr) IN PROGRAM. |
215 | ENDIF. |
216 | CHECK vim_skip_adr_maint IS INITIAL. "UF120400 |
217 | CALL FUNCTION 'ADDR_DIALOG_PREPARE' |
218 | EXPORTING |
219 | field_selection = vim_addr_field_selection |
220 | keywords = vim_addr_keywords |
221 |
222 | titlebar = vim_addr_titlebar |
223 | change_default_comm_types = vim_addr_chng_deflt_comm_types |
224 | frame_text = vim_addr_frame_text |
225 | TABLES |
226 | excluded_functions = vim_addr_excluded_functions |
227 |
228 | EXCEPTIONS |
229 | internal_error = 1 |
230 | OTHERS = 2. |
231 | IF am_handletab-maint_mode EQ 'CHANGE' AND |
232 | am_handletab-addrnumber NE space. |
233 | READ TABLE vim_locked_addresses FROM am_handletab-addrnumber |
234 | TRANSPORTING NO FIELDS. |
235 | IF sy-subrc NE 0. "not yet locked |
236 | CALL FUNCTION 'ADDR_ENQUEUE' |
237 | EXPORTING |
238 | address_number = am_handletab-addrnumber |
239 |
240 |
241 |
242 |
243 | EXCEPTIONS |
244 | address_not_exist = 1 |
245 | foreign_lock = 2 |
246 | system_failure = 3 |
247 | internal_error = 4. |
248 | CASE sy-subrc. |
249 | WHEN 0. |
250 | INSERT am_handletab-addrnumber INTO TABLE |
251 | vim_locked_addresses. |
252 | WHEN 1. |
253 | IF status-action NE anzeigen AND |
254 | status-action NE transportieren AND |
255 | adrnbr_roflag EQ space. |
256 | CALL FUNCTION 'POPUP_TO_CONFIRM_WITH_MESSAGE' |
257 | EXPORTING |
258 | diagnosetext1 = svim_text_013"Die Adresse für das Obj: |
259 | diagnosetext2 = <am_key> |
260 | diagnosetext3 = svim_text_014"wurde nicht gefunden. |
261 | textline1 = svim_text_015"Möchten Sie eine neue er |
262 | titel = svim_text_016"Adresse nicht vorhanden |
263 | IMPORTING |
264 | answer = answer. |
265 | IF answer EQ 'J'. |
266 | am_handletab-maint_mode = 'CREATE'. |
267 | IF <address_number> NP '@NEW*'. |
268 | <am_handle_x>(x_header-keylen) = <f1_x>. |
269 |
270 | CLEAR am_handletab-addrnumber. |
271 | ENDIF. |
272 | MODIFY am_handletab INDEX 1. |
273 | ELSE. |
274 | EXIT. |
275 | ENDIF. |
276 | ELSE. |
277 | MESSAGE i055(sv) WITH <am_key>. |
278 | EXIT. |
279 | ENDIF. |
280 | WHEN 2. |
281 | MESSAGE i049(sv) WITH sy-msgv1. |
282 | am_handletab-maint_mode = 'DISPLAY'. |
283 | WHEN OTHERS. |
284 | MESSAGE i050(sv) WITH <am_key>. |
285 | am_handletab-maint_mode = 'DISPLAY'. |
286 | ENDCASE. |
287 | ENDIF. "not yet locked |
288 | ENDIF. "am_handletab-maint_mode eq 'CHANGE' and no new address |
289 | DO. |
290 | CALL FUNCTION 'ADDR_DIALOG' |
291 | IMPORTING |
292 | ok_code = am_ucomm |
293 | TABLES |
294 | number_handle_tab = am_handletab |
295 |
296 | EXCEPTIONS |
297 | address_not_exist = 1 |
298 | group_not_valid = 2 |
299 | parameter_error = 3 |
300 | internal_error = 4. |
301 | CASE sy-subrc. |
302 | WHEN 0. |
303 | READ TABLE am_handletab INDEX 1. |
304 | EXIT. |
305 | WHEN 1. |
306 | IF status-action NE anzeigen AND |
307 | status-action NE transportieren AND |
308 | adrnbr_roflag EQ space. |
309 | CALL FUNCTION 'POPUP_TO_CONFIRM_WITH_MESSAGE' |
310 | EXPORTING |
311 | diagnosetext1 = svim_text_013 "Die Adresse für das |
312 | diagnosetext2 = <am_key> |
313 | diagnosetext3 = svim_text_014"wurde nicht gefunden. |
314 | textline1 = svim_text_015"Möchten Sie eine neue er |
315 | titel = svim_text_016"Adresse nicht vorhanden |
316 | IMPORTING |
317 | answer = answer. |
318 | IF answer EQ 'J'. |
319 | READ TABLE am_handletab INDEX 1. |
320 | am_handletab-maint_mode = 'CREATE'. |
321 | IF <address_number> NP '@NEW*'. |
322 | <am_handle_x>(x_header-keylen) = <f1_x>. |
323 |
324 | CLEAR am_handletab-addrnumber. |
325 | ENDIF. |
326 | MODIFY am_handletab INDEX 1. |
327 | ELSE. |
328 | am_ucomm = 'CANC'. |
329 | EXIT. |
330 | ENDIF. |
331 | ELSE. |
332 | MESSAGE i055(sv) WITH <am_key>. |
333 | am_ucomm = 'CANC'. |
334 | EXIT. |
335 | ENDIF. |
336 | WHEN OTHERS. |
337 | MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno WITH |
338 | sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. |
339 | am_ucomm = 'CANC'. EXIT. |
340 | ENDCASE. |
341 | ENDDO. |
342 | IF am_handletab-maint_mode EQ 'CHANGE' AND |
343 | am_handletab-addrnumber NE space AND |
344 | ( am_ucomm EQ 'CANC' OR am_handletab-updateflag EQ space ). |
345 | READ TABLE vim_locked_addresses FROM am_handletab-addrnumber |
346 | TRANSPORTING NO FIELDS. |
347 | IF sy-subrc EQ 0. "dequeue |
348 | CALL FUNCTION 'ADDR_DEQUEUE' |
349 | EXPORTING |
350 | address_number = am_handletab-addrnumber |
351 |
352 |
353 |
354 |
355 | EXCEPTIONS |
356 | address_not_exist = 1 |
357 | internal_error = 2. |
358 | ENDIF. |
359 | ENDIF. |
360 | IF status-action NE anzeigen AND status-action NE transportieren AND |
361 | adrnbr_roflag EQ space. |
362 | IF am_ucomm NE 'CANC'. |
363 | IF am_handletab-maint_mode EQ 'CREATE'. |
364 | <address_number> = '@NEW'. |
365 | <address_number>+4(6) = <status>-newadrcnt. |
366 | ADD 1 TO <status>-newadrcnt. |
367 | <status>-upd_flag = 'X'. |
368 | ENDIF. |
369 | IF am_handletab-updateflag NE space. "addr. itself is to be save |
370 | READ TABLE vim_addresses_to_save |
371 | WITH KEY viewname = x_header-viewname |
372 | addrnumber = <address_number> |
373 | BINARY SEARCH TRANSPORTING NO FIELDS. |
374 | IF sy-subrc NE 0. |
375 | vim_addresses_to_save-addrnumber = <address_number>. |
376 | CLEAR vim_addresses_to_save-handle. |
377 | <vim_addr_handle_x>(x_header-keylen) = <f1_x>. |
378 |
379 | INSERT vim_addresses_to_save INDEX sy-tabix. |
380 | ENDIF. |
381 | IF vim_client_state EQ vim_log AND |
382 | x_header-flag NE vim_transport_denied. |
383 | <status>-upd_flag = 'X'. "nec. for transport of master entry |
384 | ENDIF. |
385 | ENDIF. |
386 | ENDIF. |
387 | ENDIF. |
388 | CLEAR return. |
389 | ENDIF. "am_statetab-value eq space. |
390 |
391 | IF status-action NE kopieren AND status-action NE hinzufuegen AND |
392 | vim_single_entry_function NE 'INS'. |
393 | IF return NE 4 AND am_ucomm NE 'CANC'. |
394 | IF <xmark> EQ markiert. |
395 | <xmark> = nicht_markiert. |
396 | IF <status>-upd_flag EQ space. |
397 | MODIFY extract INDEX exind. |
398 | READ TABLE total WITH KEY <vim_xextract_key> BINARY SEARCH. |
399 | <mark> = nicht_markiert. |
400 | MODIFY total INDEX sy-tabix. |
401 | ENDIF. |
402 | SUBTRACT: 1 FROM mark_extract, |
403 | 1 FROM mark_total. |
404 | ENDIF. |
405 | ENDIF. |
406 | CLEAR function. |
407 | ENDIF. |
408 | ENDFORM. "address_maintain |