PPDS修改订单

/SAPAPO/RRP_ORD_CHANGE_EPP

form frm_chg_order using uv_orderid type /sapapo/orderid

uv_plnum type plaf-plnum

uv_camng type ztpp062-camng

changing cv_msgty type msgty

cv_msgtx type msgtx.

data:

lv_orderid type /sapapo/orderid,

ls_exclude_fields type /sapapo/om_exclude_fields,

ls_output type /sapapo/om_io_pp,

lt_output type /sapapo/om_io_pp_tab,

ls_ch_ord type /sapapo/rrp_ord_change_str,

lt_ch_ord type /sapapo/rrp_ord_change_tab,

lt_changed_orders type /sapapo/rrp_ord_change_tab,

lv_simsession type /sapapo/om_simsession,

lt_messages type bapirettab,

lt_capreq type /sapapo/om_cap_req_pt_tab.

lv_orderid = uv_orderid.

* perform frm_get_orderid using uv_plnum changing lv_orderid.

* if lv_orderid is initial.

* cv_msgty = 'E'.

* cv_msgtx = '未找到计划订单ID'(016).

* return.

* endif.

call function '/SAPAPO/RRP_SIMSESSION_CREATE'

exporting

iv_simid = '000'

iv_change_mode = ''

importing

ev_simsession = lv_simsession.

call function '/SAPAPO/EINT_SETTINGS_SET'

exporting

i_pp_strat_prf_id = 'ZSAP002'

i_get_exact_profile = abap_true

exceptions

setting_overall_profile_failed = 1.

select single gsmng

into @data(lv_gsmng)

from plaf

where plnum eq @uv_plnum.

ls_exclude_fields-slacktime = 'X'.

ls_exclude_fields-devquantity = 'X'.

call function '/SAPAPO/RRP_LC_ORDER_GET_DATA'

exporting

iv_order = lv_orderid

is_exclude_fields = ls_exclude_fields

iv_simversion = '000'

importing

et_ext_outputs = lt_output

exceptions

error_message = 1.

call function '/SAPAPO/OM_MESSAGES_INITIALIZE'.

read table lt_output index 1 into ls_output.

if sy-subrc ne 0.

cv_msgty = 'E'.

cv_msgtx = 'PPDS计划订单未找到'(017).

return.

endif.

if uv_camng lt lv_gsmng.

clear ls_ch_ord.

ls_ch_ord-method = 'CRCQ'.

ls_ch_ord-pegid = ls_output-pegid.

ls_ch_ord-ordid = lv_orderid.

ls_ch_ord-position_no = ls_output-position_no.

ls_ch_ord-line_no = ls_output-line_no.

ls_ch_ord-is_input_node = ls_output-is_input_node.

* ls_ch_ord-old_real_quan = lv_gsmng.

ls_ch_ord-old_real_quan = ls_output-real_quantity.

ls_ch_ord-real_quantity = floor( ls_output-real_quantity - ls_output-real_quantity * uv_camng / ls_output-quantity ).

append ls_ch_ord to lt_ch_ord.

else.

clear ls_ch_ord.

ls_ch_ord-method = 'DRC'.

ls_ch_ord-ordid = lv_orderid.

ls_ch_ord-pegid = ls_output-pegid.

append ls_ch_ord to lt_ch_ord.

endif.

call function '/SAPAPO/RRP_ORD_CHANGE_EPP'

exporting

it_chg_orders = lt_ch_ord

iv_simid = '000'

importing

et_changed_orders = lt_changed_orders

et_messages = lt_messages

et_capreq = lt_capreq.

read table lt_messages with key type = 'E' transporting no fields.

if sy-subrc eq 0.

rollback work.

perform frm_exception_msg_add tables lt_messages

changing cv_msgty cv_msgtx.

else.

call function '/SAPAPO/TSIM_SIMULATION_MERGE'

exporting

i_synchron = 'X'

i_dialog_mode = ''

exceptions

error_message = 0

lc_error = 1

others = 2.

if sy-subrc eq 0.

commit work and wait.

cv_msgty = 'S'.

else.

rollback work.

cv_msgty = 'E'.

message id sy-msgid type 'E' number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 into cv_msgtx.

endif.

endif.

endform.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值