Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *&---------------------------------------------------------------------*
- *& Номер спецификации: BR_D_024
- *& Наименование спецификации: Печатные формы
- *& Дата создания: 09.03.2021
- *& Проект: Создание печатных форм
- *& Разработчик: Федоров К
- *&
- *&!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- *& При разработке формуляра использовался скрипт FormCalc (для удаления последней пустой страницы):
- *& Subform2>Object>Pagination>Conditional>Edit
- *&!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- METHOD get_vehwaybill_data.
- DATA: ls_form TYPE zstm_vehicle_waybill,
- lt_form TYPE TABLE OF zstm_vehicle_waybill,
- lt_tor_root TYPE /scmtms/t_tor_root_k,
- lt_tor_stop TYPE /scmtms/t_tor_stop_k,
- lt_tor_stop_first TYPE /scmtms/t_tor_stop_k,
- lt_mtrl_description TYPE /scmtms/t_mat_description_k,
- lt_tor_item_tr TYPE /scmtms/t_tor_item_tr_k,
- lt_toritemtrunique_itemcatprd TYPE /scmtms/t_tor_item_tr_k,
- lt_toritemtrunique_itemcattur TYPE /scmtms/t_tor_item_tr_k,
- lt_sel_opt_f TYPE /bobf/t_frw_query_selparam,
- lt_sel_opt_l TYPE /bobf/t_frw_query_selparam,
- ls_sel_opt_f LIKE LINE OF lt_sel_opt_f,
- ls_sel_opt_l LIKE LINE OF lt_sel_opt_l,
- lt_loc_data_f TYPE /scmtms/t_loc_q_elem_result,
- lt_loc_data_l TYPE /scmtms/t_loc_q_elem_result,
- lv_node_key TYPE /bobf/obm_node_key,
- lv_assoc_key TYPE /bobf/obm_assoc_key,
- lv_node_key_tel TYPE /bobf/obm_node_key,
- lv_assoc_key_telephone TYPE /bobf/obm_assoc_key,
- lv_assoc_key_postal_address TYPE /bobf/obm_assoc_key,
- lt_bofu_address_postal_address TYPE /bofu/t_addr_postal_addressk,
- lt_loc_root_f TYPE /scmtms/t_bo_loc_root_k,
- lt_loc_root_l TYPE /scmtms/t_bo_loc_root_k,
- lt_drv_root TYPE /scmtms/t_res_lab_root_k,
- lt_tras_capa_offer TYPE /scmtms/t_res_quantity_k,
- lt_bupa_consignee TYPE /bofu/t_bupa_root_k,
- lt_tor_bupa_root TYPE /bofu/t_bupa_root_k,
- lt_role TYPE /bofu/t_bupa_role_k,
- lt_tor_bupa_ship_root TYPE /bofu/t_bupa_root_k,
- lt_bupa_data TYPE /bofu/t_bupa_root_k,
- ls_bupa_data LIKE LINE OF lt_bupa_data,
- lt_but000 TYPE TABLE OF but000,
- lt_but000_bupa_ship TYPE TABLE OF but000,
- lt_but000_bupa_consignee TYPE TABLE OF but000,
- lt_but000_tor_root TYPE TABLE OF but000,
- lt_relationship TYPE /bofu/t_bupa_relship_k,
- lt_transp_capa_offer TYPE /scmtms/t_res_quantity_k,
- lt_res_root TYPE /scmtms/t_res_root_k,
- lt_bofu_address_telephone TYPE /bofu/t_addr_telephonek,
- lt_stop_first TYPE /scmtms/t_tor_stop_k,
- lt_key_bupa TYPE /bobf/t_frw_key,
- ls_key_bupa LIKE LINE OF lt_key_bupa,
- lt_role_ship TYPE /bofu/t_bupa_role_k,
- lt_bp_root TYPE /bofu/t_bupa_root_k,
- ls_selpar TYPE /bobf/s_frw_query_selparam,
- lt_selpar TYPE /bobf/t_frw_query_selparam,
- go_message TYPE REF TO /bobf/if_frw_message,
- ls_bofu_address_telephone_4_1 LIKE LINE OF lt_bofu_address_telephone,
- ls_bofu_address_telephone_4_2 LIKE LINE OF lt_bofu_address_telephone,
- ls_bofu_address_telephone_6_1 LIKE LINE OF lt_bofu_address_telephone,
- ls_bofu_address_telephone_6_2 LIKE LINE OF lt_bofu_address_telephone,
- ls_bofu_address_telephone_5_1 LIKE LINE OF lt_bofu_address_telephone,
- ls_bofu_address_telephone_5_2 LIKE LINE OF lt_bofu_address_telephone,
- ls_bofu_address_telephone_7_1 LIKE LINE OF lt_bofu_address_telephone,
- ls_bofu_address_telephone_7_2 LIKE LINE OF lt_bofu_address_telephone,
- ls_bofu_address_telephone_42_1 LIKE LINE OF lt_bofu_address_telephone,
- ls_bofu_address_telephone_42_2 LIKE LINE OF lt_bofu_address_telephone,
- ls_bofu_address_telephone_43_1 LIKE LINE OF lt_bofu_address_telephone,
- ls_bofu_address_telephone_43_2 LIKE LINE OF lt_bofu_address_telephone,
- ls_bofu_address_telephone_44_1 LIKE LINE OF lt_bofu_address_telephone,
- ls_bofu_address_telephone_44_2 LIKE LINE OF lt_bofu_address_telephone,
- ls_bofu_addr_telephone_23_1 LIKE LINE OF lt_bofu_address_telephone,
- ls_bofu_addr_telephone_23_2 LIKE LINE OF lt_bofu_address_telephone,
- lt_bofu_addr_tel_sorted LIKE lt_bofu_address_telephone,
- lv_date TYPE d,
- lv_time TYPE t,
- lv_date_result TYPE c LENGTH 11,
- lv_zzcargo_condition_i TYPE i,
- lv_qua_pcs_val_9 TYPE i,
- lv_gro_wei_val_10 TYPE p LENGTH 10 DECIMALS 2,
- lt_tor_z_pdf TYPE ztttm_tor_pdf_k,
- lt_bupa_common TYPE /bofu/t_bupa_common_k,
- lt_bupa_tax_number TYPE /bofu/t_bupa_taxno_k,
- lt_t005u TYPE TABLE OF t005u,
- lt_but0bk TYPE TABLE OF but0bk,
- lt_bnka TYPE TABLE OF bnka,
- zzfn_shipper1 TYPE c LENGTH 1000,
- zzfn_shipper2 TYPE c LENGTH 1000,
- zzname_shipper1 TYPE c LENGTH 1000,
- zzname_shipper2 TYPE c LENGTH 1000,
- zzname_consignee1 TYPE c LENGTH 1000,
- zzname_consignee2 TYPE c LENGTH 1000,
- lv_zz14x_priem_gruza_plomba TYPE c LENGTH 1000,
- lv_zz14x_priem_gruza_konteiner TYPE c LENGTH 1000,
- lv_zz26x_reg_nomer_ts TYPE c LENGTH 1000,
- lv_zz26x_reg_nomer_pricep TYPE c LENGTH 1000,
- zz3and4x_shipper TYPE c LENGTH 1000,
- lt_tor_bo_material TYPE /scmtms/t_mat_root_k,
- lt_sapapo_matkey TYPE TABLE OF /sapapo/matkey,
- lt_zttm_group_mat_t TYPE TABLE OF zttm_group_mat_t,
- lt_loc_postal_address TYPE /bofu/t_addr_postal_addressk,
- lt_tor_item_tr_unique TYPE TABLE OF /scmtms/s_tor_item_tr_k,
- lt_tor_bo_bupa_consignee TYPE /bofu/t_bupa_root_k,
- lt_toritemtr_linkkeysunique TYPE /bobf/t_frw_key_link,
- lt_torbomat_linkkeysunique TYPE /bobf/t_frw_key_link,
- lt_tor_bo_material_unique LIKE lt_tor_bo_material,
- lt_sapapo_matkey_unique LIKE lt_sapapo_matkey,
- lt_bofu_address_telephone_5 LIKE lt_bofu_address_telephone,
- lt_bofu_addr_postal_addr_5 LIKE lt_bofu_address_postal_address,
- lt_bp_common_5 TYPE /bofu/t_bupa_common_k,
- lt_bp_tax_number_5 TYPE /bofu/t_bupa_taxno_k,
- lt_zz7x_naimenovanie_gruza TYPE STANDARD TABLE OF string,
- lv_testing TYPE string,
- lv_string_length TYPE i,
- lv_zz9x_gruz_massa_brutto TYPE decfloat16,
- lv_zz15x_priemgruza_vesbrutto TYPE decfloat16,
- lt_bp_postal_address TYPE /bofu/t_addr_postal_addressk,
- lt_t005u_11x TYPE TABLE OF t005u,
- lt_tor_seal TYPE /scmtms/t_tor_seal_k,
- lt_tor_bo_driver TYPE /scmtms/t_res_lab_root_k,
- lt_tor_bo_resource TYPE /scmtms/t_res_root_k,
- lt_splr_common TYPE /bofu/t_bupa_common_k,
- lt_tor_bo_tsp_root TYPE /bofu/t_bupa_root_k,
- lt_splr_tax_number TYPE /bofu/t_bupa_taxno_k,
- lt_bofu_addr_post_addr_18 LIKE lt_bofu_address_postal_address,
- lt_bofu_addr_postal_addr_23 LIKE lt_bofu_address_postal_address,
- lt_t005u_23x TYPE TABLE OF t005u,
- lt_bofu_addr_telephone_23 LIKE lt_bofu_address_telephone,
- lt_tor_item_tr_unique_dri LIKE lt_tor_item_tr_unique,
- lt_tor_bo_loc_log_18 TYPE /scmtms/t_bo_loc_root_k,
- lt_tor_stop_18_keys TYPE /bobf/t_frw_key,
- lt_tor_item_tr_item_cat_dri LIKE lt_tor_item_tr,
- lt_tor_boloclog18keys_unique TYPE /bobf/t_frw_key,
- lt_loc_address_18 TYPE /bofu/t_addr_addressi_k,
- lt_loc_address_18_unique LIKE lt_loc_address_18,
- lt_pos_address TYPE /bofu/t_addr_postal_addressk,
- lt_bupa_taxnum TYPE /bofu/t_bupa_taxno_k,
- lt_bp_taxnum TYPE /bofu/t_bupa_taxno_k,
- lt_bupa_pos_address TYPE /bofu/t_addr_postal_addressk,
- lt_bupa_addrinfo TYPE /bofu/t_bupa_adrinfo_k,
- lt_bupa_address TYPE /bofu/t_addr_addressi_k,
- lt_telephone TYPE /bofu/t_addr_telephonek,
- zzvehicle_param TYPE c LENGTH 100,
- lv_qua_pcs_val_all TYPE i,
- lt_17_itemtr_bodriver TYPE /scmtms/t_res_lab_root_k,
- lt_17_itemtr_bodriver_res TYPE /scmtms/t_res_lab_root_k,
- lt_bp_taxnum_res LIKE lt_bp_taxnum,
- lt_drv_addr_tel TYPE /bofu/t_addr_telephonek.
- *1x поле
- mo_tor_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_tor_c=>sc_node-root
- it_key = it_tor_key
- iv_association = /scmtms/if_tor_c=>sc_association-root-stop_first
- iv_fill_data = abap_true
- IMPORTING
- et_target_key = DATA(lt_tor_stop_first_keys)
- et_data = lt_tor_stop_first ).
- READ TABLE lt_tor_stop_first INTO DATA(ls_tor_stop_first) INDEX 1.
- CONVERT TIME STAMP ls_tor_stop_first-plan_trans_time TIME ZONE sy-zonlo
- INTO DATE lv_date TIME lv_time.
- CONCATENATE lv_date+6(2) '.' lv_date+4(2) '.' lv_date(4) INTO lv_date_result.
- ls_form-zz1x_actual_shipment_date = lv_date_result.
- *2x поле
- mo_tor_srv->retrieve(
- EXPORTING
- iv_node_key = /scmtms/if_tor_c=>sc_node-root
- it_key = it_tor_key
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_tor_root ).
- READ TABLE lt_tor_root INTO DATA(ls_tor_root) INDEX 1.
- ls_form-zz2x_bill_of_lading_num = ls_tor_root-tor_id.
- SHIFT ls_form-zz2x_bill_of_lading_num LEFT DELETING LEADING '0'.
- *3x поле, 4x поле; 5x поле - получение, 6x поле - получение
- *3x поле, 4x поле
- mo_tor_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_tor_c=>sc_node-root
- it_key = it_tor_key
- iv_association = /scmtms/if_tor_c=>sc_association-root-bupa_ship_root
- iv_fill_data = abap_true
- IMPORTING
- et_target_key = DATA(lt_tor_bupa_ship_keys)
- et_data = lt_tor_bupa_ship_root ).
- mo_bupa_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_bupa_constants=>sc_node-root
- it_key = lt_tor_bupa_ship_keys
- iv_association = /bofu/if_bupa_constants=>sc_association-root-common
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_bupa_common ).
- mo_bupa_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_bupa_constants=>sc_node-root
- it_key = lt_tor_bupa_ship_keys
- iv_association = /bofu/if_bupa_constants=>sc_association-root-tax_number
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_bupa_tax_number ).
- mo_tor_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_tor_c=>sc_node-root
- it_key = it_tor_key
- iv_association = /scmtms/if_tor_c=>sc_association-root-item_tr
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_tor_item_tr
- et_target_key = DATA(lt_tor_item_tr_keys)
- et_key_link = DATA(lt_tor_item_tr_link_keys) ).
- mo_tor_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_tor_c=>sc_node-item_tr
- it_key = lt_tor_item_tr_keys
- iv_association = /scmtms/if_tor_c=>sc_association-item_tr-itemparty
- IMPORTING
- et_target_key = DATA(lt_tor_itemparty_keys) ).
- mo_tor_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_tor_c=>sc_node-itemparty
- it_key = lt_tor_itemparty_keys
- iv_association = /scmtms/if_tor_c=>sc_association-itemparty-bupa_root
- IMPORTING
- et_data = lt_tor_bupa_root
- et_target_key = DATA(lt_tor_bupa_root_keys) ).
- mo_bp_srv->retrieve_by_association(
- EXPORTING
- it_key = lt_tor_bupa_ship_keys
- iv_node_key = /bofu/if_bupa_constants=>sc_node-root
- iv_association = /bofu/if_bupa_constants=>sc_association-root-addressinformation
- IMPORTING
- et_target_key = DATA(lt_bp_addressinformation_keys) ).
- mo_bp_srv->retrieve_by_association(
- EXPORTING
- it_key = lt_bp_addressinformation_keys
- iv_node_key = /bofu/if_bupa_constants=>sc_node-addressinformation
- iv_association = /bofu/if_bupa_constants=>sc_association-addressinformation-address
- IMPORTING
- et_target_key = DATA(lt_bp_address_keys) ).
- /scmtms/cl_common_helper=>get_do_keys_4_rba(
- EXPORTING
- iv_host_bo_key = /bofu/if_bupa_constants=>sc_bo_key
- iv_host_do_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
- iv_do_node_key = /bofu/if_addr_constants=>sc_node-telephone
- iv_do_assoc_key = /bofu/if_addr_constants=>sc_association-root-telephone
- IMPORTING
- ev_assoc_key = lv_assoc_key_telephone ).
- mo_bp_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
- iv_association = lv_assoc_key_telephone
- iv_fill_data = abap_true
- it_key = lt_bp_address_keys
- IMPORTING
- et_data = lt_bofu_address_telephone ).
- /scmtms/cl_common_helper=>get_do_keys_4_rba(
- EXPORTING
- iv_host_bo_key = /bofu/if_bupa_constants=>sc_bo_key
- iv_host_do_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
- iv_do_node_key = /bofu/if_addr_constants=>sc_node-postal_address
- iv_do_assoc_key = /bofu/if_addr_constants=>sc_association-root-postal_address
- IMPORTING
- ev_assoc_key = lv_assoc_key_postal_address ).
- mo_bp_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
- iv_association = lv_assoc_key_postal_address
- iv_fill_data = abap_true
- it_key = lt_bp_address_keys
- IMPORTING
- et_data = lt_bofu_address_postal_address ).
- READ TABLE lt_bofu_address_postal_address INTO DATA(ls_bofu_addr_postal_addr_4) INDEX 1.
- SELECT bezei
- FROM t005u
- INTO CORRESPONDING FIELDS OF TABLE lt_t005u
- WHERE bland EQ ls_bofu_addr_postal_addr_4-region AND land1 EQ ls_bofu_addr_postal_addr_4-country_code AND t005u~spras = 'R'.
- READ TABLE lt_t005u INTO DATA(ls_t005u) INDEX 1.
- READ TABLE lt_tor_bupa_ship_root INTO DATA(ls_tor_bupa_ship_root) INDEX 1.
- READ TABLE lt_bupa_common INTO DATA(ls_bupa_common) INDEX 1.
- READ TABLE lt_bupa_tax_number INTO DATA(ls_bupa_tax_number) WITH KEY taxtype = 'RU1'.
- SELECT bankn, banks, bankl
- FROM but0bk
- INTO CORRESPONDING FIELDS OF TABLE @lt_but0bk
- WHERE partner EQ @ls_tor_bupa_ship_root-partner.
- READ TABLE lt_but0bk INTO DATA(ls_but0bk) INDEX 1.
- SELECT banka, ort01, bnklz, brnch
- FROM bnka
- INTO CORRESPONDING FIELDS OF TABLE @lt_bnka
- WHERE banks EQ @ls_but0bk-banks AND bankl EQ @ls_but0bk-bankl.
- READ TABLE lt_bnka INTO DATA(ls_bnka) INDEX 1.
- READ TABLE lt_bofu_address_telephone INTO ls_bofu_address_telephone_4_1 INDEX 1.
- READ TABLE lt_bofu_address_telephone INTO ls_bofu_address_telephone_4_2 INDEX 2.
- IF ls_bupa_common-firstname IS NOT INITIAL.
- zz3and4x_shipper = ls_bupa_common-firstname.
- ENDIF.
- IF ls_bupa_common-lastname IS NOT INITIAL.
- zz3and4x_shipper = |{ zz3and4x_shipper } { ls_bupa_common-lastname }|.
- ENDIF.
- IF ls_bupa_tax_number-taxnumber IS NOT INITIAL.
- zz3and4x_shipper = |{ zz3and4x_shipper } { '; ИНН:' } { ls_bupa_tax_number-taxnumber }|.
- ENDIF.
- zz3and4x_shipper = |{ zz3and4x_shipper } { '; адрес:' }|.
- IF ls_t005u-bezei IS NOT INITIAL.
- zz3and4x_shipper = |{ zz3and4x_shipper } { ls_t005u-bezei }|.
- ENDIF.
- IF ls_bofu_addr_postal_addr_4-district_name IS NOT INITIAL.
- zz3and4x_shipper = |{ zz3and4x_shipper } { ',' } { ls_bofu_addr_postal_addr_4-district_name }|.
- ENDIF.
- IF ls_bofu_addr_postal_addr_4-city_name IS NOT INITIAL.
- zz3and4x_shipper = |{ zz3and4x_shipper } { ',' } { ls_bofu_addr_postal_addr_4-city_name }|.
- ENDIF.
- IF ls_bofu_addr_postal_addr_4-street_name IS NOT INITIAL.
- zz3and4x_shipper = |{ zz3and4x_shipper } { ',' } { ls_bofu_addr_postal_addr_4-street_name }|.
- ENDIF.
- IF ls_bofu_addr_postal_addr_4-house_id IS NOT INITIAL.
- zz3and4x_shipper = |{ zz3and4x_shipper } { ', дом' } { ls_bofu_addr_postal_addr_4-house_id }|.
- ENDIF.
- IF ls_bofu_address_telephone_4_1-normalised_number_text IS NOT INITIAL.
- zz3and4x_shipper = |{ zz3and4x_shipper } { ';' } { ls_bofu_address_telephone_4_1-normalised_number_text }|.
- ENDIF.
- IF ls_bofu_address_telephone_4_2-normalised_number_text IS NOT INITIAL.
- zz3and4x_shipper = |{ zz3and4x_shipper } { ',' } { ls_bofu_address_telephone_4_2-normalised_number_text }|.
- ENDIF.
- IF ls_but0bk-bankn IS NOT INITIAL.
- zz3and4x_shipper = |{ zz3and4x_shipper } { '; Р\С:' } { ls_but0bk-bankn }|.
- ENDIF.
- IF ls_bnka-banka IS NOT INITIAL.
- zz3and4x_shipper = |{ zz3and4x_shipper } { 'в банке' } { ls_bnka-banka }|.
- ENDIF.
- IF ls_bnka-ort01 IS NOT INITIAL.
- zz3and4x_shipper = |{ zz3and4x_shipper } { 'в городе' } { ls_bnka-ort01 }|.
- ENDIF.
- IF ls_bnka-bnklz IS NOT INITIAL.
- zz3and4x_shipper = |{ zz3and4x_shipper } { ', "БИК"' } { ls_bnka-bnklz }|.
- ENDIF.
- IF ls_bnka-brnch IS NOT INITIAL.
- zz3and4x_shipper = |{ zz3and4x_shipper } { ', К\С' } { ls_bnka-brnch }|.
- ENDIF.
- IF ls_tor_bupa_ship_root-type = '1'.
- ls_form-zz3x_shipper_individual = zz3and4x_shipper.
- ELSEIF ls_tor_bupa_ship_root-type = '2'.
- ls_form-zz4x_shipper_entity = zz3and4x_shipper.
- ENDIF.
- *5x поле - получение, 6x поле - получение
- mo_tor_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_tor_c=>sc_node-item_tr
- it_key = lt_tor_item_tr_keys
- iv_association = /scmtms/if_tor_c=>sc_association-item_tr-bo_bupa_consignee
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_tor_bo_bupa_consignee
- et_target_key = DATA(lt_tor_bo_bupa_consignee_keys) ).
- mo_bp_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_bupa_constants=>sc_node-root
- it_key = lt_tor_bo_bupa_consignee_keys
- iv_association = /bofu/if_bupa_constants=>sc_association-root-addressinformation
- iv_fill_data = abap_false
- IMPORTING
- et_target_key = DATA(lt_bp_addrinf_5_keys) ).
- mo_bp_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_bupa_constants=>sc_node-addressinformation
- it_key = lt_bp_addrinf_5_keys
- iv_association = /bofu/if_bupa_constants=>sc_association-addressinformation-address
- iv_fill_data = abap_false
- IMPORTING
- et_target_key = DATA(lt_bp_address_5_keys) ).
- mo_bp_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
- iv_association = lv_assoc_key_telephone
- iv_fill_data = abap_true
- it_key = lt_bp_address_5_keys
- IMPORTING
- et_data = lt_bofu_address_telephone_5 ).
- mo_bp_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
- iv_association = lv_assoc_key_postal_address
- iv_fill_data = abap_true
- it_key = lt_bp_address_5_keys
- IMPORTING
- et_data = lt_bofu_addr_postal_addr_5 ).
- mo_bp_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_bupa_constants=>sc_node-root
- it_key = lt_tor_bo_bupa_consignee_keys
- iv_association = /bofu/if_bupa_constants=>sc_association-root-common
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_bp_common_5 ).
- mo_bp_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_bupa_constants=>sc_node-root
- it_key = lt_tor_bo_bupa_consignee_keys
- iv_association = /bofu/if_bupa_constants=>sc_association-root-tax_number
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_bp_tax_number_5 ).
- SELECT bezei, land1, bland
- FROM t005u
- INTO CORRESPONDING FIELDS OF TABLE @lt_t005u
- WHERE spras EQ 'R'.
- SELECT partner, bankn, banks, bankl
- FROM but0bk
- INTO CORRESPONDING FIELDS OF TABLE @lt_but0bk.
- SELECT banka, ort01, bnklz, brnch, banks, bankl
- FROM bnka
- INTO CORRESPONDING FIELDS OF TABLE @lt_bnka.
- *7x поле - получение
- mo_tor_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_tor_c=>sc_node-item_tr
- it_key = lt_tor_item_tr_keys
- iv_association = /scmtms/if_tor_c=>sc_association-item_tr-bo_material
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_tor_bo_material
- et_target_key = DATA(lt_tor_bo_material_keys)
- et_key_link = DATA(lt_tor_bo_material_link_keys) ).
- mo_mtrl_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_mat_c=>sc_node-root
- it_key = lt_tor_bo_material_keys
- iv_association = /scmtms/if_mat_c=>sc_association-root-description
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_mtrl_description ).
- IF lt_tor_bo_material IS NOT INITIAL.
- SELECT matnr matkl
- FROM /sapapo/matkey
- INTO CORRESPONDING FIELDS OF TABLE lt_sapapo_matkey
- FOR ALL ENTRIES IN lt_tor_bo_material
- WHERE /sapapo/matkey~matnr EQ lt_tor_bo_material-internal_id.
- ENDIF.
- IF lt_sapapo_matkey IS NOT INITIAL.
- SELECT matkl wgbez
- FROM zttm_group_mat_t
- INTO CORRESPONDING FIELDS OF TABLE lt_zttm_group_mat_t
- FOR ALL ENTRIES IN lt_sapapo_matkey
- WHERE zttm_group_mat_t~matkl EQ lt_sapapo_matkey-matkl.
- ENDIF.
- *10x поле - заполнение
- IF ls_tor_bupa_ship_root-type = '1'.
- ls_form-zz10x_cargo_accept = ls_form-zz3x_shipper_individual.
- ELSEIF ls_tor_bupa_ship_root-type = '2'.
- ls_form-zz10x_cargo_accept = ls_form-zz4x_shipper_entity.
- ENDIF.
- *11x поле - получение
- mo_tor_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_tor_c=>sc_node-stop
- it_key = lt_tor_stop_first_keys
- iv_association = /scmtms/if_tor_c=>sc_association-stop-bo_loc_log
- iv_fill_data = abap_false
- IMPORTING
- et_target_key = DATA(lt_tor_bo_loc_log_keys) ).
- mo_loc_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_location_c=>sc_node-root
- it_key = lt_tor_bo_loc_log_keys
- iv_association = /scmtms/if_location_c=>sc_association-root-geographical_information
- iv_fill_data = abap_false
- IMPORTING
- et_target_key = DATA(lt_loc_geo_info_keys) ).
- mo_loc_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_location_c=>sc_node-geographical_information
- it_key = lt_loc_geo_info_keys
- iv_association = /scmtms/if_location_c=>sc_association-geographical_information-address
- iv_fill_data = abap_false
- IMPORTING
- et_target_key = DATA(lt_loc_address_keys) ).
- /scmtms/cl_common_helper=>get_do_keys_4_rba(
- EXPORTING
- iv_host_bo_key = /bofu/if_bupa_constants=>sc_bo_key
- iv_host_do_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
- iv_do_node_key = /bofu/if_addr_constants=>sc_node-postal_address
- iv_do_assoc_key = /bofu/if_addr_constants=>sc_association-root-postal_address
- IMPORTING
- ev_assoc_key = DATA(lv_assoc_key_11x) ).
- mo_bp_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
- iv_association = lv_assoc_key_11x
- iv_fill_data = abap_true
- it_key = lt_loc_address_keys
- IMPORTING
- et_data = lt_bp_postal_address ).
- READ TABLE lt_bp_postal_address INTO DATA(ls_bp_postal_address) INDEX 1.
- SELECT bezei
- FROM t005u
- INTO CORRESPONDING FIELDS OF TABLE lt_t005u_11x
- WHERE bland EQ ls_bp_postal_address-region AND land1 EQ ls_bp_postal_address-country_code AND t005u~spras = 'R'.
- READ TABLE lt_t005u_11x INTO DATA(ls_t005u_11x) INDEX 1.
- *11x поле - заполнение
- ls_form-zz11x_cargo_accept_actual_addr = |{ ls_t005u_11x-bezei } { ',' } { ls_bp_postal_address-city_name } { ',' } { ls_bp_postal_address-street_name } { ls_bp_postal_address-house_id }|.
- *12x поле - заполнение
- ls_form-zz12x_cargo_accept_fact_of_loa = ls_form-zz1x_actual_shipment_date.
- *13x поле - заполнение
- ls_form-zz13x_cargo_accept_fact_of_loa = ls_form-zz1x_actual_shipment_date.
- *14x поле - получение
- mo_tor_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_tor_c=>sc_node-root
- it_key = it_tor_key
- iv_association = /scmtms/if_tor_c=>sc_association-root-seal
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_tor_seal ).
- *18x - получение
- mo_tor_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_tor_c=>sc_node-root
- it_key = it_tor_key
- iv_association = /scmtms/if_tor_c=>sc_association-root-stop
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_tor_stop ).
- LOOP AT lt_tor_stop INTO DATA(ls_tor_stop).
- IF ls_tor_stop-wh_next_rel = 'U'.
- APPEND ls_tor_stop TO lt_tor_stop_18_keys.
- ENDIF.
- ENDLOOP.
- mo_tor_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_tor_c=>sc_node-stop
- it_key = lt_tor_stop_18_keys
- iv_association = /scmtms/if_tor_c=>sc_association-stop-bo_loc_log
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_tor_bo_loc_log_18
- et_target_key = DATA(lt_tor_bo_loc_log_18_keys) ).
- mo_loc_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_location_c=>sc_node-root
- it_key = lt_tor_bo_loc_log_18_keys
- iv_association = /scmtms/if_location_c=>sc_association-root-geographical_information
- iv_fill_data = abap_false
- IMPORTING
- et_target_key = DATA(lt_loc_geo_info_18_keys) ).
- mo_loc_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_location_c=>sc_node-geographical_information
- it_key = lt_loc_geo_info_18_keys
- iv_association = /scmtms/if_location_c=>sc_association-geographical_information-address
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_loc_address_18
- et_target_key = DATA(lt_loc_address_18_keys) ).
- mo_bp_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
- iv_association = lv_assoc_key_postal_address
- iv_fill_data = abap_true
- it_key = lt_loc_address_18_keys
- IMPORTING
- et_data = lt_bofu_addr_post_addr_18 ).
- *23x поле - получение, 23x поле - заполнение
- mo_tor_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_tor_c=>sc_node-root
- it_key = it_tor_key
- iv_association = /scmtms/if_tor_c=>sc_association-root-bo_tsp_root
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_tor_bo_tsp_root ).
- READ TABLE lt_tor_bo_tsp_root INTO DATA(ls_tor_bo_tsp_root_keys) WITH KEY type = '1'.
- mo_splr_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_supplier_c=>sc_node-root
- it_key = VALUE #( ( key = ls_tor_bo_tsp_root_keys-key ) )
- iv_association = /bofu/if_supplier_c=>sc_association-root-common
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_splr_common ).
- READ TABLE lt_splr_common INTO DATA(ls_splr_common) INDEX 1.
- mo_splr_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_supplier_c=>sc_node-root
- it_key = VALUE #( ( key = ls_tor_bo_tsp_root_keys-key ) )
- iv_association = /bofu/if_supplier_c=>sc_association-root-tax_number
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_splr_tax_number ).
- READ TABLE lt_splr_tax_number INTO DATA(ls_splr_tax_number) WITH KEY taxtype = 'RU1'.
- mo_splr_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_supplier_c=>sc_node-root
- it_key = VALUE #( ( key = ls_tor_bo_tsp_root_keys-key ) )
- iv_association = /bofu/if_supplier_c=>sc_association-root-addressinformation
- iv_fill_data = abap_false
- IMPORTING
- et_target_key = DATA(lt_splr_adressinformation_keys) ).
- mo_splr_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_supplier_c=>sc_node-addressinformation
- it_key = lt_splr_adressinformation_keys
- iv_association = /bofu/if_supplier_c=>sc_association-addressinformation-/bofu/address
- iv_fill_data = abap_false
- IMPORTING
- et_target_key = DATA(lt_splr_address_23_keys) ).
- mo_bp_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
- iv_association = lv_assoc_key_postal_address
- iv_fill_data = abap_true
- it_key = lt_splr_address_23_keys
- IMPORTING
- et_data = lt_bofu_addr_postal_addr_23 ).
- READ TABLE lt_bofu_addr_postal_addr_23 INTO DATA(ls_bofu_addr_postal_addr_23) INDEX 1.
- SELECT bezei
- FROM t005u
- INTO CORRESPONDING FIELDS OF TABLE lt_t005u_23x
- WHERE bland EQ ls_bofu_addr_postal_addr_23-region AND land1 EQ ls_bofu_addr_postal_addr_23-country_code AND t005u~spras = 'R'.
- READ TABLE lt_t005u_23x INTO DATA(ls_t005u_23x) INDEX 1.
- mo_bp_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
- iv_association = lv_assoc_key_telephone
- iv_fill_data = abap_true
- it_key = lt_splr_address_23_keys
- IMPORTING
- et_data = lt_bofu_addr_telephone_23 ).
- READ TABLE lt_bofu_addr_telephone_23 INTO ls_bofu_addr_telephone_23_1 INDEX 1.
- READ TABLE lt_bofu_addr_telephone_23 INTO ls_bofu_addr_telephone_23_2 INDEX 2.
- READ TABLE lt_but0bk INTO DATA(ls_but0bk_23) WITH KEY partner = ls_tor_root-tspid.
- READ TABLE lt_bnka INTO DATA(ls_bnka_23) WITH KEY banks = ls_but0bk_23-banks bankl = ls_but0bk_23-bankl.
- ls_form-zz23x_carriers_legal_data = |{ ls_splr_common-firstname } { ls_splr_common-lastname } { '; ИНН:' } { ls_splr_tax_number-taxnumber } { ';' } { ls_bofu_addr_postal_addr_23-street_postal_code } { ',' } {
- ls_bofu_addr_postal_addr_23-district_name } { ',' } { ls_t005u_23x-bezei } { ',' } { ls_bofu_addr_postal_addr_23-city_name } { ',' } { ls_bofu_addr_postal_addr_23-street_name } { ls_bofu_addr_postal_addr_23-house_id } { ';' } {
- ls_bofu_addr_telephone_23_1-normalised_number_text } { ',' } { ls_bofu_addr_telephone_23_2-normalised_number_text } { '; "р\с:"' } { ls_but0bk_23-bankn } { 'в банке' } { ls_bnka_23-banka } { 'в городе' } { ls_bnka_23-ort01 } { ', "БИК" ' } {
- ls_bnka_23-bnklz } { ', К\С' } { ls_bnka_23-brnch }|.
- *25x поле - получение, 25x поле - заполнение
- mo_tor_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_tor_c=>sc_node-item_tr
- it_key = lt_tor_item_tr_keys
- iv_association = /scmtms/if_tor_c=>sc_association-item_tr-bo_resource
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_tor_bo_resource ).
- READ TABLE lt_tor_bo_resource INTO DATA(ls_tor_bo_resource) INDEX 1.
- ls_form-zz25x_vehicle_brand = ls_tor_bo_resource-description.
- *26x поле - получение
- READ TABLE lt_tor_item_tr INTO DATA(ls_tor_item_tr) WITH KEY item_cat = 'AVR'.
- SPLIT ls_tor_item_tr-tracking_no AT '/' INTO lv_zz26x_reg_nomer_ts lv_zz26x_reg_nomer_pricep.
- IF lv_zz26x_reg_nomer_pricep IS INITIAL.
- ls_form-zz26x_vehicle_reg_number = |{ 'Регистрационный номер: ' } { lv_zz26x_reg_nomer_ts }|.
- ELSE.
- ls_form-zz26x_vehicle_reg_number = |{ 'Регистрационный номер: ' } { lv_zz26x_reg_nomer_ts } { ', прицеп: ' } { lv_zz26x_reg_nomer_pricep }|.
- ENDIF.
- *28x поле - получение, 28x поле - заполнение
- ls_form-zz28x_service_cost_legal_data = ls_form-zz23x_carriers_legal_data.
- **********************************************************************
- *17x поле - получение, 17x поле - заполнение, 24x поле - получение, 24x поле - заполнение
- " 17x
- " 6. Прием груза - ФИО водителя
- " /SCMTMS/TOR -> ITEM_TR (где ITEM_CAT = DRI) - BO_DRIVER:
- " NAME_FIRST, NAME_LAST
- " ITEM_TR -> BO_DRIVER
- mo_tor_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_tor_c=>sc_node-item_tr
- it_key = lt_tor_item_tr_keys
- iv_association = /scmtms/if_tor_c=>sc_association-item_tr-bo_driver
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_17_itemtr_bodriver
- et_target_key = DATA(lt_17_itemtr_bodriver_keys)
- et_key_link = DATA(lt_17_item_driver_link_keys)
- ).
- " ITEM_TR (где ITEM_CAT = DRI)
- LOOP AT lt_17_itemtr_bodriver INTO DATA(ls_17_itemtr_bodriver).
- LOOP AT lt_17_item_driver_link_keys INTO DATA(ls_17_item_driver_link_keys)
- WHERE target_key = ls_17_itemtr_bodriver-key.
- LOOP AT lt_tor_item_tr INTO ls_tor_item_tr
- WHERE key = ls_17_item_driver_link_keys-source_key
- AND item_cat = 'DRI'.
- APPEND ls_17_itemtr_bodriver TO lt_17_itemtr_bodriver_res.
- ENDLOOP.
- ENDLOOP.
- ENDLOOP.
- IF lt_17_itemtr_bodriver_res[ 1 ] IS NOT INITIAL.
- ls_17_itemtr_bodriver = lt_17_itemtr_bodriver_res[ 1 ].
- zzvehicle_param = | { ls_17_itemtr_bodriver-name_first } { ' ' } { ls_17_itemtr_bodriver-name_last } |.
- ls_form-zz17x_cargo_accept_drivers_ini = zzvehicle_param.
- ENDIF.
- " 24x
- " 10. Перевозчик
- " ИНН
- " «ИНН» /BOFU/BUSINESSPARTNER (где PARTNER = BO_DRIVER - LABOURRES_ID) -
- " - TAX_NUMBER(где TAXTYPE = RU1):
- " TAXNUMBER
- " /bofu/businesspartner
- " mo_bp_srv = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( /bofu/if_bupa_constants=>sc_bo_key ).
- LOOP AT lt_17_itemtr_bodriver_res INTO ls_17_itemtr_bodriver.
- ls_selpar-low = ls_17_itemtr_bodriver-labourres_id.
- ls_selpar-attribute_name = /bofu/if_bupa_constants=>sc_query_attribute-root-query_by_role-partner.
- ls_selpar-option = 'EQ'.
- ls_selpar-sign = 'I'.
- APPEND ls_selpar TO lt_selpar.
- ENDLOOP.
- mo_bp_srv->query(
- EXPORTING
- iv_query_key = /bofu/if_bupa_constants=>sc_query-root-query_by_role
- it_selection_parameters = lt_selpar
- IMPORTING
- et_key = DATA(lt_fag_party_keys)
- ).
- mo_bupa_srv->retrieve_by_association(
- EXPORTING
- it_key = lt_fag_party_keys
- iv_node_key = /bofu/if_bupa_constants=>sc_node-root
- iv_association = /bofu/if_bupa_constants=>sc_association-root-tax_number
- iv_fill_data = abap_true
- IMPORTING
- et_data = lt_bp_taxnum
- ).
- LOOP AT lt_bp_taxnum INTO DATA(ls_bp_taxnum)
- WHERE taxtype = 'RU1'.
- APPEND ls_bp_taxnum TO lt_bp_taxnum_res.
- ENDLOOP.
- IF lt_bp_taxnum_res[ 1 ] IS NOT INITIAL.
- ls_form-zzvehicle_param = lt_bp_taxnum_res[ 1 ]-taxnumber.
- ENDIF.
- " 24x
- " 10. Перевозчик - данные о средствах связи (при их наличии) водителя (водителей)
- " /SCMTMS/TOR -> ITEM_TR (где ITEM_CAT = DRI) - BO_DRIVER -
- " – ADDRESS – TELEPHONE:
- " NORMALISED_NUMBER_TEXT
- " BO_DRIVER –> ADDRESS
- " mo_drv_srm = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( /scmtms/if_driver_c=>sc_bo_key ).
- mo_drv_srm->retrieve_by_association(
- EXPORTING
- iv_node_key = /scmtms/if_driver_c=>sc_node-root
- it_key = lt_17_itemtr_bodriver_keys
- iv_association = /scmtms/if_driver_c=>sc_association-root-address
- iv_fill_data = abap_false
- IMPORTING
- et_target_key = DATA(lt_bodriver_addr_keys)
- ).
- " ADDRESS -> TELEPHONE
- mo_bp_srv->retrieve_by_association(
- EXPORTING
- iv_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
- iv_association = lv_assoc_key_telephone
- iv_fill_data = abap_true
- it_key = lt_bodriver_addr_keys
- IMPORTING
- et_data = lt_drv_addr_tel
- ).
- LOOP AT lt_drv_addr_tel INTO DATA(ls_drv_addr_tel).
- ls_form-zz24x_inn_phone_numbers = | { ls_form-zz17x_cargo_accept_drivers_ini } { ',' } { ls_form-zzvehicle_param } { ',' } { ls_drv_addr_tel-normalised_number_text } { ' ' }|.
- ENDLOOP.
- * mo_tor_srv->retrieve_by_association(
- * EXPORTING
- * iv_node_key = /scmtms/if_tor_c=>sc_node-item_tr
- * it_key = lt_tor_item_tr_keys
- * iv_association = /scmtms/if_tor_c=>sc_association-item_tr-bo_resource
- * iv_fill_data = abap_true
- * IMPORTING
- * et_data = lt_tor_bo_resource ).
- *
- * APPEND LINES OF lt_tor_item_tr TO lt_tor_item_tr_unique_dri.
- *
- * DELETE lt_tor_item_tr_unique_dri WHERE item_cat NE 'DRI'.
- *
- * LOOP AT lt_tor_item_tr_unique_dri INTO DATA(ls_tor_item_tr_unique_dri).
- *
- * READ TABLE lt_tor_bo_driver INTO DATA(ls_tor_bo_driver) WITH KEY parent_key = ls_tor_item_tr_unique_dri.
- *22x поле - заполнение
- ls_form-zz22x_cargo_deliv_drivers_init = ls_form-zz17x_cargo_accept_drivers_ini.
- **********************************************************************
- APPEND LINES OF lt_tor_item_tr TO lt_tor_item_tr_unique.
- DELETE lt_tor_item_tr_unique WHERE consignee_id IS INITIAL.
- SORT lt_tor_item_tr_unique BY consignee_id key.
- DELETE ADJACENT DUPLICATES FROM lt_tor_item_tr_unique COMPARING consignee_id.
- LOOP AT lt_tor_item_tr_unique INTO DATA(ls_tor_item_tr_unique).
- *5x поле - заполнение, 6x поле - заполнение
- READ TABLE lt_tor_bo_bupa_consignee INTO DATA(ls_tor_bo_bupa_consignee) WITH KEY partner = ls_tor_item_tr_unique-consignee_id.
- IF ls_tor_bo_bupa_consignee IS NOT INITIAL.
- READ TABLE lt_bofu_addr_postal_addr_5 INTO DATA(ls_bofu_addr_postal_addr_5) WITH KEY root_key = ls_tor_bo_bupa_consignee-key.
- IF ls_bofu_addr_postal_addr_5 IS NOT INITIAL.
- READ TABLE lt_t005u INTO DATA(ls_t005u_5) WITH KEY land1 = ls_bofu_addr_postal_addr_5-country_code bland = ls_bofu_addr_postal_addr_5-region.
- IF ls_t005u_5 IS NOT INITIAL.
- READ TABLE lt_but0bk INTO DATA(ls_but0bk_5) WITH KEY partner = ls_tor_item_tr_unique-consignee_id.
- IF ls_but0bk_5 IS NOT INITIAL.
- READ TABLE lt_bnka INTO DATA(ls_bnka_5) WITH KEY banks = ls_but0bk_5-banks bankl = ls_but0bk_5-bankl.
- IF ls_bnka_5 IS NOT INITIAL.
- READ TABLE lt_bp_common_5 INTO DATA(ls_bupa_common_5) WITH KEY parent_key = ls_tor_bo_bupa_consignee-key.
- IF ls_bupa_common_5 IS NOT INITIAL.
- READ TABLE lt_bp_tax_number_5 INTO DATA(ls_bupa_tax_number_5) WITH KEY parent_key = ls_tor_bo_bupa_consignee-key taxtype = 'RU1'.
- ENDIF.
- ENDIF.
- ENDIF.
- ENDIF.
- ENDIF.
- ENDIF.
- IF lt_bofu_address_telephone_5 IS NOT INITIAL.
- LOOP AT lt_bofu_address_telephone_5 INTO DATA(ls_bofu_address_telephone).
- IF ls_bofu_address_telephone-root_key = ls_tor_bo_bupa_consignee-key.
- APPEND ls_bofu_address_telephone TO lt_bofu_addr_tel_sorted.
- ENDIF.
- ENDLOOP.
- ENDIF.
- READ TABLE lt_bofu_addr_tel_sorted INTO ls_bofu_address_telephone_5_1 INDEX 1.
- IF ls_bofu_address_telephone_5_1 IS NOT INITIAL.
- READ TABLE lt_bofu_addr_tel_sorted INTO ls_bofu_address_telephone_5_2 INDEX 2.
- ENDIF.
- *5x поле - заполнение
- IF ls_tor_bo_bupa_consignee-type = '1'.
- zzfn_shipper1 = |{ ls_bupa_common_5-firstname } { ls_bupa_common_5-lastname } { '; ИНН:' } { ls_bupa_tax_number_5-taxnumber } { '; адрес:' } { ls_t005u_5-bezei } { ',' } { ls_bofu_addr_postal_addr_5-district_name } { ',' } {
- ls_bofu_addr_postal_addr_5-city_name } { ',' } { ls_bofu_addr_postal_addr_5-street_name } { ls_bofu_addr_postal_addr_5-house_id } { ';' }|.
- zzfn_shipper2 = |{ ls_bofu_address_telephone_5_1-normalised_number_text } { ',' } { ls_bofu_address_telephone_5_2-normalised_number_text } { '; Р\С:' } { ls_but0bk_5-bankn } { 'в банке' } { ls_bnka_5-banka } { 'в городе' } {
- ls_bnka_5-ort01 } { ', "БИК"' } { ls_bnka_5-bnklz } { ', К\С' } { ls_bnka_5-brnch }|.
- CONCATENATE zzfn_shipper1 zzfn_shipper2
- INTO ls_form-zz5x_consignee_individual SEPARATED BY space.
- *6x поле - заполнение
- ELSEIF ls_tor_bo_bupa_consignee-type = '2'.
- zzname_consignee1 = |{ ls_bupa_common_5-firstname } { ls_bupa_common_5-lastname } { '; ИНН:' } { ls_bupa_tax_number_5-taxnumber } { '; адрес:' } { ls_t005u_5-bezei } { ',' } { ls_bofu_addr_postal_addr_5-district_name } { ',' } {
- ls_bofu_addr_postal_addr_5-city_name } { ',' } { ls_bofu_addr_postal_addr_5-street_name } { ls_bofu_addr_postal_addr_5-house_id } { ';' }|.
- zzname_consignee2 = |{ ls_bofu_address_telephone_5_1-normalised_number_text } { ',' } { ls_bofu_address_telephone_5_2-normalised_number_text } { '; Р\С:' } { ls_but0bk_5-bankn } { 'в банке' } { ls_bnka_5-banka } { 'в городе' } {
- ls_bnka_5-ort01 } { ', "БИК"' } { ls_bnka_5-bnklz } { ', К\С' } { ls_bnka_5-brnch }|.
- CONCATENATE zzname_consignee1 zzname_consignee2
- INTO ls_form-zz6x_consignee_entity SEPARATED BY space.
- ENDIF.
- *7x поле - заполнение
- CLEAR ls_tor_item_tr.
- LOOP AT lt_tor_item_tr INTO ls_tor_item_tr.
- IF ls_tor_item_tr-consignee_id = ls_tor_item_tr_unique-consignee_id
- AND ls_tor_item_tr-item_cat = 'PRD'.
- APPEND ls_tor_item_tr TO lt_toritemtrunique_itemcatprd.
- ENDIF.
- ENDLOOP.
- DELETE ADJACENT DUPLICATES FROM lt_toritemtrunique_itemcatprd COMPARING ALL FIELDS.
- LOOP AT lt_toritemtrunique_itemcatprd INTO DATA(ls_toritemtrunique_itemcatprd).
- LOOP AT lt_tor_item_tr_link_keys INTO DATA(ls_tor_item_tr_link_keys).
- IF ls_tor_item_tr_link_keys-target_key = ls_toritemtrunique_itemcatprd-key.
- APPEND ls_tor_item_tr_link_keys TO lt_toritemtr_linkkeysunique.
- ENDIF.
- ENDLOOP.
- ENDLOOP.
- DELETE ADJACENT DUPLICATES FROM lt_toritemtr_linkkeysunique.
- LOOP AT lt_toritemtr_linkkeysunique INTO DATA(ls_toritemtr_linkkeysunique).
- LOOP AT lt_tor_bo_material_link_keys INTO DATA(ls_tor_bo_material_link_keys).
- IF ls_tor_bo_material_link_keys-source_key = ls_toritemtr_linkkeysunique-target_key.
- APPEND ls_tor_bo_material_link_keys TO lt_torbomat_linkkeysunique.
- ENDIF.
- ENDLOOP.
- ENDLOOP.
- DELETE ADJACENT DUPLICATES FROM lt_torbomat_linkkeysunique.
- CLEAR ls_toritemtr_linkkeysunique.
- LOOP AT lt_torbomat_linkkeysunique INTO ls_toritemtr_linkkeysunique.
- LOOP AT lt_tor_bo_material INTO DATA(ls_tor_bo_material).
- IF ls_tor_bo_material-key = ls_toritemtr_linkkeysunique-target_key.
- APPEND ls_tor_bo_material TO lt_tor_bo_material_unique.
- ENDIF.
- ENDLOOP.
- ENDLOOP.
- DELETE ADJACENT DUPLICATES FROM lt_tor_bo_material_unique.
- LOOP AT lt_tor_bo_material_unique INTO DATA(ls_tor_bo_material_unique).
- LOOP AT lt_sapapo_matkey INTO DATA(ls_sapapo_matkey).
- IF ls_sapapo_matkey-matnr = ls_tor_bo_material_unique-internal_id.
- APPEND ls_sapapo_matkey TO lt_sapapo_matkey_unique.
- ENDIF.
- ENDLOOP.
- ENDLOOP.
- DELETE ADJACENT DUPLICATES FROM lt_sapapo_matkey_unique.
- LOOP AT lt_sapapo_matkey_unique INTO DATA(ls_sapapo_matkey_unique).
- LOOP AT lt_zttm_group_mat_t INTO DATA(ls_zttm_group_mat_t).
- IF ls_zttm_group_mat_t-matkl = ls_sapapo_matkey_unique-matkl.
- APPEND ls_zttm_group_mat_t-wgbez TO lt_zz7x_naimenovanie_gruza.
- ENDIF.
- ENDLOOP.
- ENDLOOP.
- SORT lt_zz7x_naimenovanie_gruza.
- DELETE ADJACENT DUPLICATES FROM lt_zz7x_naimenovanie_gruza.
- LOOP AT lt_zz7x_naimenovanie_gruza INTO DATA(ls_zz7x_naimenovanie_gruza).
- IF ls_zz7x_naimenovanie_gruza IS NOT INITIAL.
- ls_form-zz7x_shipping_name = |{ ls_zz7x_naimenovanie_gruza } { ',' } { ls_form-zz7x_shipping_name }|.
- ENDIF.
- ENDLOOP.
- IF ls_form-zz7x_shipping_name IS NOT INITIAL.
- lv_string_length = strlen( ls_form-zz7x_shipping_name ) - 1.
- ls_form-zz7x_shipping_name = ls_form-zz7x_shipping_name+0(lv_string_length).
- ENDIF.
- *8x поле - заполнение
- READ TABLE lt_tor_seal INTO DATA(ls_tor_seal) WITH KEY party_id = ls_tor_item_tr_unique-consignee_id.
- IF ls_tor_seal IS NOT INITIAL.
- lv_qua_pcs_val_all = ls_tor_seal-qua_pcs_val_all.
- ENDIF.
- ls_form-zz8x_cargo_number_of_packages = |{ lv_qua_pcs_val_all } { ls_tor_seal-qua_pcs_uni }|.
- *9x поле - заполнение
- CLEAR ls_toritemtrunique_itemcatprd.
- LOOP AT lt_toritemtrunique_itemcatprd INTO ls_toritemtrunique_itemcatprd.
- IF ls_toritemtrunique_itemcatprd-main_cargo_item NE 'X'.
- lv_zz9x_gruz_massa_brutto = ls_toritemtrunique_itemcatprd-gro_wei_val + lv_zz9x_gruz_massa_brutto.
- ENDIF.
- ENDLOOP.
- ls_form-zz9x_cargo_gross_weight = |{ lv_zz9x_gruz_massa_brutto } { ls_toritemtrunique_itemcatprd-gro_wei_uni }|.
- *14x поле - заполнение
- CLEAR ls_tor_item_tr.
- LOOP AT lt_tor_item_tr INTO ls_tor_item_tr.
- IF ls_tor_item_tr-consignee_id = ls_tor_item_tr_unique-consignee_id AND ls_tor_item_tr-item_cat = 'TUR'.
- APPEND ls_tor_item_tr TO lt_toritemtrunique_itemcattur.
- ENDIF.
- ENDLOOP.
- CLEAR ls_tor_seal.
- LOOP AT lt_tor_seal INTO ls_tor_seal.
- IF ls_tor_seal-party_id = ls_tor_item_tr_unique-consignee_id AND ls_tor_seal-seal_number IS NOT INITIAL.
- lv_zz14x_priem_gruza_plomba = |{ 'Пломба №' } { ls_tor_seal-seal_number }|.
- ENDIF.
- ENDLOOP.
- LOOP AT lt_toritemtrunique_itemcattur INTO DATA(ls_toritemtrunique_itemcattur).
- IF ls_toritemtrunique_itemcattur-res_id IS NOT INITIAL.
- lv_zz14x_priem_gruza_konteiner = |{ lv_zz14x_priem_gruza_konteiner } { 'контейнер №' } { ls_toritemtrunique_itemcattur-res_id } { ',' }|.
- ENDIF.
- ENDLOOP.
- IF lv_zz14x_priem_gruza_konteiner IS NOT INITIAL.
- lv_zz14x_priem_gruza_konteiner = |{ '\' } { lv_zz14x_priem_gruza_konteiner }|.
- lv_string_length = strlen( lv_zz14x_priem_gruza_konteiner ) - 1.
- lv_zz14x_priem_gruza_konteiner = lv_zz14x_priem_gruza_konteiner+0(lv_string_length).
- ENDIF.
- ls_form-zz14x_cargo_accept_seal_contai = |{ lv_zz14x_priem_gruza_plomba } { ' ' } { lv_zz14x_priem_gruza_konteiner }|.
- *15x поле - заполнение
- ls_form-zz15x_cargo_accept_gross_weigh = ls_form-zz9x_cargo_gross_weight.
- *16x поле - заполнение
- ls_form-zz16x_cargo_accept_packages_nu = ls_form-zz8x_cargo_number_of_packages.
- *18x поле - заполнение
- LOOP AT lt_tor_bo_loc_log_18 INTO DATA(ls_tor_bo_loc_log_18).
- IF ls_tor_bo_loc_log_18-business_partner_id = ls_tor_item_tr_unique-consignee_id.
- LOOP AT lt_tor_bo_loc_log_18_keys INTO DATA(ls_tor_bo_loc_log_18_keys).
- IF ls_tor_bo_loc_log_18_keys-key = ls_tor_bo_loc_log_18-key.
- APPEND ls_tor_bo_loc_log_18_keys TO lt_tor_boloclog18keys_unique.
- ENDIF.
- ENDLOOP.
- ENDIF.
- ENDLOOP.
- LOOP AT lt_loc_address_18 INTO DATA(ls_loc_address_18).
- LOOP AT lt_tor_boloclog18keys_unique INTO DATA(ls_tor_boloclog18keys_unique).
- IF ls_loc_address_18-parent_key = ls_tor_boloclog18keys_unique-key.
- APPEND ls_loc_address_18 TO lt_loc_address_18_unique.
- ENDIF.
- ENDLOOP.
- ENDLOOP.
- LOOP AT lt_bofu_addr_post_addr_18 INTO DATA(ls_bofu_addr_post_addr_18).
- LOOP AT lt_loc_address_18_unique INTO DATA(ls_loc_address_18_unique).
- IF ls_bofu_addr_post_addr_18-root_key = ls_loc_address_18_unique-root_key.
- SELECT bezei
- FROM t005u
- INTO CORRESPONDING FIELDS OF TABLE lt_t005u
- WHERE bland EQ ls_bofu_addr_post_addr_18-region AND land1 EQ ls_bofu_addr_post_addr_18-country_code AND t005u~spras = 'R'.
- READ TABLE lt_t005u INTO ls_t005u INDEX 1.
- ls_form-zz18x_cargo_deliv_actual_addr = |{ ls_t005u-bezei } { ',' } { ls_bofu_addr_post_addr_18-city_name } { ',' } { ls_bofu_addr_post_addr_18-street_name } { ls_bofu_addr_post_addr_18-house_id }|.
- ENDIF.
- ENDLOOP.
- ENDLOOP.
- *19x поле - заполнение
- ls_form-zz19x_cargo_deliv_seal_contain = ls_form-zz14x_cargo_accept_seal_contai.
- *20x поле - заполнение
- ls_form-zz20x_cargo_deliv_gross_weight = ls_form-zz9x_cargo_gross_weight.
- *21x поле - заполнение
- ls_form-zz21x_cargo_deliv_packages_num = ls_form-zz8x_cargo_number_of_packages.
- APPEND ls_form TO et_body.
- CLEAR:
- lt_bofu_addr_tel_sorted,
- lt_toritemtrunique_itemcatprd,
- lt_toritemtr_linkkeysunique,
- lt_torbomat_linkkeysunique,
- lt_tor_bo_material_unique,
- lt_sapapo_matkey_unique,
- lt_toritemtrunique_itemcattur,
- lt_tor_boloclog18keys_unique,
- lt_loc_address_18_unique,
- lt_zz7x_naimenovanie_gruza,
- ls_bofu_address_telephone_5_1,
- ls_bofu_address_telephone_5_2,
- lv_zz9x_gruz_massa_brutto,
- lv_zz14x_priem_gruza_plomba,
- lv_zz14x_priem_gruza_konteiner,
- zzfn_shipper1,
- zzfn_shipper2,
- zzname_consignee1,
- zzname_consignee2,
- ls_tor_bo_bupa_consignee,
- ls_bofu_addr_postal_addr_5,
- ls_t005u_5,
- ls_but0bk_5,
- ls_bnka_5,
- ls_bupa_common_5,
- ls_bupa_tax_number_5,
- ls_bofu_address_telephone,
- ls_bofu_address_telephone_5_1,
- ls_bofu_address_telephone_5_2,
- ls_tor_item_tr,
- ls_toritemtrunique_itemcatprd,
- ls_tor_item_tr_link_keys,
- ls_toritemtr_linkkeysunique,
- ls_tor_bo_material_link_keys,
- ls_tor_bo_material,
- ls_tor_bo_material_unique,
- ls_sapapo_matkey,
- ls_sapapo_matkey_unique,
- ls_zttm_group_mat_t,
- ls_zz7x_naimenovanie_gruza,
- ls_tor_seal,
- ls_toritemtrunique_itemcattur,
- ls_tor_bo_loc_log_18,
- ls_tor_bo_loc_log_18_keys,
- ls_loc_address_18,
- ls_tor_boloclog18keys_unique,
- ls_bofu_addr_post_addr_18,
- ls_loc_address_18_unique,
- ls_t005u,
- ls_form-zz5x_consignee_individual,
- ls_form-zz6x_consignee_entity,
- ls_form-zz7x_shipping_name,
- ls_form-zz8x_cargo_number_of_packages,
- ls_form-zz9x_cargo_gross_weight,
- ls_form-zz14x_cargo_accept_seal_contai,
- ls_form-zz15x_cargo_accept_gross_weigh,
- ls_form-zz16x_cargo_accept_packages_nu,
- ls_form-zz18x_cargo_deliv_actual_addr,
- ls_form-zz19x_cargo_deliv_seal_contain,
- ls_form-zz20x_cargo_deliv_gross_weight,
- ls_form-zz21x_cargo_deliv_packages_num.
- ENDLOOP.
- ENDMETHOD.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement