您的位置:首页 > 其它

采购订单自动审批

2011-09-15 10:54 447 查看
*根据订单号获取采购订单信息

select single * from ekko

where ebeln = lt_zcmisconrela-zerporderno.

purchaseorder = lt_zcmisconrela-zerporderno.

********>>>>>>>>>>自动审批

*根据采购订单的审批组和审批策略获取具体的审批流程代码

select single *

from t16fs

where frggr = ekko-frggr

and frgsx = ekko-frgsx.

do 8 times.

num = num + 1.

*逐级获取审批代码

if num = 1.

po_rel_code = t16fs-FRGC1.

elseif num = 2.

po_rel_code = t16fs-FRGC2.

elseif num = 3.

po_rel_code = t16fs-FRGC3.

elseif num = 4.

po_rel_code = t16fs-FRGC4.

elseif num = 5.

po_rel_code = t16fs-FRGC5.

elseif num = 6.

po_rel_code = t16fs-FRGC6.

elseif num = 7.

po_rel_code = t16fs-FRGC7.

elseif num = 8.

po_rel_code = t16fs-FRGC8.

endif.

if po_rel_code <> ''.

*调用系统的BAPI 根据订单号和审批代码审批采购订单

call function 'BAPI_PO_RELEASE'

exporting

purchaseorder = purchaseorder

po_rel_code = po_rel_code

use_exceptions = 'X'

importing

rel_status_new = rel_status_new

rel_indicator_new = rel_indicator_new

tables

return = return

exceptions

authority_check_fail = 1

document_not_found = 2

enqueue_fail = 3

prerequisite_fail = 4

release_already_posted = 5

responsibility_fail = 6

others = 7.

endif.

enddo.

num = 0.

********<<<<<<<<<<<自动审批
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: