SAP Function Modules

BAPI_CTRACDOCUMENT_WRITEOFF SAP Function module - BAPI: Write Off FI-CA Document







BAPI_CTRACDOCUMENT_WRITEOFF is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name BAPI_CTRACDOCUMENT_WRITEOFF into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: FKK_BOR_DOC
Released Date: 11.09.2002
Processing type: Remote-Enabled
remote enabled module settings


Pattern for FM BAPI_CTRACDOCUMENT_WRITEOFF - BAPI CTRACDOCUMENT WRITEOFF





CALL FUNCTION 'BAPI_CTRACDOCUMENT_WRITEOFF' "BAPI: Write Off FI-CA Document
  EXPORTING
    documentnumber =            " bapidfkkko-doc_no  Number of a Contract Accounts Receivable and Payable Document
*   posting_date =              " bapirfka1-post_date  Posting Date in the Document
*   currency =                  " bapirfka1-currency  Currency Key
*   doc_type =                  " bapirfka1-doc_type  Document Type
*   fikey =                     " bapirfka1-fikey  Reconciliation Key for General Ledger
    charge_off_reason =         " bapidfkkko-charge_off_reason  Write-Off Reason
*   no_checks = SPACE           " bapirfka1-no_checks  Write-Off without Check Rules
*   transfer_to_coll = SPACE    " bapirfka1-transfer_to_coll  Submission to Collection Agency
*   application_fields =        " bapirfka1     BAPI: Application Fields for Write-Off
*   created_by =                " bapidfkkko-created_by  Name of Person Who Created Object
  IMPORTING
    return =                    " bapiret2      Return Parameters
    ret_documentnumber =        " bapidfkkko-doc_no  Number of a Contract Accounts Receivable and Payable Document
* TABLES
*   openitems =                 " bapidfkkcl    Clearing Items for Document in Contract A/R + A/P
*   extensionin =               " bapiparex     Reference Structure for BAPI Parameters ExtensionIn/ExtensionOut
    .  "  BAPI_CTRACDOCUMENT_WRITEOFF

ABAP code example for Function Module BAPI_CTRACDOCUMENT_WRITEOFF





The ABAP code below is a full code listing to execute function module BAPI_CTRACDOCUMENT_WRITEOFF including all data declarations. The code uses 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 original method of declaring data variables up front. 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).

DATA:
ld_return  TYPE BAPIRET2 ,
ld_ret_documentnumber  TYPE BAPIDFKKKO-DOC_NO ,
it_openitems  TYPE STANDARD TABLE OF BAPIDFKKCL,"TABLES PARAM
wa_openitems  LIKE LINE OF it_openitems ,
it_extensionin  TYPE STANDARD TABLE OF BAPIPAREX,"TABLES PARAM
wa_extensionin  LIKE LINE OF it_extensionin .


DATA(ld_documentnumber) = some text here

DATA(ld_posting_date) = 20210129

DATA(ld_currency) = Check type of data required

DATA(ld_doc_type) = some text here

DATA(ld_fikey) = some text here

DATA(ld_charge_off_reason) = some text here

DATA(ld_no_checks) = some text here

DATA(ld_transfer_to_coll) = some text here
DATA(ld_application_fields) = 'Check type of data required'.

DATA(ld_created_by) = some text here

"populate fields of struture and append to itab
append wa_openitems to it_openitems.

"populate fields of struture and append to itab
append wa_extensionin to it_extensionin. . CALL FUNCTION 'BAPI_CTRACDOCUMENT_WRITEOFF' EXPORTING documentnumber = ld_documentnumber * posting_date = ld_posting_date * currency = ld_currency * doc_type = ld_doc_type * fikey = ld_fikey charge_off_reason = ld_charge_off_reason * no_checks = ld_no_checks * transfer_to_coll = ld_transfer_to_coll * application_fields = ld_application_fields * created_by = ld_created_by IMPORTING return = ld_return ret_documentnumber = ld_ret_documentnumber * TABLES * openitems = it_openitems * extensionin = it_extensionin . " BAPI_CTRACDOCUMENT_WRITEOFF
IF SY-SUBRC EQ 0. "All OK ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_return  TYPE BAPIRET2 ,
ld_documentnumber  TYPE BAPIDFKKKO-DOC_NO ,
it_openitems  TYPE STANDARD TABLE OF BAPIDFKKCL ,
wa_openitems  LIKE LINE OF it_openitems,
ld_ret_documentnumber  TYPE BAPIDFKKKO-DOC_NO ,
ld_posting_date  TYPE BAPIRFKA1-POST_DATE ,
it_extensionin  TYPE STANDARD TABLE OF BAPIPAREX ,
wa_extensionin  LIKE LINE OF it_extensionin,
ld_currency  TYPE BAPIRFKA1-CURRENCY ,
ld_doc_type  TYPE BAPIRFKA1-DOC_TYPE ,
ld_fikey  TYPE BAPIRFKA1-FIKEY ,
ld_charge_off_reason  TYPE BAPIDFKKKO-CHARGE_OFF_REASON ,
ld_no_checks  TYPE BAPIRFKA1-NO_CHECKS ,
ld_transfer_to_coll  TYPE BAPIRFKA1-TRANSFER_TO_COLL ,
ld_application_fields  TYPE BAPIRFKA1 ,
ld_created_by  TYPE BAPIDFKKKO-CREATED_BY .


ld_documentnumber = some text here

"populate fields of struture and append to itab
append wa_openitems to it_openitems.

ld_posting_date = 20210129

"populate fields of struture and append to itab
append wa_extensionin to it_extensionin.

ld_currency = Check type of data required

ld_doc_type = some text here

ld_fikey = some text here

ld_charge_off_reason = some text here

ld_no_checks = some text here

ld_transfer_to_coll = some text here
ld_application_fields = 'Check type of data required'.

ld_created_by = some text here

SAP Documentation for FM BAPI_CTRACDOCUMENT_WRITEOFF


You can use this BAPI to write off an FI-CA document (see transction FP04). ...See here for full SAP fm documentation









Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name BAPI_CTRACDOCUMENT_WRITEOFF or its description.