SAP FCO_DOCUMENT_CANCEL Function Module for









FCO_DOCUMENT_CANCEL is a standard fco document cancel SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.


See here to view full function module documentation and code listing for fco document cancel FM, simply by entering the name FCO_DOCUMENT_CANCEL into the relevant SAP transaction such as SE37 or SE38.

Function Group: FCO_DOCUMENT
Program Name: SAPLFCO_DOCUMENT
Main Program: SAPLFCO_DOCUMENT
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function FCO_DOCUMENT_CANCEL pattern details

In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.
CALL FUNCTION 'FCO_DOCUMENT_CANCEL'"
EXPORTING
I_BELNR_TO_CANCEL = "

IMPORTING
E_BELNR_CANCEL = "
E_SEQ_BELNR_CANCEL = "
E_BELNR_CANCEL_TO = "

TABLES
ET_RETURN = "
ET_CPZP_GR = "

EXCEPTIONS
DOCUMENT_NOT_FOUND = 1 CANCEL_NOT_ALLOWED = 2 CANCELLED_DOCUMENT = 3 CANCEL_DOCUMENT = 4 NO_DOCUMENT_NUMBER = 5 INTERNAL_ERROR = 6 LOCKED = 7 ERROR_IN_SEQ_DOC = 8 ERROR_AT_GR_CANC = 9
.



IMPORTING Parameters details for FCO_DOCUMENT_CANCEL

I_BELNR_TO_CANCEL -

Data type: FCO_BELNR
Optional: No
Call by Reference: Yes

EXPORTING Parameters details for FCO_DOCUMENT_CANCEL

E_BELNR_CANCEL -

Data type: FCO_BELNR
Optional: No
Call by Reference: Yes

E_SEQ_BELNR_CANCEL -

Data type: FCO_SEQUENCE_BELNR
Optional: No
Call by Reference: Yes

E_BELNR_CANCEL_TO -

Data type: FCO_BELNR
Optional: No
Call by Reference: Yes

TABLES Parameters details for FCO_DOCUMENT_CANCEL

ET_RETURN -

Data type: BAPIRET2
Optional: No
Call by Reference: Yes

ET_CPZP_GR -

Data type: CPZP
Optional: No
Call by Reference: Yes

EXCEPTIONS details

DOCUMENT_NOT_FOUND -

Data type:
Optional: No
Call by Reference: Yes

CANCEL_NOT_ALLOWED -

Data type:
Optional: No
Call by Reference: Yes

CANCELLED_DOCUMENT -

Data type:
Optional: No
Call by Reference: Yes

CANCEL_DOCUMENT -

Data type:
Optional: No
Call by Reference: Yes

NO_DOCUMENT_NUMBER -

Data type:
Optional: No
Call by Reference: Yes

INTERNAL_ERROR -

Data type:
Optional: No
Call by Reference: Yes

LOCKED -

Data type:
Optional: No
Call by Reference: Yes

ERROR_IN_SEQ_DOC -

Data type:
Optional: No
Call by Reference: Yes

ERROR_AT_GR_CANC -

Data type:
Optional: No
Call by Reference: Yes

Copy and paste ABAP code example for FCO_DOCUMENT_CANCEL Function Module

The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.

DATA:
lt_et_return  TYPE STANDARD TABLE OF BAPIRET2, "   
lv_e_belnr_cancel  TYPE FCO_BELNR, "   
lv_i_belnr_to_cancel  TYPE FCO_BELNR, "   
lv_document_not_found  TYPE FCO_BELNR, "   
lt_et_cpzp_gr  TYPE STANDARD TABLE OF CPZP, "   
lv_cancel_not_allowed  TYPE CPZP, "   
lv_e_seq_belnr_cancel  TYPE FCO_SEQUENCE_BELNR, "   
lv_e_belnr_cancel_to  TYPE FCO_BELNR, "   
lv_cancelled_document  TYPE FCO_BELNR, "   
lv_cancel_document  TYPE FCO_BELNR, "   
lv_no_document_number  TYPE FCO_BELNR, "   
lv_internal_error  TYPE FCO_BELNR, "   
lv_locked  TYPE FCO_BELNR, "   
lv_error_in_seq_doc  TYPE FCO_BELNR, "   
lv_error_at_gr_canc  TYPE FCO_BELNR. "   

  CALL FUNCTION 'FCO_DOCUMENT_CANCEL'  "
    EXPORTING
         I_BELNR_TO_CANCEL = lv_i_belnr_to_cancel
    IMPORTING
         E_BELNR_CANCEL = lv_e_belnr_cancel
         E_SEQ_BELNR_CANCEL = lv_e_seq_belnr_cancel
         E_BELNR_CANCEL_TO = lv_e_belnr_cancel_to
    TABLES
         ET_RETURN = lt_et_return
         ET_CPZP_GR = lt_et_cpzp_gr
    EXCEPTIONS
        DOCUMENT_NOT_FOUND = 1
        CANCEL_NOT_ALLOWED = 2
        CANCELLED_DOCUMENT = 3
        CANCEL_DOCUMENT = 4
        NO_DOCUMENT_NUMBER = 5
        INTERNAL_ERROR = 6
        LOCKED = 7
        ERROR_IN_SEQ_DOC = 8
        ERROR_AT_GR_CANC = 9
. " FCO_DOCUMENT_CANCEL




ABAP code using 7.40 inline data declarations to call FM FCO_DOCUMENT_CANCEL

The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!