Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *&---------------------------------------------------------------------*
- *& Номер спецификации: BR_D_024
- *& Наименование спецификации: Печатные формы
- *& Дата создания: 22.12.2020
- *& Проект: Создание печатных форм
- *& Разработчик: Федоров К
- 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,
- 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.
- *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 ASSIGNING FIELD-SYMBOL(<ls_tor_stop_first>) INDEX 1.
- IF <ls_tor_stop_first> IS ASSIGNED.
- CONVERT TIME STAMP <ls_tor_stop_first>-appointment_start 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_fact_date = lv_date_result.
- ENDIF.
- *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 ASSIGNING FIELD-SYMBOL(<ls_tor_root>) INDEX 1.
- IF <ls_tor_root> IS ASSIGNED.
- ls_form-zz2x_nomer_tn = <ls_tor_root>-tor_id.
- SHIFT ls_form-zz2x_nomer_tn LEFT DELETING LEADING '0'.
- ENDIF.
- *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 ASSIGNING FIELD-SYMBOL(<ls_bofu_addr_postal_addr_4>) INDEX 1.
- IF <ls_bofu_addr_postal_addr_4> IS ASSIGNED.
- 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'.
- ENDIF.
- READ TABLE lt_t005u ASSIGNING FIELD-SYMBOL(<ls_t005u>) INDEX 1.
- READ TABLE lt_tor_bupa_ship_root ASSIGNING FIELD-SYMBOL(<ls_tor_bupa_ship_root>) INDEX 1.
- READ TABLE lt_bupa_common ASSIGNING FIELD-SYMBOL(<ls_bupa_common>) INDEX 1.
- READ TABLE lt_bupa_tax_number ASSIGNING FIELD-SYMBOL(<ls_bupa_tax_number>) WITH KEY taxtype = 'RU1'.
- IF <ls_tor_bupa_ship_root> IS ASSIGNED.
- SELECT bankn, banks, bankl
- FROM but0bk
- INTO CORRESPONDING FIELDS OF TABLE @lt_but0bk
- WHERE partner EQ @<ls_tor_bupa_ship_root>-partner.
- ENDIF.
- READ TABLE lt_but0bk ASSIGNING FIELD-SYMBOL(<ls_but0bk>) INDEX 1.
- IF <ls_but0bk> IS ASSIGNED.
- 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.
- ENDIF.
- READ TABLE lt_bnka ASSIGNING FIELD-SYMBOL(<ls_bnka>) INDEX 1.
- *3x поле
- IF <ls_tor_bupa_ship_root> IS ASSIGNED AND <ls_tor_bupa_ship_root>-type = '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> IS ASSIGNED
- AND <ls_bupa_tax_number> IS ASSIGNED
- AND <ls_t005u> IS ASSIGNED
- AND <ls_bofu_addr_postal_addr_4> IS ASSIGNED.
- zzfn_shipper1 = |{ <ls_bupa_common>-firstname } { <ls_bupa_common>-lastname } { '; ИНН:' } { <ls_bupa_tax_number>-taxnumber } { '; адрес:' } { <ls_t005u>-bezei } { ',' } { <ls_bofu_addr_postal_addr_4>-district_name } { ',' } {
- <ls_bofu_addr_postal_addr_4>-city_name } { ',' } { <ls_bofu_addr_postal_addr_4>-street_name } { <ls_bofu_addr_postal_addr_4>-house_id } { ';' }|.
- zzfn_shipper2 = |{ ls_bofu_address_telephone_4_1-normalised_number_text } { ',' } { ls_bofu_address_telephone_4_2-normalised_number_text } { '; Р\С:' } { <ls_but0bk>-bankn } { 'в банке' } { <ls_bnka>-banka } { 'в городе' } { <ls_bnka>-ort01 } {
- ', "БИК"' } { <ls_bnka>-bnklz } { ', К\С' } { <ls_bnka>-brnch }|.
- CONCATENATE zzfn_shipper1 zzfn_shipper2
- INTO ls_form-zz3x_gruzootpravitel_fiz SEPARATED BY space.
- ENDIF.
- *4x поле
- ELSEIF <ls_tor_bupa_ship_root> IS ASSIGNED AND <ls_tor_bupa_ship_root>-type = '2'.
- READ TABLE lt_bofu_address_telephone INTO ls_bofu_address_telephone_6_1 INDEX 1.
- READ TABLE lt_bofu_address_telephone INTO ls_bofu_address_telephone_6_2 INDEX 2.
- IF <ls_bupa_common> IS ASSIGNED
- AND <ls_bupa_tax_number> IS ASSIGNED
- AND <ls_t005u> IS ASSIGNED
- AND <ls_bofu_addr_postal_addr_4> IS ASSIGNED
- AND <ls_but0bk> IS ASSIGNED
- AND <ls_bnka> IS ASSIGNED.
- zzname_shipper1 = |{ <ls_bupa_common>-firstname } { <ls_bupa_common>-lastname } { '; ИНН:' } { <ls_bupa_tax_number>-taxnumber } { '; адрес:' } { <ls_t005u>-bezei } { ',' } { <ls_bofu_addr_postal_addr_4>-district_name } { ',' } {
- <ls_bofu_addr_postal_addr_4>-city_name } { ',' } { <ls_bofu_addr_postal_addr_4>-street_name } { <ls_bofu_addr_postal_addr_4>-house_id } { ';' }|.
- zzname_shipper2 = |{ ls_bofu_address_telephone_6_1-normalised_number_text } { ',' } { ls_bofu_address_telephone_6_2-normalised_number_text } { '; Р\С:' } { <ls_but0bk>-bankn } { 'в банке' } { <ls_bnka>-banka } { 'в городе' } { <ls_bnka>-ort01 } {
- ', "БИК"' } { <ls_bnka>-bnklz } { ', К\С' } { <ls_bnka>-brnch }|.
- CONCATENATE zzname_shipper1 zzname_shipper2
- INTO ls_form-zz4x_gruzootpravitel_yur SEPARATED BY space.
- ENDIF.
- 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 ).
- 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.
- 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.
- *10x поле - заполнение
- IF <ls_tor_bupa_ship_root> IS ASSIGNED AND <ls_tor_bupa_ship_root>-type = '1'.
- ls_form-zz10x_priem_gruza = ls_form-zz3x_gruzootpravitel_fiz.
- ELSEIF <ls_tor_bupa_ship_root> IS ASSIGNED AND <ls_tor_bupa_ship_root>-type = '2'.
- ls_form-zz10x_priem_gruza = ls_form-zz4x_gruzootpravitel_yur.
- 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 ASSIGNING FIELD-SYMBOL(<ls_bp_postal_address>) INDEX 1.
- IF <ls_bp_postal_address> IS ASSIGNED.
- 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'.
- ENDIF.
- READ TABLE lt_t005u_11x ASSIGNING FIELD-SYMBOL(<ls_t005u_11x>) INDEX 1.
- *11x поле - заполнение
- ls_form-zz11x_priem_gruza_fakt_adres = |{ <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_priem_gruza_fakt_pogruzk = ls_form-zz1x_fact_date.
- *13x поле - заполнение
- ls_form-zz13x_priem_gruza_fakt_pogruzk = ls_form-zz1x_fact_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 ASSIGNING FIELD-SYMBOL(<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 ASSIGNING FIELD-SYMBOL(<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 ASSIGNING FIELD-SYMBOL(<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 ASSIGNING FIELD-SYMBOL(<ls_bofu_addr_postal_addr_23>) INDEX 1.
- IF <ls_bofu_addr_postal_addr_23> IS ASSIGNED.
- IF <ls_bofu_addr_postal_addr_23> IS ASSIGNED.
- 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'.
- ENDIF.
- ENDIF.
- READ TABLE lt_t005u_23x ASSIGNING FIELD-SYMBOL(<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 ASSIGNING FIELD-SYMBOL(<ls_but0bk_23>) WITH KEY partner = <ls_tor_root>-tspid.
- IF <ls_but0bk_23> IS ASSIGNED.
- READ TABLE lt_bnka ASSIGNING FIELD-SYMBOL(<ls_bnka_23>) WITH KEY banks = <ls_but0bk_23>-banks bankl = <ls_but0bk_23>-bankl.
- ENDIF.
- IF <ls_splr_common> IS ASSIGNED
- AND <ls_splr_tax_number> IS ASSIGNED
- AND <ls_bofu_addr_postal_addr_23> IS ASSIGNED
- AND <ls_t005u_23x> IS ASSIGNED
- AND <ls_bofu_addr_postal_addr_23> IS ASSIGNED
- AND <ls_but0bk_23> IS ASSIGNED
- AND <ls_bnka_23> IS ASSIGNED.
- ls_form-zz23x_yur_dannie_perevozchika = |{ <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 }|.
- ENDIF.
- *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 ASSIGNING FIELD-SYMBOL(<ls_tor_bo_resource>) INDEX 1.
- ls_form-zz25x_marka_ts = <ls_tor_bo_resource>-description.
- *26x поле - получение
- READ TABLE lt_tor_item_tr ASSIGNING FIELD-SYMBOL(<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_reg_nomer_ts = |{ 'Регистрационный номер: ' } { lv_zz26x_reg_nomer_ts }|.
- ELSE.
- ls_form-zz26x_reg_nomer_ts = |{ 'Регистрационный номер: ' } { lv_zz26x_reg_nomer_ts } { ', прицеп: ' } { lv_zz26x_reg_nomer_pricep }|.
- ENDIF.
- *28x поле - получение, 28x поле - заполнение
- ls_form-zz28x_stoimost_uslug_yur_danni = ls_form-zz23x_yur_dannie_perevozchika.
- **********************************************************************
- *17x поле - получение, 17x поле - заполнение, 24x поле - получение, 24x поле - заполнение
- " 17x
- " 6. Прием груза - ФИО водителя
- " /SCMTMS/TOR -> ITEM_TR (где ITEM_CAT = DRI) - BO_DRIVER:
- " NAME_FIRST, NAME_LAST
- " ITEM_TR -> BO_DRIVER
- DATA lt_17_itemtr_bodriver TYPE /scmtms/t_res_lab_root_k.
- 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)
- DATA lt_17_itemtr_bodriver_res TYPE /scmtms/t_res_lab_root_k.
- 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 DATA(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_priem_gruza_fio_voditely = 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
- ).
- DATA lt_bp_taxnum_res LIKE 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
- DATA lt_drv_addr_tel TYPE /bofu/t_addr_telephonek.
- 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_nomera = | { ls_form-zz17x_priem_gruza_fio_voditely } { ',' } { 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 ASSIGNING FIELD-SYMBOL(<ls_tor_bo_driver>) WITH KEY parent_key = ls_tor_item_tr_unique_dri.
- **********************************************************************
- 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 ASSIGNING FIELD-SYMBOL(<ls_tor_bo_bupa_consignee>) WITH KEY partner = ls_tor_item_tr_unique-consignee_id.
- IF <ls_tor_bo_bupa_consignee> IS ASSIGNED.
- READ TABLE lt_bofu_addr_postal_addr_5 ASSIGNING FIELD-SYMBOL(<ls_bofu_addr_postal_addr_5>) WITH KEY root_key = <ls_tor_bo_bupa_consignee>-key.
- ENDIF.
- IF <ls_bofu_addr_postal_addr_5> IS ASSIGNED.
- READ TABLE lt_t005u ASSIGNING FIELD-SYMBOL(<ls_t005u_5>) WITH KEY land1 = <ls_bofu_addr_postal_addr_5>-country_code bland = <ls_bofu_addr_postal_addr_5>-region.
- ENDIF.
- READ TABLE lt_but0bk ASSIGNING FIELD-SYMBOL(<ls_but0bk_5>) WITH KEY partner = ls_tor_item_tr_unique-consignee_id.
- IF <ls_but0bk_5> IS ASSIGNED.
- READ TABLE lt_bnka ASSIGNING FIELD-SYMBOL(<ls_bnka_5>) WITH KEY banks = <ls_but0bk_5>-banks bankl = <ls_but0bk_5>-bankl.
- ENDIF.
- IF <ls_tor_bo_bupa_consignee> IS ASSIGNED.
- READ TABLE lt_bp_common_5 ASSIGNING FIELD-SYMBOL(<ls_bupa_common_5>) WITH KEY parent_key = <ls_tor_bo_bupa_consignee>-key.
- READ TABLE lt_bp_tax_number_5 ASSIGNING FIELD-SYMBOL(<ls_bupa_tax_number_5>) WITH KEY parent_key = <ls_tor_bo_bupa_consignee>-key taxtype = 'RU1'.
- ENDIF.
- IF lt_bofu_address_telephone_5 IS NOT INITIAL AND <ls_tor_bo_bupa_consignee> IS ASSIGNED.
- 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.
- READ TABLE lt_bofu_addr_tel_sorted INTO ls_bofu_address_telephone_5_1 INDEX 1.
- READ TABLE lt_bofu_addr_tel_sorted INTO ls_bofu_address_telephone_5_2 INDEX 2.
- ENDIF.
- *5x поле - заполнение
- IF <ls_tor_bo_bupa_consignee> IS ASSIGNED AND <ls_tor_bo_bupa_consignee>-type = '1'.
- IF <ls_bupa_common_5> IS ASSIGNED
- AND <ls_bupa_tax_number_5> IS ASSIGNED
- AND <ls_t005u> IS ASSIGNED
- AND <ls_bofu_addr_postal_addr_5> IS ASSIGNED
- AND <ls_but0bk_5> IS ASSIGNED
- AND <ls_bnka_5> IS ASSIGNED.
- 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_gruzopoluchatel_fiz SEPARATED BY space.
- ENDIF.
- *6x поле - заполнение
- ELSEIF <ls_tor_bo_bupa_consignee> IS ASSIGNED AND <ls_tor_bo_bupa_consignee>-type = '2'.
- IF <ls_bupa_common_5> IS ASSIGNED
- AND <ls_bupa_tax_number_5> IS ASSIGNED
- AND <ls_t005u_5> IS ASSIGNED
- AND <ls_bofu_addr_postal_addr_5> IS ASSIGNED
- AND <ls_but0bk_5> IS ASSIGNED
- AND <ls_bnka_5> IS ASSIGNED.
- 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_gruzopoluchatel_yur SEPARATED BY space.
- ENDIF.
- ENDIF.
- *7x поле - заполнение
- 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.
- 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_naimenovanie_gruza = |{ ls_zz7x_naimenovanie_gruza } { ',' } { ls_form-zz7x_naimenovanie_gruza }|.
- ENDIF.
- ENDLOOP.
- IF ls_form-zz7x_naimenovanie_gruza IS NOT INITIAL.
- lv_string_length = strlen( ls_form-zz7x_naimenovanie_gruza ) - 1.
- ls_form-zz7x_naimenovanie_gruza = ls_form-zz7x_naimenovanie_gruza+0(lv_string_length).
- ENDIF.
- *8x поле - заполнение
- *9x поле - заполнение
- LOOP AT lt_toritemtrunique_itemcatprd INTO ls_toritemtrunique_itemcatprd.
- lv_zz9x_gruz_massa_brutto = ls_toritemtrunique_itemcatprd-gro_wei_val + lv_zz9x_gruz_massa_brutto.
- ENDLOOP.
- ls_form-zz9x_gruz_massa_brutto = |{ lv_zz9x_gruz_massa_brutto } { ls_toritemtrunique_itemcatprd-gro_wei_uni }|.
- *14x поле - заполнение
- 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.
- LOOP AT lt_tor_seal INTO DATA(ls_tor_seal).
- IF ls_tor_seal-party_id = ls_tor_item_tr_unique-consignee_id.
- 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_priem_gruza_plomba_konte = |{ lv_zz14x_priem_gruza_plomba } { ' ' } { lv_zz14x_priem_gruza_konteiner }|.
- *15x поле - заполнение
- ls_form-zz15x_priemgruza_vesbrutto = ls_form-zz9x_gruz_massa_brutto.
- *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 ASSIGNING <ls_t005u> INDEX 1.
- IF <ls_t005u> IS ASSIGNED.
- ls_form-zz18x_sdacha_gruza_fakt_adres = |{ <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.
- ENDIF.
- ENDLOOP.
- ENDLOOP.
- *19x поле - заполнение
- ls_form-zz19x_sdacha_gruza_plomba_kont = ls_form-zz14x_priem_gruza_plomba_konte.
- *20x поле - заполнение
- ls_form-zz20x_sdacha_gruza_ves_brutto = ls_form-zz9x_gruz_massa_brutto.
- APPEND ls_form TO lt_form.
- APPEND VALUE #( body = ls_form ) TO et_form.
- CLEAR lt_bofu_addr_tel_sorted.
- CLEAR lt_toritemtrunique_itemcatprd.
- CLEAR lt_toritemtr_linkkeysunique.
- CLEAR lt_torbomat_linkkeysunique.
- CLEAR lt_tor_bo_material_unique.
- CLEAR lt_sapapo_matkey_unique.
- CLEAR lt_toritemtrunique_itemcattur.
- CLEAR lt_tor_boloclog18keys_unique.
- CLEAR lt_loc_address_18_unique.
- CLEAR lv_zz9x_gruz_massa_brutto.
- CLEAR ls_form-zz7x_naimenovanie_gruza.
- CLEAR ls_form-zz5x_gruzopoluchatel_fiz.
- CLEAR ls_form-zz6x_gruzopoluchatel_yur.
- CLEAR ls_form-zz7x_naimenovanie_gruza.
- CLEAR ls_form-zz9x_gruz_massa_brutto.
- CLEAR ls_form-zz14x_priem_gruza_plomba_konte.
- CLEAR ls_form-zz15x_priemgruza_vesbrutto.
- CLEAR ls_form-zz18x_sdacha_gruza_fakt_adres.
- CLEAR ls_form-zz19x_sdacha_gruza_plomba_kont.
- CLEAR ls_form-zz20x_sdacha_gruza_ves_brutto.
- ENDLOOP.
- ENDMETHOD.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement