Advertisement
hxxxrz

Untitled

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