
*-- Read the Freight Order and Freight Unit data
CALL METHOD io_read->retrieve(
EXPORTING
it_key = it_key
iv_node = /scmtms/if_tor_c=>sc_node-root
IMPORTING
et_data = lt_d_root ). " This will have FO and FU data
*-- Get the Key of Freight Order, freight Booking and freight Unit
LOOP AT lt_d_root ASSIGNING FIELD-SYMBOL(<lfs_d_root>).
CASE <lfs_d_root>-tor_cat.
WHEN 'TO' . "Freight Order ( Road)
IF <lfs_d_root>-mtr IS INITIAL.
" If Means of Transport is initial, then only consider it for processing
lt_fo_key = VALUE #( BASE lt_fo_key
( key = <lfs_d_root>-key ) ).
ENDIF.
WHEN 'BO'. "Freight Booking (Sea)
IF <lfs_d_root>-mtr IS INITIAL.
" If Means of Transport is initial, then only consider it for processing
lt_fb_key = VALUE #( BASE lt_fo_key
( key = <lfs_d_root>-key ) ).
ENDIF.
WHEN 'FU'. "Freight Unit
lt_fu_key = VALUE #( BASE lt_fu_key
( key = <lfs_d_root>-key ) ).
APPEND <lfs_d_root> TO lt_d_freight_unit_root.
WHEN OTHERS.
ENDCASE.
ENDLOOP.
" Get the Delivery Number
DATA(lv_delivery_no) = VALUE vbeln( lt_d_freight_unit_root[ 1 ]-labeltxt OPTIONAL ) .
IF lv_delivery_no IS NOT INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_delivery_no
IMPORTING
output = lv_delivery_no.
DATA : lt_likp TYPE STANDARD TABLE OF likp.
CALL FUNCTION 'LIKP_READ'
EXPORTING
i_vbeln = lv_delivery_no
TABLES
e_likp = lt_likp
EXCEPTIONS
no_entry_found = 1
OTHERS = 2.
IF sy-subrc = 0.
DATA(lv_sdabw) = VALUE #( lt_likp[ 1 ]-sdabw OPTIONAL ).
ENDIF.
ENDIF.
SELECT SINGLE mtr
INTO @DATA(lv_mtr)
FROM ztm_mtr_mapping
WHERE sdabw = @lv_sdabw.
IF sy-subrc = 0 AND lv_mtr IS NOT INITIAL.
data lt_item_tr_data TYPE /scmtms/t_tor_item_tr_k.
CALL METHOD io_read->retrieve_by_association
EXPORTING
iv_node = /scmtms/if_tor_c=>sc_node-root
it_key = lt_fo_key
iv_association = /scmtms/if_tor_c=>sc_association-root-item_tr
iv_fill_data = abap_true
IMPORTING
et_target_key = DATA(lt_fo_tem_tr_key)
et_data = lt_item_tr_data
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
CLEAR lt_item_tr_data.
ENDIF.
DATA : ls_root TYPE /scmtms/s_tor_item_tr_k,
lt_chg_fields TYPE /bobf/t_frw_name,
lt_mod TYPE /bobf/t_frw_modification.
*-- Create the Update table
CLEAR lt_chg_fields.
INSERT /scmtms/if_tor_c=>sc_node_attribute-item_tr-mtr INTO TABLE lt_chg_fields.
LOOP AT lt_order_item_data INTO DATA(ls_fo_item_data).
ls_root = CORRESPONDING #( ls_fo_item_data ) .
ls_root-mtr = lv_mtr. "UPDATE MTR here
IF ls_root IS NOT INITIAL.
/scmtms/cl_mod_helper=>mod_update_single(
EXPORTING
is_data = ls_root
it_changed_fields = lt_chg_fields
iv_key = ls_root-key
iv_node = /scmtms/if_tor_c=>sc_node-item_tr
CHANGING
ct_mod = lt_mod ).
ENDIF.
ENDLOOP.
IF lt_mod IS NOT INITIAL.
io_modify->do_modify(
EXPORTING
it_modification = lt_mod ).
io_modify->end_modify( IMPORTING eo_message = lo_message
eo_change = lo_change ).
ENDIF. "lt_mod IS NOT INITIAL.
Freight Order Screen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |