*----------------------------------------------------------------------* * INCLUDE LSVIMF46 * *----------------------------------------------------------------------* * -> = View-Workarea (= zu übernehmender * Eintrag, aber Adreßnummer des akt. Mandant/System; * Adreßnummer wurde in VIM_MODIFY_VIEW_ENTRY ausgetauscht) * -> (keylen) * VIM_UPGR_ADDRESS_NUMBER -> Adresse des zu übernehmenden Eintrages * Achtung: in TOTAL steht NICHT(!) mehr der Eintrag aus akt. Mandant/Sys * zur Verfügung wegen Zuweisung 'move to total' * in liste_initialisieren im 'Replace_mode'. *----------------------------------------------------------------------* FORM vim_address_adjust. DATA: addr_comp_tab TYPE szadr_compare_addr1_tab, addr_comp_line TYPE szadr_compare_addr1_line, handle TYPE ad_handle, create_address(1) TYPE c, retcode LIKE szad_field-returncode, error_info LIKE addr_error OCCURS 0 WITH HEADER LINE, einfo LIKE addr_error, i_msgv1 LIKE sy-msgv1, space_msgv LIKE sy-msgv1 VALUE space, dum TYPE i, pos_char TYPE i. FIELD-SYMBOLS: TYPE x, TYPE ANY. * nur neue Adreßpflege! CHECK x_header-adrnbrflag = 'N' AND adrnbr_roflag = space. ASSIGN handle TO CASTING. IF vim_import_mode_active = space. "interaktive Übernahme IF vim_upgr_address_number <> '@ADJUSTED@'. "cmpwl_addr_adjusted EXIT. ENDIF. IF = space. = . * HANDLE = . create_address = 'X'. ELSE. READ TABLE vim_locked_addresses FROM TRANSPORTING NO FIELDS. IF sy-subrc <> 0. "not yet locked CALL FUNCTION 'ADDR_ENQUEUE' EXPORTING address_number = * MODE_ADRC = 'E' EXCEPTIONS address_not_exist = 1 foreign_lock = 2 system_failure = 3 internal_error = 4. CASE sy-subrc. WHEN 0. INSERT INTO TABLE vim_locked_addresses. WHEN 1. = . * HANDLE = . create_address = 'X'. CLEAR . WHEN 2. PERFORM vim_process_message USING 'SV' 'E' 'E' '049' sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. WHEN OTHERS. * i_msgv1 = . "HCG Dump when nonchar field in view LOOP AT x_namtab. "HCG write field by field instead ASSIGN COMPONENT x_namtab-viewfield OF STRUCTURE TO . dum = ( x_namtab-position + x_namtab-flength ) / cl_abap_char_utilities=>charsize. pos_char = x_namtab-position / cl_abap_char_utilities=>charsize. IF dum <= 13. WRITE TO i_msgv1+pos_char. ELSE. dum = 13 - pos_char. WRITE (dum) TO i_msgv1+pos_char. EXIT. "HCG i_msgv1 filled ENDIF. ENDLOOP. PERFORM vim_process_message USING 'SV' 'E' 'E' '050' i_msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDCASE. ENDIF. " SY-SUBRC <> 0. ENDIF. " = SPACE ELSE. "automat. Übernahme IF vim_upgr_address_number = space. * i_msgv1 = . "HCG Dump when nonchar field in view LOOP AT x_namtab. "HCG write field by field instead ASSIGN COMPONENT x_namtab-viewfield OF STRUCTURE TO . dum = ( x_namtab-position + x_namtab-flength ) / cl_abap_char_utilities=>charsize. pos_char = x_namtab-position / cl_abap_char_utilities=>charsize. IF dum <= 13. WRITE TO i_msgv1+pos_char. ELSE. dum = 13 - pos_char. WRITE (dum) TO i_msgv1+pos_char. EXIT. "HCG i_msgv1 filled ENDIF. ENDLOOP. PERFORM vim_process_message USING 'SV' 'I' 'I' '165' i_msgv1 space_msgv space_msgv space_msgv. EXIT. "keine Löschung ENDIF. addr_comp_line-addrnumber = . IF = space. = . addr_comp_line-addrhandle = handle. * ADDR_COMP_LINE-ADDRHANDLE = . * HANDLE = . create_address = 'X'. ENDIF. addr_comp_line-remote_addrnumber = vim_upgr_address_number. APPEND addr_comp_line TO addr_comp_tab. CALL FUNCTION 'ADDR_COMPARE' EXPORTING rfc_destination = vim_default_rfc_dest-rfcdest TABLES compare_tab = addr_comp_tab EXCEPTIONS rfc_error = 1 OTHERS = 2. IF sy-subrc <> 0. PERFORM vim_process_message USING sy-msgid 'E' 'E' sy-msgno sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. EXIT. ENDIF. READ TABLE addr_comp_tab INDEX 1 INTO addr_comp_line. IF addr_comp_line-parameter_error = 'X' OR addr_comp_line-internal_error = 'X'. einfo = addr_comp_line-error_table. PERFORM vim_process_message USING einfo-msg_id 'E' 'E' einfo-msg_number einfo-msg_var1 einfo-msg_var2 einfo-msg_var3 einfo-msg_var4. * Adresse kann nicht abgeglichen werden -> Eintrag verwerfen EXIT. ENDIF. IF addr_comp_line-rem_address_not_exist = 'X'. "keine Löschung! * i_msgv1 = . "HCG Dump when nonchar field in view LOOP AT x_namtab. "HCG write field by field instead ASSIGN COMPONENT x_namtab-viewfield OF STRUCTURE TO . dum = ( x_namtab-position + x_namtab-flength ) / cl_abap_char_utilities=>charsize. pos_char = x_namtab-position / cl_abap_char_utilities=>charsize. IF dum <= 13. WRITE TO i_msgv1+pos_char. ELSE. dum = 13 - pos_char. WRITE (dum) TO i_msgv1+pos_char. EXIT. "HCG i_msgv1 filled ENDIF. ENDLOOP. PERFORM vim_process_message USING 'SV' 'I' 'I' '165' i_msgv1 space_msgv space_msgv space_msgv. EXIT. ELSEIF addr_comp_line-address_not_exist = 'X' AND create_address = space. = . * HANDLE = . create_address = 'X'. CLEAR: , . REFRESH addr_comp_tab. CLEAR addr_comp_line. addr_comp_line = handle. * ADDR_COMP_LINE-ADDRHANDLE = . addr_comp_line-remote_addrnumber = vim_upgr_address_number. APPEND addr_comp_line TO addr_comp_tab. CALL FUNCTION 'ADDR_COMPARE' EXPORTING rfc_destination = vim_default_rfc_dest-rfcdest TABLES compare_tab = addr_comp_tab EXCEPTIONS rfc_error = 1 OTHERS = 2. IF sy-subrc <> 0. PERFORM vim_process_message USING sy-msgid 'E' 'E' sy-msgno sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. EXIT. ENDIF. READ TABLE addr_comp_tab INDEX 1 INTO addr_comp_line. IF addr_comp_line-parameter_error = 'X' OR addr_comp_line-internal_error = 'X'. einfo = addr_comp_line-error_table. PERFORM vim_process_message USING einfo-msg_id 'E' 'E' einfo-msg_number einfo-msg_var1 einfo-msg_var2 einfo-msg_var3 einfo-msg_var4. * Adresse kann nicht abgeglichen werden -> Eintrag verwerfen EXIT. ENDIF. * Überprüfung von REM_ADDRESS_NOT_EXIST, .. hier nicht nötig ELSEIF addr_comp_line-address_is_equal = 'X'. EXIT. ELSEIF create_address = space. READ TABLE vim_locked_addresses FROM TRANSPORTING NO FIELDS. IF sy-subrc <> 0. "not yet locked CALL FUNCTION 'ADDR_ENQUEUE' EXPORTING address_number = * MODE_ADRC = 'E' EXCEPTIONS address_not_exist = 1 foreign_lock = 2 system_failure = 3 internal_error = 4. CASE sy-subrc. WHEN 0. INSERT INTO TABLE vim_locked_addresses. WHEN 1. " würde schon in ADDR_COMPARE auftreten PERFORM vim_process_message "eigentlich überflüssig USING 'SV' 'E' 'E' '049' sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. WHEN 2. PERFORM vim_process_message USING 'SV' 'E' 'E' '049' sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. WHEN OTHERS. * i_msgv1 = . "HCG Dump when nonchar field in view LOOP AT x_namtab. "HCG write field by field instead ASSIGN COMPONENT x_namtab-viewfield OF STRUCTURE TO . dum = ( x_namtab-position + x_namtab-flength ) / cl_abap_char_utilities=>charsize. pos_char = x_namtab-position / cl_abap_char_utilities=>charsize. IF dum <= 13. WRITE TO i_msgv1+pos_char. ELSE. dum = 13 - pos_char. WRITE (dum) TO i_msgv1+pos_char. EXIT. "HCG i_msgv1 filled ENDIF. ENDLOOP. PERFORM vim_process_message USING 'SV' 'E' 'E' '050' i_msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDCASE. ENDIF. "SY-SUBRC ENDIF. ENDIF. " vim_import_mode_active CALL FUNCTION 'ADDR_ADJUST' EXPORTING addrnumber = addrhandle = handle address_group = 'CA01' IMPORTING returncode = retcode TABLES error_table = error_info EXCEPTIONS parameter_error = 1 address_not_exist = 2 handle_exist = 3 internal_error = 4 address_not_compared = 5 OTHERS = 6. IF sy-subrc <> 0. PERFORM vim_process_message USING sy-msgid 'E' 'E' sy-msgno sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ELSE. IF retcode = 'E'. READ TABLE error_info INDEX 1. PERFORM vim_process_message USING error_info-msg_id 'E' 'E' error_info-msg_number error_info-msg_var1 error_info-msg_var2 error_info-msg_var3 error_info-msg_var4. ELSE. "ok IF create_address = 'X'. = '@NEW'. +4(6) = -newadrcnt. ADD 1 TO -newadrcnt. -upd_flag = 'X'. ENDIF. = . READ TABLE vim_addresses_to_save WITH KEY viewname = x_header-viewname addrnumber = BINARY SEARCH TRANSPORTING NO FIELDS. IF sy-subrc NE 0. vim_addresses_to_save-viewname = x_header-viewname. vim_addresses_to_save-addrnumber = . = . * VIM_ADDRESSES_TO_SAVE-HANDLE = . INSERT vim_addresses_to_save INDEX sy-tabix. ENDIF. IF vim_client_state EQ vim_log AND x_header-flag NE vim_transport_denied. -upd_flag = 'X'. "nec. for transport of master entry ENDIF. ENDIF. "RETCODE ENDIF. "SY-SUBRC ENDFORM. "vim_address_adjust