Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

bapi_billing_cancel1 execution problem

Former Member
0 Likes
1,845

When I call bapi_billing_cancel1 for a particular billing document number 'xxxxxx', i get the error document does not exist. But if I go to se37 and execute bapi_billing_cancel1 on the SAME document number 'xxxxxx', the billing document gets cancelled succesfully. How can i make it work from the report itself??

Any help is greatly appreciated.

Below is my code:

REPORT ZBAPIBILLINBGTEST message-id bapiret2-id.

----


  • Internal tables for BAPI Function Module

----


DATA : i_berr LIKE BAPIRETURN1 OCCURS 0 with HEADER LINE,

i_bsuccess like BAPIVBRKSUCCESS occurs 0 with HEADER LINE,

i_cret2 like bapiret2.

----


DATA: z_inv TYPE BAPIVBRKSUCCESS-BILL_DOC VALUE '90059595'.

CALL FUNCTION 'BAPI_BILLINGDOC_CANCEL1'

EXPORTING

BILLINGDOCUMENT = '90059595'

  • TESTRUN = 'X'

  • NO_COMMIT = 'X'

  • BILLINGDATE =

TABLES

RETURN = i_berr

SUCCESS = i_bsuccess.

LOOP AT i_berr.

WRITE: / 'message ', i_berr-type, i_berr-id, i_berr-number, i_berr-message.

ENDLOOP.

LOOP AT i_bsuccess.

WRITE: / 'BILING DOC', i_bsuccess-BILL_DOC.

ENDLOOP.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = space

IMPORTING

RETURN = i_cret2.

if sy-subrc ne 0.

message i005 with z_inv.

stop.

endif.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,294

Run the billing document through CONVERSION_EXIT_ALPHA_INPUT or just pad it to the left with two zeroes.

Rob

2 REPLIES 2
Read only

Former Member
0 Likes
1,295

Run the billing document through CONVERSION_EXIT_ALPHA_INPUT or just pad it to the left with two zeroes.

Rob

Read only

0 Likes
1,294

Great help. The problem is solved.