采购订单审批BAPI ---BAPI_PO_RELEASE
REPORT z_release_po.
DATA gc_frggr LIKE ekko-frggr. "Release Group
DATA gc_frgsx LIKE ekko-frgsx. "Release Strategy
DATA gc_frgke LIKE ekko-frgke. "Release Status.
DATA ret_code LIKE sy-subrc.
DATA msg(255) TYPE c.
DATA: gt_t16fs LIKE t16fs OCCURS 0 WITH HEADER LINE.
DATA: gc_new_status LIKE bapimmpara-rel_status.
DATA: gc_indicator_new LIKE bapimmpara-po_rel_ind.
DATA: gt_log LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: gc_no_commit LIKE bapimmpara-selection.
DATA: et_log LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA:BEGIN OF it_po_rel_code OCCURS 0,
rel_code TYPE frgco,
END OF it_po_rel_code.
SELECTION-SCREEN BEGIN OF BLOCK block WITH FRAME TITLE title.
PARAMETERS:po_num LIKE ekko-ebeln,"采购订单号
rel_code TYPE frgco."审批代码
SELECTION-SCREEN END OF BLOCK block.
SELECT SINGLE ekko~frgke INTO gc_frgke FROM ekko WHERE ekko~ebeln = po_num.
IF gc_frgke = '1'.
ret_code = -1.
CONCATENATE: po_num '已经通过审核' INTO msg.
* EXIT.
ELSE.
SELECT SINGLE ekko~frggr ekko~frgsx INTO (gc_frggr,gc_frgsx) FROM ekko WHERE ekko~ebeln = po_num.
IF ( gc_frggr IS NOT INITIAL ) AND ( gc_frgsx IS NOT INITIAL ).
REFRESH gt_t16fs.
CLEAR gt_t16fs.
SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_t16fs FROM t16fs WHERE t16fs~frggr = gc_frggr AND t16fs~frgsx = gc_frgsx.
ELSE.
ret_code = -1.
msg ='未找到对应审批策略,请检查输入'.
EXIT.
ENDIF.
IF rel_code IS NOT INITIAL.
CLEAR gc_new_status.
CLEAR gc_indicator_new.