采购订单自动审批
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.
********<<<<<<<<<<<自动审批
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.
********<<<<<<<<<<<自动审批
相关文章推荐
- SAP 采购订单上的总账科目如何自动带出来
- PR自动创建PO采购订单:强制按照PR行进行分组
- 自动生成采购订单号
- SAP收货时自动创建采购订单
- SAP 采购订单打印完后不可以取消审批
- 调用BAPI审批/取消审批采购订单
- SAP 采购订单上的总账科目如何自动带出来
- BAPI_PO_RESET_RELEASE---取消采购订单审批
- SAP 采购订单打印完后不可以取消审批
- ME21N采购订单创建后自动通过IDOC发送至ORACLE数据库
- SAP收货时自动创建采购订单(或106 ,自动建立退货采购订单)
- 采购订单审批后,价格不允许更改
- 采购订单的审批状态异常的处理,审批状态为:预审批或是处理中的单据
- 采购订单审批BAPI ---BAPI_PO_RELEASE
- 采购订单审批状态及关闭状态快码查询
- ME59N 自动创建采购订单的凭证类型NB变更为指定类型Zxxx
- SAP MM 用户不希望采购订单一旦Release就自动打印输出,如何控制?
- SAP 采购订单打印完后不可以取消审批
- 自动创建采购订单
- 采购订单的审批制作完整版