ABAP-VF11冲销发票BAPI

 1 *开票bapi参数
 2 DATA: gv_number  TYPE bapivbrksuccess-bill_doc,
 3       gt_success TYPE TABLE OF bapivbrksuccess,
 4       gs_success TYPE bapivbrksuccess,
 5       gt_return2 TYPE TABLE OF bapiret1,
 6       gs_return2 TYPE bapiret1,
 7       zmsg       TYPE char255 .
 8       
 9 REFRESH gt_return2 .
10 REFRESH gt_success .
11 
12 CALL FUNCTION 'BAPI_BILLINGDOC_CANCEL1'
13   EXPORTING
14     billingdocument = gv_number"发票号
15 *    TESTRUN         =
16 *    NO_COMMIT       =
17 *    BILLINGDATE     =
18   TABLES
19     return          = gt_return2
20     success         = gt_success.
21 
22 IF gt_success IS INITIAL.
23 
24   CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
25   LOOP AT gt_return2 INTO gs_return2 WHERE type CA 'EA' .
26     IF zmsg IS INITIAL .
27       zmsg = gs_return2-message .
28     ELSE .
29       zmsg = gs_return2-message && '/' &&  zmsg .
30     ENDIF .
31   ENDLOOP .
32 
33 ELSE.
34 
35   CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
36     EXPORTING
37       wait = 'X'.
38 
39 ENDIF .
posted @ 2022-05-26 11:07  TigerMan  阅读(303)  评论(0编辑  收藏  举报