Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

bapi_billing_cancel1 execution problem

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.

Tags:
replied

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

Rob

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question