Advertisement
hxxxrz

VEHWAYBILL_BACKUP_2

Mar 10th, 2021
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 53.61 KB | None | 0 0
  1. *&---------------------------------------------------------------------*
  2. *& Номер спецификации: BR_D_024
  3. *& Наименование спецификации: Печатные формы
  4. *& Дата создания: 09.03.2021
  5. *& Проект: Создание печатных форм
  6. *& Разработчик: Федоров К
  7. *&
  8. *&!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  9. *& При разработке формуляра использовался скрипт FormCalc (для удаления последней пустой страницы):
  10. *& Subform2>Object>Pagination>Conditional>Edit
  11. *&!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  12.  
  13. METHOD get_vehwaybill_data.
  14.  
  15. DATA: ls_form TYPE zstm_vehicle_waybill,
  16. lt_form TYPE TABLE OF zstm_vehicle_waybill,
  17. lt_tor_root TYPE /scmtms/t_tor_root_k,
  18. lt_tor_stop TYPE /scmtms/t_tor_stop_k,
  19. lt_tor_stop_first TYPE /scmtms/t_tor_stop_k,
  20. lt_mtrl_description TYPE /scmtms/t_mat_description_k,
  21. lt_tor_item_tr TYPE /scmtms/t_tor_item_tr_k,
  22. lt_toritemtrunique_itemcatprd TYPE /scmtms/t_tor_item_tr_k,
  23. lt_toritemtrunique_itemcattur TYPE /scmtms/t_tor_item_tr_k,
  24. lt_sel_opt_f TYPE /bobf/t_frw_query_selparam,
  25. lt_sel_opt_l TYPE /bobf/t_frw_query_selparam,
  26. ls_sel_opt_f LIKE LINE OF lt_sel_opt_f,
  27. ls_sel_opt_l LIKE LINE OF lt_sel_opt_l,
  28. lt_loc_data_f TYPE /scmtms/t_loc_q_elem_result,
  29. lt_loc_data_l TYPE /scmtms/t_loc_q_elem_result,
  30. lv_node_key TYPE /bobf/obm_node_key,
  31. lv_assoc_key TYPE /bobf/obm_assoc_key,
  32. lv_node_key_tel TYPE /bobf/obm_node_key,
  33. lv_assoc_key_telephone TYPE /bobf/obm_assoc_key,
  34. lv_assoc_key_postal_address TYPE /bobf/obm_assoc_key,
  35. lt_bofu_address_postal_address TYPE /bofu/t_addr_postal_addressk,
  36. lt_loc_root_f TYPE /scmtms/t_bo_loc_root_k,
  37. lt_loc_root_l TYPE /scmtms/t_bo_loc_root_k,
  38. lt_drv_root TYPE /scmtms/t_res_lab_root_k,
  39. lt_tras_capa_offer TYPE /scmtms/t_res_quantity_k,
  40. lt_bupa_consignee TYPE /bofu/t_bupa_root_k,
  41. lt_tor_bupa_root TYPE /bofu/t_bupa_root_k,
  42. lt_role TYPE /bofu/t_bupa_role_k,
  43. lt_tor_bupa_ship_root TYPE /bofu/t_bupa_root_k,
  44. lt_bupa_data TYPE /bofu/t_bupa_root_k,
  45. ls_bupa_data LIKE LINE OF lt_bupa_data,
  46. lt_but000 TYPE TABLE OF but000,
  47. lt_but000_bupa_ship TYPE TABLE OF but000,
  48. lt_but000_bupa_consignee TYPE TABLE OF but000,
  49. lt_but000_tor_root TYPE TABLE OF but000,
  50. lt_relationship TYPE /bofu/t_bupa_relship_k,
  51. lt_transp_capa_offer TYPE /scmtms/t_res_quantity_k,
  52. lt_res_root TYPE /scmtms/t_res_root_k,
  53. lt_bofu_address_telephone TYPE /bofu/t_addr_telephonek,
  54. lt_stop_first TYPE /scmtms/t_tor_stop_k,
  55. lt_key_bupa TYPE /bobf/t_frw_key,
  56. ls_key_bupa LIKE LINE OF lt_key_bupa,
  57. lt_role_ship TYPE /bofu/t_bupa_role_k,
  58. lt_bp_root TYPE /bofu/t_bupa_root_k,
  59. ls_selpar TYPE /bobf/s_frw_query_selparam,
  60. lt_selpar TYPE /bobf/t_frw_query_selparam,
  61. go_message TYPE REF TO /bobf/if_frw_message,
  62. ls_bofu_address_telephone_4_1 LIKE LINE OF lt_bofu_address_telephone,
  63. ls_bofu_address_telephone_4_2 LIKE LINE OF lt_bofu_address_telephone,
  64. ls_bofu_address_telephone_6_1 LIKE LINE OF lt_bofu_address_telephone,
  65. ls_bofu_address_telephone_6_2 LIKE LINE OF lt_bofu_address_telephone,
  66. ls_bofu_address_telephone_5_1 LIKE LINE OF lt_bofu_address_telephone,
  67. ls_bofu_address_telephone_5_2 LIKE LINE OF lt_bofu_address_telephone,
  68. ls_bofu_address_telephone_7_1 LIKE LINE OF lt_bofu_address_telephone,
  69. ls_bofu_address_telephone_7_2 LIKE LINE OF lt_bofu_address_telephone,
  70. ls_bofu_address_telephone_42_1 LIKE LINE OF lt_bofu_address_telephone,
  71. ls_bofu_address_telephone_42_2 LIKE LINE OF lt_bofu_address_telephone,
  72. ls_bofu_address_telephone_43_1 LIKE LINE OF lt_bofu_address_telephone,
  73. ls_bofu_address_telephone_43_2 LIKE LINE OF lt_bofu_address_telephone,
  74. ls_bofu_address_telephone_44_1 LIKE LINE OF lt_bofu_address_telephone,
  75. ls_bofu_address_telephone_44_2 LIKE LINE OF lt_bofu_address_telephone,
  76. ls_bofu_addr_telephone_23_1 LIKE LINE OF lt_bofu_address_telephone,
  77. ls_bofu_addr_telephone_23_2 LIKE LINE OF lt_bofu_address_telephone,
  78. lt_bofu_addr_tel_sorted LIKE lt_bofu_address_telephone,
  79. lv_date TYPE d,
  80. lv_time TYPE t,
  81. lv_date_result TYPE c LENGTH 11,
  82. lv_zzcargo_condition_i TYPE i,
  83. lv_qua_pcs_val_9 TYPE i,
  84. lv_gro_wei_val_10 TYPE p LENGTH 10 DECIMALS 2,
  85. lt_tor_z_pdf TYPE ztttm_tor_pdf_k,
  86. lt_bupa_common TYPE /bofu/t_bupa_common_k,
  87. lt_bupa_tax_number TYPE /bofu/t_bupa_taxno_k,
  88. lt_t005u TYPE TABLE OF t005u,
  89. lt_but0bk TYPE TABLE OF but0bk,
  90. lt_bnka TYPE TABLE OF bnka,
  91. zzfn_shipper1 TYPE c LENGTH 1000,
  92. zzfn_shipper2 TYPE c LENGTH 1000,
  93. zzname_shipper1 TYPE c LENGTH 1000,
  94. zzname_shipper2 TYPE c LENGTH 1000,
  95. zzname_consignee1 TYPE c LENGTH 1000,
  96. zzname_consignee2 TYPE c LENGTH 1000,
  97. lv_zz14x_priem_gruza_plomba TYPE c LENGTH 1000,
  98. lv_zz14x_priem_gruza_konteiner TYPE c LENGTH 1000,
  99. lv_zz26x_reg_nomer_ts TYPE c LENGTH 1000,
  100. lv_zz26x_reg_nomer_pricep TYPE c LENGTH 1000,
  101. zz3and4x_shipper TYPE c LENGTH 1000,
  102. lt_tor_bo_material TYPE /scmtms/t_mat_root_k,
  103. lt_sapapo_matkey TYPE TABLE OF /sapapo/matkey,
  104. lt_zttm_group_mat_t TYPE TABLE OF zttm_group_mat_t,
  105. lt_loc_postal_address TYPE /bofu/t_addr_postal_addressk,
  106. lt_tor_item_tr_unique TYPE TABLE OF /scmtms/s_tor_item_tr_k,
  107. lt_tor_bo_bupa_consignee TYPE /bofu/t_bupa_root_k,
  108. lt_toritemtr_linkkeysunique TYPE /bobf/t_frw_key_link,
  109. lt_torbomat_linkkeysunique TYPE /bobf/t_frw_key_link,
  110. lt_tor_bo_material_unique LIKE lt_tor_bo_material,
  111. lt_sapapo_matkey_unique LIKE lt_sapapo_matkey,
  112. lt_bofu_address_telephone_5 LIKE lt_bofu_address_telephone,
  113. lt_bofu_addr_postal_addr_5 LIKE lt_bofu_address_postal_address,
  114. lt_bp_common_5 TYPE /bofu/t_bupa_common_k,
  115. lt_bp_tax_number_5 TYPE /bofu/t_bupa_taxno_k,
  116. lt_zz7x_naimenovanie_gruza TYPE STANDARD TABLE OF string,
  117. lv_testing TYPE string,
  118. lv_string_length TYPE i,
  119. lv_zz9x_gruz_massa_brutto TYPE decfloat16,
  120. lv_zz15x_priemgruza_vesbrutto TYPE decfloat16,
  121. lt_bp_postal_address TYPE /bofu/t_addr_postal_addressk,
  122. lt_t005u_11x TYPE TABLE OF t005u,
  123. lt_tor_seal TYPE /scmtms/t_tor_seal_k,
  124. lt_tor_bo_driver TYPE /scmtms/t_res_lab_root_k,
  125. lt_tor_bo_resource TYPE /scmtms/t_res_root_k,
  126. lt_splr_common TYPE /bofu/t_bupa_common_k,
  127. lt_tor_bo_tsp_root TYPE /bofu/t_bupa_root_k,
  128. lt_splr_tax_number TYPE /bofu/t_bupa_taxno_k,
  129. lt_bofu_addr_post_addr_18 LIKE lt_bofu_address_postal_address,
  130. lt_bofu_addr_postal_addr_23 LIKE lt_bofu_address_postal_address,
  131. lt_t005u_23x TYPE TABLE OF t005u,
  132. lt_bofu_addr_telephone_23 LIKE lt_bofu_address_telephone,
  133. lt_tor_item_tr_unique_dri LIKE lt_tor_item_tr_unique,
  134. lt_tor_bo_loc_log_18 TYPE /scmtms/t_bo_loc_root_k,
  135. lt_tor_stop_18_keys TYPE /bobf/t_frw_key,
  136. lt_tor_item_tr_item_cat_dri LIKE lt_tor_item_tr,
  137. lt_tor_boloclog18keys_unique TYPE /bobf/t_frw_key,
  138. lt_loc_address_18 TYPE /bofu/t_addr_addressi_k,
  139. lt_loc_address_18_unique LIKE lt_loc_address_18,
  140. lt_pos_address TYPE /bofu/t_addr_postal_addressk,
  141. lt_bupa_taxnum TYPE /bofu/t_bupa_taxno_k,
  142. lt_bp_taxnum TYPE /bofu/t_bupa_taxno_k,
  143. lt_bupa_pos_address TYPE /bofu/t_addr_postal_addressk,
  144. lt_bupa_addrinfo TYPE /bofu/t_bupa_adrinfo_k,
  145. lt_bupa_address TYPE /bofu/t_addr_addressi_k,
  146. lt_telephone TYPE /bofu/t_addr_telephonek,
  147. zzvehicle_param TYPE c LENGTH 100,
  148. lv_qua_pcs_val_all TYPE i,
  149. lt_17_itemtr_bodriver TYPE /scmtms/t_res_lab_root_k,
  150. lt_17_itemtr_bodriver_res TYPE /scmtms/t_res_lab_root_k,
  151. lt_bp_taxnum_res LIKE lt_bp_taxnum,
  152. lt_drv_addr_tel TYPE /bofu/t_addr_telephonek.
  153.  
  154. *1x поле
  155. mo_tor_srv->retrieve_by_association(
  156. EXPORTING
  157. iv_node_key = /scmtms/if_tor_c=>sc_node-root
  158. it_key = it_tor_key
  159. iv_association = /scmtms/if_tor_c=>sc_association-root-stop_first
  160. iv_fill_data = abap_true
  161. IMPORTING
  162. et_target_key = DATA(lt_tor_stop_first_keys)
  163. et_data = lt_tor_stop_first ).
  164.  
  165. READ TABLE lt_tor_stop_first INTO DATA(ls_tor_stop_first) INDEX 1.
  166.  
  167. CONVERT TIME STAMP ls_tor_stop_first-plan_trans_time TIME ZONE sy-zonlo
  168. INTO DATE lv_date TIME lv_time.
  169.  
  170. CONCATENATE lv_date+6(2) '.' lv_date+4(2) '.' lv_date(4) INTO lv_date_result.
  171.  
  172. ls_form-zz1x_actual_shipment_date = lv_date_result.
  173.  
  174. *2x поле
  175. mo_tor_srv->retrieve(
  176. EXPORTING
  177. iv_node_key = /scmtms/if_tor_c=>sc_node-root
  178. it_key = it_tor_key
  179. iv_fill_data = abap_true
  180. IMPORTING
  181. et_data = lt_tor_root ).
  182.  
  183. READ TABLE lt_tor_root INTO DATA(ls_tor_root) INDEX 1.
  184.  
  185. ls_form-zz2x_bill_of_lading_num = ls_tor_root-tor_id.
  186. SHIFT ls_form-zz2x_bill_of_lading_num LEFT DELETING LEADING '0'.
  187.  
  188. *3x поле, 4x поле; 5x поле - получение, 6x поле - получение
  189. *3x поле, 4x поле
  190. mo_tor_srv->retrieve_by_association(
  191. EXPORTING
  192. iv_node_key = /scmtms/if_tor_c=>sc_node-root
  193. it_key = it_tor_key
  194. iv_association = /scmtms/if_tor_c=>sc_association-root-bupa_ship_root
  195. iv_fill_data = abap_true
  196. IMPORTING
  197. et_target_key = DATA(lt_tor_bupa_ship_keys)
  198. et_data = lt_tor_bupa_ship_root ).
  199.  
  200. mo_bupa_srv->retrieve_by_association(
  201. EXPORTING
  202. iv_node_key = /bofu/if_bupa_constants=>sc_node-root
  203. it_key = lt_tor_bupa_ship_keys
  204. iv_association = /bofu/if_bupa_constants=>sc_association-root-common
  205. iv_fill_data = abap_true
  206. IMPORTING
  207. et_data = lt_bupa_common ).
  208.  
  209. mo_bupa_srv->retrieve_by_association(
  210. EXPORTING
  211. iv_node_key = /bofu/if_bupa_constants=>sc_node-root
  212. it_key = lt_tor_bupa_ship_keys
  213. iv_association = /bofu/if_bupa_constants=>sc_association-root-tax_number
  214. iv_fill_data = abap_true
  215. IMPORTING
  216. et_data = lt_bupa_tax_number ).
  217.  
  218. mo_tor_srv->retrieve_by_association(
  219. EXPORTING
  220. iv_node_key = /scmtms/if_tor_c=>sc_node-root
  221. it_key = it_tor_key
  222. iv_association = /scmtms/if_tor_c=>sc_association-root-item_tr
  223. iv_fill_data = abap_true
  224. IMPORTING
  225. et_data = lt_tor_item_tr
  226. et_target_key = DATA(lt_tor_item_tr_keys)
  227. et_key_link = DATA(lt_tor_item_tr_link_keys) ).
  228.  
  229. mo_tor_srv->retrieve_by_association(
  230. EXPORTING
  231. iv_node_key = /scmtms/if_tor_c=>sc_node-item_tr
  232. it_key = lt_tor_item_tr_keys
  233. iv_association = /scmtms/if_tor_c=>sc_association-item_tr-itemparty
  234. IMPORTING
  235. et_target_key = DATA(lt_tor_itemparty_keys) ).
  236.  
  237. mo_tor_srv->retrieve_by_association(
  238. EXPORTING
  239. iv_node_key = /scmtms/if_tor_c=>sc_node-itemparty
  240. it_key = lt_tor_itemparty_keys
  241. iv_association = /scmtms/if_tor_c=>sc_association-itemparty-bupa_root
  242. IMPORTING
  243. et_data = lt_tor_bupa_root
  244. et_target_key = DATA(lt_tor_bupa_root_keys) ).
  245.  
  246. mo_bp_srv->retrieve_by_association(
  247. EXPORTING
  248. it_key = lt_tor_bupa_ship_keys
  249. iv_node_key = /bofu/if_bupa_constants=>sc_node-root
  250. iv_association = /bofu/if_bupa_constants=>sc_association-root-addressinformation
  251. IMPORTING
  252. et_target_key = DATA(lt_bp_addressinformation_keys) ).
  253.  
  254. mo_bp_srv->retrieve_by_association(
  255. EXPORTING
  256. it_key = lt_bp_addressinformation_keys
  257. iv_node_key = /bofu/if_bupa_constants=>sc_node-addressinformation
  258. iv_association = /bofu/if_bupa_constants=>sc_association-addressinformation-address
  259. IMPORTING
  260. et_target_key = DATA(lt_bp_address_keys) ).
  261.  
  262. /scmtms/cl_common_helper=>get_do_keys_4_rba(
  263. EXPORTING
  264. iv_host_bo_key = /bofu/if_bupa_constants=>sc_bo_key
  265. iv_host_do_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
  266. iv_do_node_key = /bofu/if_addr_constants=>sc_node-telephone
  267. iv_do_assoc_key = /bofu/if_addr_constants=>sc_association-root-telephone
  268. IMPORTING
  269. ev_assoc_key = lv_assoc_key_telephone ).
  270.  
  271. mo_bp_srv->retrieve_by_association(
  272. EXPORTING
  273. iv_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
  274. iv_association = lv_assoc_key_telephone
  275. iv_fill_data = abap_true
  276. it_key = lt_bp_address_keys
  277. IMPORTING
  278. et_data = lt_bofu_address_telephone ).
  279.  
  280. /scmtms/cl_common_helper=>get_do_keys_4_rba(
  281. EXPORTING
  282. iv_host_bo_key = /bofu/if_bupa_constants=>sc_bo_key
  283. iv_host_do_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
  284. iv_do_node_key = /bofu/if_addr_constants=>sc_node-postal_address
  285. iv_do_assoc_key = /bofu/if_addr_constants=>sc_association-root-postal_address
  286. IMPORTING
  287. ev_assoc_key = lv_assoc_key_postal_address ).
  288.  
  289. mo_bp_srv->retrieve_by_association(
  290. EXPORTING
  291. iv_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
  292. iv_association = lv_assoc_key_postal_address
  293. iv_fill_data = abap_true
  294. it_key = lt_bp_address_keys
  295. IMPORTING
  296. et_data = lt_bofu_address_postal_address ).
  297.  
  298. READ TABLE lt_bofu_address_postal_address INTO DATA(ls_bofu_addr_postal_addr_4) INDEX 1.
  299.  
  300. SELECT bezei
  301. FROM t005u
  302. INTO CORRESPONDING FIELDS OF TABLE lt_t005u
  303. 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'.
  304.  
  305. READ TABLE lt_t005u INTO DATA(ls_t005u) INDEX 1.
  306. READ TABLE lt_tor_bupa_ship_root INTO DATA(ls_tor_bupa_ship_root) INDEX 1.
  307. READ TABLE lt_bupa_common INTO DATA(ls_bupa_common) INDEX 1.
  308. READ TABLE lt_bupa_tax_number INTO DATA(ls_bupa_tax_number) WITH KEY taxtype = 'RU1'.
  309.  
  310. SELECT bankn, banks, bankl
  311. FROM but0bk
  312. INTO CORRESPONDING FIELDS OF TABLE @lt_but0bk
  313. WHERE partner EQ @ls_tor_bupa_ship_root-partner.
  314.  
  315. READ TABLE lt_but0bk INTO DATA(ls_but0bk) INDEX 1.
  316.  
  317. SELECT banka, ort01, bnklz, brnch
  318. FROM bnka
  319. INTO CORRESPONDING FIELDS OF TABLE @lt_bnka
  320. WHERE banks EQ @ls_but0bk-banks AND bankl EQ @ls_but0bk-bankl.
  321.  
  322. READ TABLE lt_bnka INTO DATA(ls_bnka) INDEX 1.
  323. READ TABLE lt_bofu_address_telephone INTO ls_bofu_address_telephone_4_1 INDEX 1.
  324. READ TABLE lt_bofu_address_telephone INTO ls_bofu_address_telephone_4_2 INDEX 2.
  325.  
  326. IF ls_bupa_common-firstname IS NOT INITIAL.
  327. zz3and4x_shipper = ls_bupa_common-firstname.
  328. ENDIF.
  329.  
  330. IF ls_bupa_common-lastname IS NOT INITIAL.
  331. zz3and4x_shipper = |{ zz3and4x_shipper } { ls_bupa_common-lastname }|.
  332. ENDIF.
  333.  
  334. IF ls_bupa_tax_number-taxnumber IS NOT INITIAL.
  335. zz3and4x_shipper = |{ zz3and4x_shipper } { '; ИНН:' } { ls_bupa_tax_number-taxnumber }|.
  336. ENDIF.
  337.  
  338. zz3and4x_shipper = |{ zz3and4x_shipper } { '; адрес:' }|.
  339.  
  340. IF ls_t005u-bezei IS NOT INITIAL.
  341. zz3and4x_shipper = |{ zz3and4x_shipper } { ls_t005u-bezei }|.
  342. ENDIF.
  343.  
  344. IF ls_bofu_addr_postal_addr_4-district_name IS NOT INITIAL.
  345. zz3and4x_shipper = |{ zz3and4x_shipper } { ',' } { ls_bofu_addr_postal_addr_4-district_name }|.
  346. ENDIF.
  347.  
  348. IF ls_bofu_addr_postal_addr_4-city_name IS NOT INITIAL.
  349. zz3and4x_shipper = |{ zz3and4x_shipper } { ',' } { ls_bofu_addr_postal_addr_4-city_name }|.
  350. ENDIF.
  351.  
  352. IF ls_bofu_addr_postal_addr_4-street_name IS NOT INITIAL.
  353. zz3and4x_shipper = |{ zz3and4x_shipper } { ',' } { ls_bofu_addr_postal_addr_4-street_name }|.
  354. ENDIF.
  355.  
  356. IF ls_bofu_addr_postal_addr_4-house_id IS NOT INITIAL.
  357. zz3and4x_shipper = |{ zz3and4x_shipper } { ', дом' } { ls_bofu_addr_postal_addr_4-house_id }|.
  358. ENDIF.
  359.  
  360. IF ls_bofu_address_telephone_4_1-normalised_number_text IS NOT INITIAL.
  361. zz3and4x_shipper = |{ zz3and4x_shipper } { ';' } { ls_bofu_address_telephone_4_1-normalised_number_text }|.
  362. ENDIF.
  363.  
  364. IF ls_bofu_address_telephone_4_2-normalised_number_text IS NOT INITIAL.
  365. zz3and4x_shipper = |{ zz3and4x_shipper } { ',' } { ls_bofu_address_telephone_4_2-normalised_number_text }|.
  366. ENDIF.
  367.  
  368. IF ls_but0bk-bankn IS NOT INITIAL.
  369. zz3and4x_shipper = |{ zz3and4x_shipper } { '; Р\С:' } { ls_but0bk-bankn }|.
  370. ENDIF.
  371.  
  372. IF ls_bnka-banka IS NOT INITIAL.
  373. zz3and4x_shipper = |{ zz3and4x_shipper } { 'в банке' } { ls_bnka-banka }|.
  374. ENDIF.
  375.  
  376. IF ls_bnka-ort01 IS NOT INITIAL.
  377. zz3and4x_shipper = |{ zz3and4x_shipper } { 'в городе' } { ls_bnka-ort01 }|.
  378. ENDIF.
  379.  
  380. IF ls_bnka-bnklz IS NOT INITIAL.
  381. zz3and4x_shipper = |{ zz3and4x_shipper } { ', "БИК"' } { ls_bnka-bnklz }|.
  382. ENDIF.
  383.  
  384. IF ls_bnka-brnch IS NOT INITIAL.
  385. zz3and4x_shipper = |{ zz3and4x_shipper } { ', К\С' } { ls_bnka-brnch }|.
  386. ENDIF.
  387.  
  388. IF ls_tor_bupa_ship_root-type = '1'.
  389. ls_form-zz3x_shipper_individual = zz3and4x_shipper.
  390. ELSEIF ls_tor_bupa_ship_root-type = '2'.
  391. ls_form-zz4x_shipper_entity = zz3and4x_shipper.
  392. ENDIF.
  393.  
  394. *5x поле - получение, 6x поле - получение
  395. mo_tor_srv->retrieve_by_association(
  396. EXPORTING
  397. iv_node_key = /scmtms/if_tor_c=>sc_node-item_tr
  398. it_key = lt_tor_item_tr_keys
  399. iv_association = /scmtms/if_tor_c=>sc_association-item_tr-bo_bupa_consignee
  400. iv_fill_data = abap_true
  401. IMPORTING
  402. et_data = lt_tor_bo_bupa_consignee
  403. et_target_key = DATA(lt_tor_bo_bupa_consignee_keys) ).
  404.  
  405. mo_bp_srv->retrieve_by_association(
  406. EXPORTING
  407. iv_node_key = /bofu/if_bupa_constants=>sc_node-root
  408. it_key = lt_tor_bo_bupa_consignee_keys
  409. iv_association = /bofu/if_bupa_constants=>sc_association-root-addressinformation
  410. iv_fill_data = abap_false
  411. IMPORTING
  412. et_target_key = DATA(lt_bp_addrinf_5_keys) ).
  413.  
  414. mo_bp_srv->retrieve_by_association(
  415. EXPORTING
  416. iv_node_key = /bofu/if_bupa_constants=>sc_node-addressinformation
  417. it_key = lt_bp_addrinf_5_keys
  418. iv_association = /bofu/if_bupa_constants=>sc_association-addressinformation-address
  419. iv_fill_data = abap_false
  420. IMPORTING
  421. et_target_key = DATA(lt_bp_address_5_keys) ).
  422.  
  423. mo_bp_srv->retrieve_by_association(
  424. EXPORTING
  425. iv_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
  426. iv_association = lv_assoc_key_telephone
  427. iv_fill_data = abap_true
  428. it_key = lt_bp_address_5_keys
  429. IMPORTING
  430. et_data = lt_bofu_address_telephone_5 ).
  431.  
  432. mo_bp_srv->retrieve_by_association(
  433. EXPORTING
  434. iv_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
  435. iv_association = lv_assoc_key_postal_address
  436. iv_fill_data = abap_true
  437. it_key = lt_bp_address_5_keys
  438. IMPORTING
  439. et_data = lt_bofu_addr_postal_addr_5 ).
  440.  
  441. mo_bp_srv->retrieve_by_association(
  442. EXPORTING
  443. iv_node_key = /bofu/if_bupa_constants=>sc_node-root
  444. it_key = lt_tor_bo_bupa_consignee_keys
  445. iv_association = /bofu/if_bupa_constants=>sc_association-root-common
  446. iv_fill_data = abap_true
  447. IMPORTING
  448. et_data = lt_bp_common_5 ).
  449.  
  450. mo_bp_srv->retrieve_by_association(
  451. EXPORTING
  452. iv_node_key = /bofu/if_bupa_constants=>sc_node-root
  453. it_key = lt_tor_bo_bupa_consignee_keys
  454. iv_association = /bofu/if_bupa_constants=>sc_association-root-tax_number
  455. iv_fill_data = abap_true
  456. IMPORTING
  457. et_data = lt_bp_tax_number_5 ).
  458.  
  459. SELECT bezei, land1, bland
  460. FROM t005u
  461. INTO CORRESPONDING FIELDS OF TABLE @lt_t005u
  462. WHERE spras EQ 'R'.
  463.  
  464. SELECT partner, bankn, banks, bankl
  465. FROM but0bk
  466. INTO CORRESPONDING FIELDS OF TABLE @lt_but0bk.
  467.  
  468. SELECT banka, ort01, bnklz, brnch, banks, bankl
  469. FROM bnka
  470. INTO CORRESPONDING FIELDS OF TABLE @lt_bnka.
  471.  
  472. *7x поле - получение
  473. mo_tor_srv->retrieve_by_association(
  474. EXPORTING
  475. iv_node_key = /scmtms/if_tor_c=>sc_node-item_tr
  476. it_key = lt_tor_item_tr_keys
  477. iv_association = /scmtms/if_tor_c=>sc_association-item_tr-bo_material
  478. iv_fill_data = abap_true
  479. IMPORTING
  480. et_data = lt_tor_bo_material
  481. et_target_key = DATA(lt_tor_bo_material_keys)
  482. et_key_link = DATA(lt_tor_bo_material_link_keys) ).
  483.  
  484. mo_mtrl_srv->retrieve_by_association(
  485. EXPORTING
  486. iv_node_key = /scmtms/if_mat_c=>sc_node-root
  487. it_key = lt_tor_bo_material_keys
  488. iv_association = /scmtms/if_mat_c=>sc_association-root-description
  489. iv_fill_data = abap_true
  490. IMPORTING
  491. et_data = lt_mtrl_description ).
  492.  
  493. IF lt_tor_bo_material IS NOT INITIAL.
  494. SELECT matnr matkl
  495. FROM /sapapo/matkey
  496. INTO CORRESPONDING FIELDS OF TABLE lt_sapapo_matkey
  497. FOR ALL ENTRIES IN lt_tor_bo_material
  498. WHERE /sapapo/matkey~matnr EQ lt_tor_bo_material-internal_id.
  499. ENDIF.
  500.  
  501. IF lt_sapapo_matkey IS NOT INITIAL.
  502. SELECT matkl wgbez
  503. FROM zttm_group_mat_t
  504. INTO CORRESPONDING FIELDS OF TABLE lt_zttm_group_mat_t
  505. FOR ALL ENTRIES IN lt_sapapo_matkey
  506. WHERE zttm_group_mat_t~matkl EQ lt_sapapo_matkey-matkl.
  507. ENDIF.
  508.  
  509. *10x поле - заполнение
  510. IF ls_tor_bupa_ship_root-type = '1'.
  511. ls_form-zz10x_cargo_accept = ls_form-zz3x_shipper_individual.
  512. ELSEIF ls_tor_bupa_ship_root-type = '2'.
  513. ls_form-zz10x_cargo_accept = ls_form-zz4x_shipper_entity.
  514. ENDIF.
  515.  
  516. *11x поле - получение
  517. mo_tor_srv->retrieve_by_association(
  518. EXPORTING
  519. iv_node_key = /scmtms/if_tor_c=>sc_node-stop
  520. it_key = lt_tor_stop_first_keys
  521. iv_association = /scmtms/if_tor_c=>sc_association-stop-bo_loc_log
  522. iv_fill_data = abap_false
  523. IMPORTING
  524. et_target_key = DATA(lt_tor_bo_loc_log_keys) ).
  525.  
  526. mo_loc_srv->retrieve_by_association(
  527. EXPORTING
  528. iv_node_key = /scmtms/if_location_c=>sc_node-root
  529. it_key = lt_tor_bo_loc_log_keys
  530. iv_association = /scmtms/if_location_c=>sc_association-root-geographical_information
  531. iv_fill_data = abap_false
  532. IMPORTING
  533. et_target_key = DATA(lt_loc_geo_info_keys) ).
  534.  
  535. mo_loc_srv->retrieve_by_association(
  536. EXPORTING
  537. iv_node_key = /scmtms/if_location_c=>sc_node-geographical_information
  538. it_key = lt_loc_geo_info_keys
  539. iv_association = /scmtms/if_location_c=>sc_association-geographical_information-address
  540. iv_fill_data = abap_false
  541. IMPORTING
  542. et_target_key = DATA(lt_loc_address_keys) ).
  543.  
  544. /scmtms/cl_common_helper=>get_do_keys_4_rba(
  545. EXPORTING
  546. iv_host_bo_key = /bofu/if_bupa_constants=>sc_bo_key
  547. iv_host_do_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
  548. iv_do_node_key = /bofu/if_addr_constants=>sc_node-postal_address
  549. iv_do_assoc_key = /bofu/if_addr_constants=>sc_association-root-postal_address
  550. IMPORTING
  551. ev_assoc_key = DATA(lv_assoc_key_11x) ).
  552.  
  553. mo_bp_srv->retrieve_by_association(
  554. EXPORTING
  555. iv_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
  556. iv_association = lv_assoc_key_11x
  557. iv_fill_data = abap_true
  558. it_key = lt_loc_address_keys
  559. IMPORTING
  560. et_data = lt_bp_postal_address ).
  561.  
  562. READ TABLE lt_bp_postal_address INTO DATA(ls_bp_postal_address) INDEX 1.
  563.  
  564. SELECT bezei
  565. FROM t005u
  566. INTO CORRESPONDING FIELDS OF TABLE lt_t005u_11x
  567. WHERE bland EQ ls_bp_postal_address-region AND land1 EQ ls_bp_postal_address-country_code AND t005u~spras = 'R'.
  568.  
  569. READ TABLE lt_t005u_11x INTO DATA(ls_t005u_11x) INDEX 1.
  570.  
  571. *11x поле - заполнение
  572. 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 }|.
  573.  
  574. *12x поле - заполнение
  575. ls_form-zz12x_cargo_accept_fact_of_loa = ls_form-zz1x_actual_shipment_date.
  576.  
  577. *13x поле - заполнение
  578. ls_form-zz13x_cargo_accept_fact_of_loa = ls_form-zz1x_actual_shipment_date.
  579.  
  580. *14x поле - получение
  581. mo_tor_srv->retrieve_by_association(
  582. EXPORTING
  583. iv_node_key = /scmtms/if_tor_c=>sc_node-root
  584. it_key = it_tor_key
  585. iv_association = /scmtms/if_tor_c=>sc_association-root-seal
  586. iv_fill_data = abap_true
  587. IMPORTING
  588. et_data = lt_tor_seal ).
  589.  
  590. *18x - получение
  591. mo_tor_srv->retrieve_by_association(
  592. EXPORTING
  593. iv_node_key = /scmtms/if_tor_c=>sc_node-root
  594. it_key = it_tor_key
  595. iv_association = /scmtms/if_tor_c=>sc_association-root-stop
  596. iv_fill_data = abap_true
  597. IMPORTING
  598. et_data = lt_tor_stop ).
  599.  
  600. LOOP AT lt_tor_stop INTO DATA(ls_tor_stop).
  601. IF ls_tor_stop-wh_next_rel = 'U'.
  602. APPEND ls_tor_stop TO lt_tor_stop_18_keys.
  603. ENDIF.
  604. ENDLOOP.
  605.  
  606. mo_tor_srv->retrieve_by_association(
  607. EXPORTING
  608. iv_node_key = /scmtms/if_tor_c=>sc_node-stop
  609. it_key = lt_tor_stop_18_keys
  610. iv_association = /scmtms/if_tor_c=>sc_association-stop-bo_loc_log
  611. iv_fill_data = abap_true
  612. IMPORTING
  613. et_data = lt_tor_bo_loc_log_18
  614. et_target_key = DATA(lt_tor_bo_loc_log_18_keys) ).
  615.  
  616. mo_loc_srv->retrieve_by_association(
  617. EXPORTING
  618. iv_node_key = /scmtms/if_location_c=>sc_node-root
  619. it_key = lt_tor_bo_loc_log_18_keys
  620. iv_association = /scmtms/if_location_c=>sc_association-root-geographical_information
  621. iv_fill_data = abap_false
  622. IMPORTING
  623. et_target_key = DATA(lt_loc_geo_info_18_keys) ).
  624.  
  625. mo_loc_srv->retrieve_by_association(
  626. EXPORTING
  627. iv_node_key = /scmtms/if_location_c=>sc_node-geographical_information
  628. it_key = lt_loc_geo_info_18_keys
  629. iv_association = /scmtms/if_location_c=>sc_association-geographical_information-address
  630. iv_fill_data = abap_true
  631. IMPORTING
  632. et_data = lt_loc_address_18
  633. et_target_key = DATA(lt_loc_address_18_keys) ).
  634.  
  635. mo_bp_srv->retrieve_by_association(
  636. EXPORTING
  637. iv_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
  638. iv_association = lv_assoc_key_postal_address
  639. iv_fill_data = abap_true
  640. it_key = lt_loc_address_18_keys
  641. IMPORTING
  642. et_data = lt_bofu_addr_post_addr_18 ).
  643.  
  644. *23x поле - получение, 23x поле - заполнение
  645. mo_tor_srv->retrieve_by_association(
  646. EXPORTING
  647. iv_node_key = /scmtms/if_tor_c=>sc_node-root
  648. it_key = it_tor_key
  649. iv_association = /scmtms/if_tor_c=>sc_association-root-bo_tsp_root
  650. iv_fill_data = abap_true
  651. IMPORTING
  652. et_data = lt_tor_bo_tsp_root ).
  653.  
  654. READ TABLE lt_tor_bo_tsp_root INTO DATA(ls_tor_bo_tsp_root_keys) WITH KEY type = '1'.
  655.  
  656. mo_splr_srv->retrieve_by_association(
  657. EXPORTING
  658. iv_node_key = /bofu/if_supplier_c=>sc_node-root
  659. it_key = VALUE #( ( key = ls_tor_bo_tsp_root_keys-key ) )
  660. iv_association = /bofu/if_supplier_c=>sc_association-root-common
  661. iv_fill_data = abap_true
  662. IMPORTING
  663. et_data = lt_splr_common ).
  664.  
  665. READ TABLE lt_splr_common INTO DATA(ls_splr_common) INDEX 1.
  666.  
  667. mo_splr_srv->retrieve_by_association(
  668. EXPORTING
  669. iv_node_key = /bofu/if_supplier_c=>sc_node-root
  670. it_key = VALUE #( ( key = ls_tor_bo_tsp_root_keys-key ) )
  671. iv_association = /bofu/if_supplier_c=>sc_association-root-tax_number
  672. iv_fill_data = abap_true
  673. IMPORTING
  674. et_data = lt_splr_tax_number ).
  675.  
  676. READ TABLE lt_splr_tax_number INTO DATA(ls_splr_tax_number) WITH KEY taxtype = 'RU1'.
  677.  
  678. mo_splr_srv->retrieve_by_association(
  679. EXPORTING
  680. iv_node_key = /bofu/if_supplier_c=>sc_node-root
  681. it_key = VALUE #( ( key = ls_tor_bo_tsp_root_keys-key ) )
  682. iv_association = /bofu/if_supplier_c=>sc_association-root-addressinformation
  683. iv_fill_data = abap_false
  684. IMPORTING
  685. et_target_key = DATA(lt_splr_adressinformation_keys) ).
  686.  
  687. mo_splr_srv->retrieve_by_association(
  688. EXPORTING
  689. iv_node_key = /bofu/if_supplier_c=>sc_node-addressinformation
  690. it_key = lt_splr_adressinformation_keys
  691. iv_association = /bofu/if_supplier_c=>sc_association-addressinformation-/bofu/address
  692. iv_fill_data = abap_false
  693. IMPORTING
  694. et_target_key = DATA(lt_splr_address_23_keys) ).
  695.  
  696. mo_bp_srv->retrieve_by_association(
  697. EXPORTING
  698. iv_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
  699. iv_association = lv_assoc_key_postal_address
  700. iv_fill_data = abap_true
  701. it_key = lt_splr_address_23_keys
  702. IMPORTING
  703. et_data = lt_bofu_addr_postal_addr_23 ).
  704.  
  705. READ TABLE lt_bofu_addr_postal_addr_23 INTO DATA(ls_bofu_addr_postal_addr_23) INDEX 1.
  706.  
  707. SELECT bezei
  708. FROM t005u
  709. INTO CORRESPONDING FIELDS OF TABLE lt_t005u_23x
  710. 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'.
  711.  
  712. READ TABLE lt_t005u_23x INTO DATA(ls_t005u_23x) INDEX 1.
  713.  
  714. mo_bp_srv->retrieve_by_association(
  715. EXPORTING
  716. iv_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
  717. iv_association = lv_assoc_key_telephone
  718. iv_fill_data = abap_true
  719. it_key = lt_splr_address_23_keys
  720. IMPORTING
  721. et_data = lt_bofu_addr_telephone_23 ).
  722.  
  723. READ TABLE lt_bofu_addr_telephone_23 INTO ls_bofu_addr_telephone_23_1 INDEX 1.
  724. READ TABLE lt_bofu_addr_telephone_23 INTO ls_bofu_addr_telephone_23_2 INDEX 2.
  725.  
  726. READ TABLE lt_but0bk INTO DATA(ls_but0bk_23) WITH KEY partner = ls_tor_root-tspid.
  727.  
  728. READ TABLE lt_bnka INTO DATA(ls_bnka_23) WITH KEY banks = ls_but0bk_23-banks bankl = ls_but0bk_23-bankl.
  729.  
  730. 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 } { ',' } {
  731. 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 } { ';' } {
  732. 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 } { ', "БИК" ' } {
  733. ls_bnka_23-bnklz } { ', К\С' } { ls_bnka_23-brnch }|.
  734.  
  735. *25x поле - получение, 25x поле - заполнение
  736. mo_tor_srv->retrieve_by_association(
  737. EXPORTING
  738. iv_node_key = /scmtms/if_tor_c=>sc_node-item_tr
  739. it_key = lt_tor_item_tr_keys
  740. iv_association = /scmtms/if_tor_c=>sc_association-item_tr-bo_resource
  741. iv_fill_data = abap_true
  742. IMPORTING
  743. et_data = lt_tor_bo_resource ).
  744.  
  745. READ TABLE lt_tor_bo_resource INTO DATA(ls_tor_bo_resource) INDEX 1.
  746.  
  747. ls_form-zz25x_vehicle_brand = ls_tor_bo_resource-description.
  748.  
  749. *26x поле - получение
  750. READ TABLE lt_tor_item_tr INTO DATA(ls_tor_item_tr) WITH KEY item_cat = 'AVR'.
  751.  
  752. SPLIT ls_tor_item_tr-tracking_no AT '/' INTO lv_zz26x_reg_nomer_ts lv_zz26x_reg_nomer_pricep.
  753.  
  754. IF lv_zz26x_reg_nomer_pricep IS INITIAL.
  755. ls_form-zz26x_vehicle_reg_number = |{ 'Регистрационный номер: ' } { lv_zz26x_reg_nomer_ts }|.
  756. ELSE.
  757. ls_form-zz26x_vehicle_reg_number = |{ 'Регистрационный номер: ' } { lv_zz26x_reg_nomer_ts } { ', прицеп: ' } { lv_zz26x_reg_nomer_pricep }|.
  758. ENDIF.
  759.  
  760. *28x поле - получение, 28x поле - заполнение
  761. ls_form-zz28x_service_cost_legal_data = ls_form-zz23x_carriers_legal_data.
  762.  
  763. **********************************************************************
  764.  
  765. *17x поле - получение, 17x поле - заполнение, 24x поле - получение, 24x поле - заполнение
  766.  
  767. " 17x
  768. " 6. Прием груза - ФИО водителя
  769. " /SCMTMS/TOR -> ITEM_TR (где ITEM_CAT = DRI) - BO_DRIVER:
  770. " NAME_FIRST, NAME_LAST
  771.  
  772. " ITEM_TR -> BO_DRIVER
  773.  
  774. mo_tor_srv->retrieve_by_association(
  775. EXPORTING
  776. iv_node_key = /scmtms/if_tor_c=>sc_node-item_tr
  777. it_key = lt_tor_item_tr_keys
  778. iv_association = /scmtms/if_tor_c=>sc_association-item_tr-bo_driver
  779. iv_fill_data = abap_true
  780. IMPORTING
  781. et_data = lt_17_itemtr_bodriver
  782. et_target_key = DATA(lt_17_itemtr_bodriver_keys)
  783. et_key_link = DATA(lt_17_item_driver_link_keys)
  784. ).
  785.  
  786. " ITEM_TR (где ITEM_CAT = DRI)
  787.  
  788. LOOP AT lt_17_itemtr_bodriver INTO DATA(ls_17_itemtr_bodriver).
  789. LOOP AT lt_17_item_driver_link_keys INTO DATA(ls_17_item_driver_link_keys)
  790. WHERE target_key = ls_17_itemtr_bodriver-key.
  791. LOOP AT lt_tor_item_tr INTO ls_tor_item_tr
  792. WHERE key = ls_17_item_driver_link_keys-source_key
  793. AND item_cat = 'DRI'.
  794. APPEND ls_17_itemtr_bodriver TO lt_17_itemtr_bodriver_res.
  795. ENDLOOP.
  796. ENDLOOP.
  797. ENDLOOP.
  798.  
  799. IF lt_17_itemtr_bodriver_res[ 1 ] IS NOT INITIAL.
  800. ls_17_itemtr_bodriver = lt_17_itemtr_bodriver_res[ 1 ].
  801. zzvehicle_param = | { ls_17_itemtr_bodriver-name_first } { ' ' } { ls_17_itemtr_bodriver-name_last } |.
  802. ls_form-zz17x_cargo_accept_drivers_ini = zzvehicle_param.
  803. ENDIF.
  804.  
  805. " 24x
  806. " 10. Перевозчик
  807. " ИНН
  808. " «ИНН» /BOFU/BUSINESSPARTNER (где PARTNER = BO_DRIVER - LABOURRES_ID) -
  809. " - TAX_NUMBER(где TAXTYPE = RU1):
  810. " TAXNUMBER
  811.  
  812. " /bofu/businesspartner
  813. " mo_bp_srv = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( /bofu/if_bupa_constants=>sc_bo_key ).
  814.  
  815. LOOP AT lt_17_itemtr_bodriver_res INTO ls_17_itemtr_bodriver.
  816. ls_selpar-low = ls_17_itemtr_bodriver-labourres_id.
  817. ls_selpar-attribute_name = /bofu/if_bupa_constants=>sc_query_attribute-root-query_by_role-partner.
  818. ls_selpar-option = 'EQ'.
  819. ls_selpar-sign = 'I'.
  820. APPEND ls_selpar TO lt_selpar.
  821. ENDLOOP.
  822.  
  823. mo_bp_srv->query(
  824. EXPORTING
  825. iv_query_key = /bofu/if_bupa_constants=>sc_query-root-query_by_role
  826. it_selection_parameters = lt_selpar
  827. IMPORTING
  828. et_key = DATA(lt_fag_party_keys)
  829. ).
  830.  
  831. mo_bupa_srv->retrieve_by_association(
  832. EXPORTING
  833. it_key = lt_fag_party_keys
  834. iv_node_key = /bofu/if_bupa_constants=>sc_node-root
  835. iv_association = /bofu/if_bupa_constants=>sc_association-root-tax_number
  836. iv_fill_data = abap_true
  837. IMPORTING
  838. et_data = lt_bp_taxnum
  839. ).
  840.  
  841. LOOP AT lt_bp_taxnum INTO DATA(ls_bp_taxnum)
  842. WHERE taxtype = 'RU1'.
  843. APPEND ls_bp_taxnum TO lt_bp_taxnum_res.
  844. ENDLOOP.
  845.  
  846. IF lt_bp_taxnum_res[ 1 ] IS NOT INITIAL.
  847. ls_form-zzvehicle_param = lt_bp_taxnum_res[ 1 ]-taxnumber.
  848. ENDIF.
  849.  
  850. " 24x
  851. " 10. Перевозчик - данные о средствах связи (при их наличии) водителя (водителей)
  852. " /SCMTMS/TOR -> ITEM_TR (где ITEM_CAT = DRI) - BO_DRIVER -
  853. " – ADDRESS – TELEPHONE:
  854. " NORMALISED_NUMBER_TEXT
  855. " BO_DRIVER –> ADDRESS
  856. " mo_drv_srm = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( /scmtms/if_driver_c=>sc_bo_key ).
  857. mo_drv_srm->retrieve_by_association(
  858. EXPORTING
  859. iv_node_key = /scmtms/if_driver_c=>sc_node-root
  860. it_key = lt_17_itemtr_bodriver_keys
  861. iv_association = /scmtms/if_driver_c=>sc_association-root-address
  862. iv_fill_data = abap_false
  863. IMPORTING
  864. et_target_key = DATA(lt_bodriver_addr_keys)
  865. ).
  866. " ADDRESS -> TELEPHONE
  867. mo_bp_srv->retrieve_by_association(
  868. EXPORTING
  869. iv_node_key = /bofu/if_bupa_constants=>sc_node-/bofu/address
  870. iv_association = lv_assoc_key_telephone
  871. iv_fill_data = abap_true
  872. it_key = lt_bodriver_addr_keys
  873. IMPORTING
  874. et_data = lt_drv_addr_tel
  875. ).
  876.  
  877. LOOP AT lt_drv_addr_tel INTO DATA(ls_drv_addr_tel).
  878. ls_form-zz24x_inn_phone_numbers = | { ls_form-zz17x_cargo_accept_drivers_ini } { ',' } { ls_form-zzvehicle_param } { ',' } { ls_drv_addr_tel-normalised_number_text } { ' ' }|.
  879. ENDLOOP.
  880.  
  881. * mo_tor_srv->retrieve_by_association(
  882. * EXPORTING
  883. * iv_node_key = /scmtms/if_tor_c=>sc_node-item_tr
  884. * it_key = lt_tor_item_tr_keys
  885. * iv_association = /scmtms/if_tor_c=>sc_association-item_tr-bo_resource
  886. * iv_fill_data = abap_true
  887. * IMPORTING
  888. * et_data = lt_tor_bo_resource ).
  889. *
  890. * APPEND LINES OF lt_tor_item_tr TO lt_tor_item_tr_unique_dri.
  891. *
  892. * DELETE lt_tor_item_tr_unique_dri WHERE item_cat NE 'DRI'.
  893. *
  894. * LOOP AT lt_tor_item_tr_unique_dri INTO DATA(ls_tor_item_tr_unique_dri).
  895. *
  896. * READ TABLE lt_tor_bo_driver INTO DATA(ls_tor_bo_driver) WITH KEY parent_key = ls_tor_item_tr_unique_dri.
  897.  
  898. *22x поле - заполнение
  899. ls_form-zz22x_cargo_deliv_drivers_init = ls_form-zz17x_cargo_accept_drivers_ini.
  900.  
  901. **********************************************************************
  902.  
  903. APPEND LINES OF lt_tor_item_tr TO lt_tor_item_tr_unique.
  904.  
  905. DELETE lt_tor_item_tr_unique WHERE consignee_id IS INITIAL.
  906.  
  907. SORT lt_tor_item_tr_unique BY consignee_id key.
  908.  
  909. DELETE ADJACENT DUPLICATES FROM lt_tor_item_tr_unique COMPARING consignee_id.
  910.  
  911. LOOP AT lt_tor_item_tr_unique INTO DATA(ls_tor_item_tr_unique).
  912.  
  913. *5x поле - заполнение, 6x поле - заполнение
  914. READ TABLE lt_tor_bo_bupa_consignee INTO DATA(ls_tor_bo_bupa_consignee) WITH KEY partner = ls_tor_item_tr_unique-consignee_id.
  915. IF ls_tor_bo_bupa_consignee IS NOT INITIAL.
  916. 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.
  917. IF ls_bofu_addr_postal_addr_5 IS NOT INITIAL.
  918. 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.
  919. IF ls_t005u_5 IS NOT INITIAL.
  920. READ TABLE lt_but0bk INTO DATA(ls_but0bk_5) WITH KEY partner = ls_tor_item_tr_unique-consignee_id.
  921. IF ls_but0bk_5 IS NOT INITIAL.
  922. READ TABLE lt_bnka INTO DATA(ls_bnka_5) WITH KEY banks = ls_but0bk_5-banks bankl = ls_but0bk_5-bankl.
  923. IF ls_bnka_5 IS NOT INITIAL.
  924. READ TABLE lt_bp_common_5 INTO DATA(ls_bupa_common_5) WITH KEY parent_key = ls_tor_bo_bupa_consignee-key.
  925. IF ls_bupa_common_5 IS NOT INITIAL.
  926. 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'.
  927. ENDIF.
  928. ENDIF.
  929. ENDIF.
  930. ENDIF.
  931. ENDIF.
  932. ENDIF.
  933.  
  934.  
  935. IF lt_bofu_address_telephone_5 IS NOT INITIAL.
  936. LOOP AT lt_bofu_address_telephone_5 INTO DATA(ls_bofu_address_telephone).
  937. IF ls_bofu_address_telephone-root_key = ls_tor_bo_bupa_consignee-key.
  938. APPEND ls_bofu_address_telephone TO lt_bofu_addr_tel_sorted.
  939. ENDIF.
  940. ENDLOOP.
  941. ENDIF.
  942.  
  943. READ TABLE lt_bofu_addr_tel_sorted INTO ls_bofu_address_telephone_5_1 INDEX 1.
  944. IF ls_bofu_address_telephone_5_1 IS NOT INITIAL.
  945. READ TABLE lt_bofu_addr_tel_sorted INTO ls_bofu_address_telephone_5_2 INDEX 2.
  946. ENDIF.
  947.  
  948. *5x поле - заполнение
  949. IF ls_tor_bo_bupa_consignee-type = '1'.
  950. 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 } { ',' } {
  951. ls_bofu_addr_postal_addr_5-city_name } { ',' } { ls_bofu_addr_postal_addr_5-street_name } { ls_bofu_addr_postal_addr_5-house_id } { ';' }|.
  952. 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 } { 'в городе' } {
  953. ls_bnka_5-ort01 } { ', "БИК"' } { ls_bnka_5-bnklz } { ', К\С' } { ls_bnka_5-brnch }|.
  954.  
  955. CONCATENATE zzfn_shipper1 zzfn_shipper2
  956. INTO ls_form-zz5x_consignee_individual SEPARATED BY space.
  957.  
  958. *6x поле - заполнение
  959. ELSEIF ls_tor_bo_bupa_consignee-type = '2'.
  960. 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 } { ',' } {
  961. ls_bofu_addr_postal_addr_5-city_name } { ',' } { ls_bofu_addr_postal_addr_5-street_name } { ls_bofu_addr_postal_addr_5-house_id } { ';' }|.
  962. 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 } { 'в городе' } {
  963. ls_bnka_5-ort01 } { ', "БИК"' } { ls_bnka_5-bnklz } { ', К\С' } { ls_bnka_5-brnch }|.
  964.  
  965. CONCATENATE zzname_consignee1 zzname_consignee2
  966. INTO ls_form-zz6x_consignee_entity SEPARATED BY space.
  967. ENDIF.
  968.  
  969. *7x поле - заполнение
  970. CLEAR ls_tor_item_tr.
  971.  
  972. LOOP AT lt_tor_item_tr INTO ls_tor_item_tr.
  973. IF ls_tor_item_tr-consignee_id = ls_tor_item_tr_unique-consignee_id
  974. AND ls_tor_item_tr-item_cat = 'PRD'.
  975. APPEND ls_tor_item_tr TO lt_toritemtrunique_itemcatprd.
  976. ENDIF.
  977. ENDLOOP.
  978.  
  979. DELETE ADJACENT DUPLICATES FROM lt_toritemtrunique_itemcatprd COMPARING ALL FIELDS.
  980.  
  981. LOOP AT lt_toritemtrunique_itemcatprd INTO DATA(ls_toritemtrunique_itemcatprd).
  982. LOOP AT lt_tor_item_tr_link_keys INTO DATA(ls_tor_item_tr_link_keys).
  983. IF ls_tor_item_tr_link_keys-target_key = ls_toritemtrunique_itemcatprd-key.
  984. APPEND ls_tor_item_tr_link_keys TO lt_toritemtr_linkkeysunique.
  985. ENDIF.
  986. ENDLOOP.
  987. ENDLOOP.
  988.  
  989. DELETE ADJACENT DUPLICATES FROM lt_toritemtr_linkkeysunique.
  990.  
  991. LOOP AT lt_toritemtr_linkkeysunique INTO DATA(ls_toritemtr_linkkeysunique).
  992. LOOP AT lt_tor_bo_material_link_keys INTO DATA(ls_tor_bo_material_link_keys).
  993. IF ls_tor_bo_material_link_keys-source_key = ls_toritemtr_linkkeysunique-target_key.
  994. APPEND ls_tor_bo_material_link_keys TO lt_torbomat_linkkeysunique.
  995. ENDIF.
  996. ENDLOOP.
  997. ENDLOOP.
  998.  
  999. DELETE ADJACENT DUPLICATES FROM lt_torbomat_linkkeysunique.
  1000.  
  1001. CLEAR ls_toritemtr_linkkeysunique.
  1002.  
  1003. LOOP AT lt_torbomat_linkkeysunique INTO ls_toritemtr_linkkeysunique.
  1004. LOOP AT lt_tor_bo_material INTO DATA(ls_tor_bo_material).
  1005. IF ls_tor_bo_material-key = ls_toritemtr_linkkeysunique-target_key.
  1006. APPEND ls_tor_bo_material TO lt_tor_bo_material_unique.
  1007. ENDIF.
  1008. ENDLOOP.
  1009. ENDLOOP.
  1010.  
  1011. DELETE ADJACENT DUPLICATES FROM lt_tor_bo_material_unique.
  1012.  
  1013. LOOP AT lt_tor_bo_material_unique INTO DATA(ls_tor_bo_material_unique).
  1014. LOOP AT lt_sapapo_matkey INTO DATA(ls_sapapo_matkey).
  1015. IF ls_sapapo_matkey-matnr = ls_tor_bo_material_unique-internal_id.
  1016. APPEND ls_sapapo_matkey TO lt_sapapo_matkey_unique.
  1017. ENDIF.
  1018. ENDLOOP.
  1019. ENDLOOP.
  1020.  
  1021. DELETE ADJACENT DUPLICATES FROM lt_sapapo_matkey_unique.
  1022.  
  1023. LOOP AT lt_sapapo_matkey_unique INTO DATA(ls_sapapo_matkey_unique).
  1024. LOOP AT lt_zttm_group_mat_t INTO DATA(ls_zttm_group_mat_t).
  1025. IF ls_zttm_group_mat_t-matkl = ls_sapapo_matkey_unique-matkl.
  1026. APPEND ls_zttm_group_mat_t-wgbez TO lt_zz7x_naimenovanie_gruza.
  1027. ENDIF.
  1028. ENDLOOP.
  1029. ENDLOOP.
  1030.  
  1031. SORT lt_zz7x_naimenovanie_gruza.
  1032.  
  1033. DELETE ADJACENT DUPLICATES FROM lt_zz7x_naimenovanie_gruza.
  1034.  
  1035. LOOP AT lt_zz7x_naimenovanie_gruza INTO DATA(ls_zz7x_naimenovanie_gruza).
  1036. IF ls_zz7x_naimenovanie_gruza IS NOT INITIAL.
  1037. ls_form-zz7x_shipping_name = |{ ls_zz7x_naimenovanie_gruza } { ',' } { ls_form-zz7x_shipping_name }|.
  1038. ENDIF.
  1039. ENDLOOP.
  1040.  
  1041. IF ls_form-zz7x_shipping_name IS NOT INITIAL.
  1042. lv_string_length = strlen( ls_form-zz7x_shipping_name ) - 1.
  1043. ls_form-zz7x_shipping_name = ls_form-zz7x_shipping_name+0(lv_string_length).
  1044. ENDIF.
  1045.  
  1046. *8x поле - заполнение
  1047. READ TABLE lt_tor_seal INTO DATA(ls_tor_seal) WITH KEY party_id = ls_tor_item_tr_unique-consignee_id.
  1048.  
  1049. IF ls_tor_seal IS NOT INITIAL.
  1050. lv_qua_pcs_val_all = ls_tor_seal-qua_pcs_val_all.
  1051. ENDIF.
  1052.  
  1053. ls_form-zz8x_cargo_number_of_packages = |{ lv_qua_pcs_val_all } { ls_tor_seal-qua_pcs_uni }|.
  1054.  
  1055. *9x поле - заполнение
  1056. CLEAR ls_toritemtrunique_itemcatprd.
  1057.  
  1058. LOOP AT lt_toritemtrunique_itemcatprd INTO ls_toritemtrunique_itemcatprd.
  1059. IF ls_toritemtrunique_itemcatprd-main_cargo_item NE 'X'.
  1060. lv_zz9x_gruz_massa_brutto = ls_toritemtrunique_itemcatprd-gro_wei_val + lv_zz9x_gruz_massa_brutto.
  1061. ENDIF.
  1062. ENDLOOP.
  1063.  
  1064. ls_form-zz9x_cargo_gross_weight = |{ lv_zz9x_gruz_massa_brutto } { ls_toritemtrunique_itemcatprd-gro_wei_uni }|.
  1065.  
  1066. *14x поле - заполнение
  1067. CLEAR ls_tor_item_tr.
  1068.  
  1069. LOOP AT lt_tor_item_tr INTO ls_tor_item_tr.
  1070. IF ls_tor_item_tr-consignee_id = ls_tor_item_tr_unique-consignee_id AND ls_tor_item_tr-item_cat = 'TUR'.
  1071. APPEND ls_tor_item_tr TO lt_toritemtrunique_itemcattur.
  1072. ENDIF.
  1073. ENDLOOP.
  1074.  
  1075. CLEAR ls_tor_seal.
  1076.  
  1077. LOOP AT lt_tor_seal INTO ls_tor_seal.
  1078. IF ls_tor_seal-party_id = ls_tor_item_tr_unique-consignee_id AND ls_tor_seal-seal_number IS NOT INITIAL.
  1079. lv_zz14x_priem_gruza_plomba = |{ 'Пломба №' } { ls_tor_seal-seal_number }|.
  1080. ENDIF.
  1081. ENDLOOP.
  1082.  
  1083. LOOP AT lt_toritemtrunique_itemcattur INTO DATA(ls_toritemtrunique_itemcattur).
  1084. IF ls_toritemtrunique_itemcattur-res_id IS NOT INITIAL.
  1085. lv_zz14x_priem_gruza_konteiner = |{ lv_zz14x_priem_gruza_konteiner } { 'контейнер №' } { ls_toritemtrunique_itemcattur-res_id } { ',' }|.
  1086. ENDIF.
  1087. ENDLOOP.
  1088.  
  1089. IF lv_zz14x_priem_gruza_konteiner IS NOT INITIAL.
  1090. lv_zz14x_priem_gruza_konteiner = |{ '\' } { lv_zz14x_priem_gruza_konteiner }|.
  1091.  
  1092. lv_string_length = strlen( lv_zz14x_priem_gruza_konteiner ) - 1.
  1093. lv_zz14x_priem_gruza_konteiner = lv_zz14x_priem_gruza_konteiner+0(lv_string_length).
  1094.  
  1095. ENDIF.
  1096.  
  1097. ls_form-zz14x_cargo_accept_seal_contai = |{ lv_zz14x_priem_gruza_plomba } { ' ' } { lv_zz14x_priem_gruza_konteiner }|.
  1098.  
  1099. *15x поле - заполнение
  1100. ls_form-zz15x_cargo_accept_gross_weigh = ls_form-zz9x_cargo_gross_weight.
  1101.  
  1102. *16x поле - заполнение
  1103. ls_form-zz16x_cargo_accept_packages_nu = ls_form-zz8x_cargo_number_of_packages.
  1104.  
  1105. *18x поле - заполнение
  1106. LOOP AT lt_tor_bo_loc_log_18 INTO DATA(ls_tor_bo_loc_log_18).
  1107. IF ls_tor_bo_loc_log_18-business_partner_id = ls_tor_item_tr_unique-consignee_id.
  1108. LOOP AT lt_tor_bo_loc_log_18_keys INTO DATA(ls_tor_bo_loc_log_18_keys).
  1109. IF ls_tor_bo_loc_log_18_keys-key = ls_tor_bo_loc_log_18-key.
  1110. APPEND ls_tor_bo_loc_log_18_keys TO lt_tor_boloclog18keys_unique.
  1111. ENDIF.
  1112. ENDLOOP.
  1113. ENDIF.
  1114. ENDLOOP.
  1115.  
  1116. LOOP AT lt_loc_address_18 INTO DATA(ls_loc_address_18).
  1117. LOOP AT lt_tor_boloclog18keys_unique INTO DATA(ls_tor_boloclog18keys_unique).
  1118. IF ls_loc_address_18-parent_key = ls_tor_boloclog18keys_unique-key.
  1119. APPEND ls_loc_address_18 TO lt_loc_address_18_unique.
  1120. ENDIF.
  1121. ENDLOOP.
  1122. ENDLOOP.
  1123.  
  1124. LOOP AT lt_bofu_addr_post_addr_18 INTO DATA(ls_bofu_addr_post_addr_18).
  1125. LOOP AT lt_loc_address_18_unique INTO DATA(ls_loc_address_18_unique).
  1126. IF ls_bofu_addr_post_addr_18-root_key = ls_loc_address_18_unique-root_key.
  1127. SELECT bezei
  1128. FROM t005u
  1129. INTO CORRESPONDING FIELDS OF TABLE lt_t005u
  1130. 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'.
  1131.  
  1132. READ TABLE lt_t005u INTO ls_t005u INDEX 1.
  1133.  
  1134. 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 }|.
  1135. ENDIF.
  1136. ENDLOOP.
  1137. ENDLOOP.
  1138.  
  1139. *19x поле - заполнение
  1140. ls_form-zz19x_cargo_deliv_seal_contain = ls_form-zz14x_cargo_accept_seal_contai.
  1141.  
  1142. *20x поле - заполнение
  1143. ls_form-zz20x_cargo_deliv_gross_weight = ls_form-zz9x_cargo_gross_weight.
  1144.  
  1145. *21x поле - заполнение
  1146. ls_form-zz21x_cargo_deliv_packages_num = ls_form-zz8x_cargo_number_of_packages.
  1147.  
  1148. APPEND ls_form TO et_body.
  1149.  
  1150. CLEAR:
  1151. lt_bofu_addr_tel_sorted,
  1152. lt_toritemtrunique_itemcatprd,
  1153. lt_toritemtr_linkkeysunique,
  1154. lt_torbomat_linkkeysunique,
  1155. lt_tor_bo_material_unique,
  1156. lt_sapapo_matkey_unique,
  1157. lt_toritemtrunique_itemcattur,
  1158. lt_tor_boloclog18keys_unique,
  1159. lt_loc_address_18_unique,
  1160. lt_zz7x_naimenovanie_gruza,
  1161.  
  1162. ls_bofu_address_telephone_5_1,
  1163. ls_bofu_address_telephone_5_2,
  1164.  
  1165. lv_zz9x_gruz_massa_brutto,
  1166. lv_zz14x_priem_gruza_plomba,
  1167. lv_zz14x_priem_gruza_konteiner,
  1168.  
  1169. zzfn_shipper1,
  1170. zzfn_shipper2,
  1171. zzname_consignee1,
  1172. zzname_consignee2,
  1173.  
  1174. ls_tor_bo_bupa_consignee,
  1175. ls_bofu_addr_postal_addr_5,
  1176. ls_t005u_5,
  1177. ls_but0bk_5,
  1178. ls_bnka_5,
  1179. ls_bupa_common_5,
  1180. ls_bupa_tax_number_5,
  1181. ls_bofu_address_telephone,
  1182. ls_bofu_address_telephone_5_1,
  1183. ls_bofu_address_telephone_5_2,
  1184. ls_tor_item_tr,
  1185. ls_toritemtrunique_itemcatprd,
  1186. ls_tor_item_tr_link_keys,
  1187. ls_toritemtr_linkkeysunique,
  1188. ls_tor_bo_material_link_keys,
  1189. ls_tor_bo_material,
  1190. ls_tor_bo_material_unique,
  1191. ls_sapapo_matkey,
  1192. ls_sapapo_matkey_unique,
  1193. ls_zttm_group_mat_t,
  1194. ls_zz7x_naimenovanie_gruza,
  1195. ls_tor_seal,
  1196. ls_toritemtrunique_itemcattur,
  1197. ls_tor_bo_loc_log_18,
  1198. ls_tor_bo_loc_log_18_keys,
  1199. ls_loc_address_18,
  1200. ls_tor_boloclog18keys_unique,
  1201. ls_bofu_addr_post_addr_18,
  1202. ls_loc_address_18_unique,
  1203. ls_t005u,
  1204.  
  1205. ls_form-zz5x_consignee_individual,
  1206. ls_form-zz6x_consignee_entity,
  1207. ls_form-zz7x_shipping_name,
  1208. ls_form-zz8x_cargo_number_of_packages,
  1209. ls_form-zz9x_cargo_gross_weight,
  1210. ls_form-zz14x_cargo_accept_seal_contai,
  1211. ls_form-zz15x_cargo_accept_gross_weigh,
  1212. ls_form-zz16x_cargo_accept_packages_nu,
  1213. ls_form-zz18x_cargo_deliv_actual_addr,
  1214. ls_form-zz19x_cargo_deliv_seal_contain,
  1215. ls_form-zz20x_cargo_deliv_gross_weight,
  1216. ls_form-zz21x_cargo_deliv_packages_num.
  1217. ENDLOOP.
  1218.  
  1219. ENDMETHOD.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement