SAP BAPI_MATVAL_DEBIT_CREDIT Function Module for Debit/Credit Material
BAPI_MATVAL_DEBIT_CREDIT is a standard bapi matval debit credit SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Debit/Credit Material processing and below is the pattern details for this FM, 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 bapi matval debit credit FM, simply by entering the name BAPI_MATVAL_DEBIT_CREDIT into the relevant SAP transaction such as SE37 or SE38.
Function Group: CKMLSENDDEBICREDI
Program Name: SAPLCKMLSENDDEBICREDI
Main Program: SAPLCKMLSENDDEBICREDI
Appliation area:
Release date: 10-Jan-2013
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function BAPI_MATVAL_DEBIT_CREDIT 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 'BAPI_MATVAL_DEBIT_CREDIT'"Debit/Credit Material.
EXPORTING
MATERIAL = "Material Number
VALUATIONAREA = "Valuation Area
VALUATIONTYPE = "Valuation Type
POSTING_DATE = "Price Change Date
* MATERIAL_EVG = "External Material Number and Version
* REASON_CODE = "Account Assignment Reason
* DOC_TEXT = "Document Header Text
* REF_DOC_NO = "Reference Document Number
IMPORTING
DEBITCREDITDOCUMENT = "Debit/Credit Document
TABLES
RETURN = "Confirmations
MATERIAL_DEBIT_CREDIT = "Debit/Credit Amounts and Reference Quantities
IMPORTING Parameters details for BAPI_MATVAL_DEBIT_CREDIT
MATERIAL - Material Number
Data type: BAPI_MATVAL_KEY-MATERIALOptional: No
Call by Reference: No ( called with pass by value option)
VALUATIONAREA - Valuation Area
Data type: BAPI_MATVAL_KEY-VAL_AREAOptional: No
Call by Reference: No ( called with pass by value option)
VALUATIONTYPE - Valuation Type
Data type: BAPI_MATVAL_KEY-VAL_TYPEOptional: No
Call by Reference: No ( called with pass by value option)
POSTING_DATE - Price Change Date
Data type: BAPI_MATVAL_DEBI_CREDI_DATEOptional: No
Call by Reference: No ( called with pass by value option)
MATERIAL_EVG - External Material Number and Version
Data type: BAPIMGVMATNR_COPYOptional: Yes
Call by Reference: No ( called with pass by value option)
REASON_CODE - Account Assignment Reason
Data type: BAPI_MATVAL_DEBI_CREDI_MISC-REASON_CODEOptional: Yes
Call by Reference: No ( called with pass by value option)
DOC_TEXT - Document Header Text
Data type: BAPI_MATVAL_DEBI_CREDI_MISC-HEADER_TXTOptional: Yes
Call by Reference: No ( called with pass by value option)
REF_DOC_NO - Reference Document Number
Data type: BAPI_MATVAL_DEBI_CREDI_MISC-REF_DOC_NOOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for BAPI_MATVAL_DEBIT_CREDIT
DEBITCREDITDOCUMENT - Debit/Credit Document
Data type: BAPI_PRICECHANGE_DOCUMENTOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for BAPI_MATVAL_DEBIT_CREDIT
RETURN - Confirmations
Data type: BAPIRET2Optional: No
Call by Reference: Yes
MATERIAL_DEBIT_CREDIT - Debit/Credit Amounts and Reference Quantities
Data type: BAPI_MATERIAL_DEBIT_CREDIT_AMTOptional: No
Call by Reference: Yes
Copy and paste ABAP code example for BAPI_MATVAL_DEBIT_CREDIT 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_return | TYPE STANDARD TABLE OF BAPIRET2, " | |||
| lv_material | TYPE BAPI_MATVAL_KEY-MATERIAL, " | |||
| lv_debitcreditdocument | TYPE BAPI_PRICECHANGE_DOCUMENT, " | |||
| lv_valuationarea | TYPE BAPI_MATVAL_KEY-VAL_AREA, " | |||
| lt_material_debit_credit | TYPE STANDARD TABLE OF BAPI_MATERIAL_DEBIT_CREDIT_AMT, " | |||
| lv_valuationtype | TYPE BAPI_MATVAL_KEY-VAL_TYPE, " | |||
| lv_posting_date | TYPE BAPI_MATVAL_DEBI_CREDI_DATE, " | |||
| lv_material_evg | TYPE BAPIMGVMATNR_COPY, " | |||
| lv_reason_code | TYPE BAPI_MATVAL_DEBI_CREDI_MISC-REASON_CODE, " | |||
| lv_doc_text | TYPE BAPI_MATVAL_DEBI_CREDI_MISC-HEADER_TXT, " | |||
| lv_ref_doc_no | TYPE BAPI_MATVAL_DEBI_CREDI_MISC-REF_DOC_NO. " |
|   CALL FUNCTION 'BAPI_MATVAL_DEBIT_CREDIT' "Debit/Credit Material |
| EXPORTING | ||
| MATERIAL | = lv_material | |
| VALUATIONAREA | = lv_valuationarea | |
| VALUATIONTYPE | = lv_valuationtype | |
| POSTING_DATE | = lv_posting_date | |
| MATERIAL_EVG | = lv_material_evg | |
| REASON_CODE | = lv_reason_code | |
| DOC_TEXT | = lv_doc_text | |
| REF_DOC_NO | = lv_ref_doc_no | |
| IMPORTING | ||
| DEBITCREDITDOCUMENT | = lv_debitcreditdocument | |
| TABLES | ||
| RETURN | = lt_return | |
| MATERIAL_DEBIT_CREDIT | = lt_material_debit_credit | |
| . " BAPI_MATVAL_DEBIT_CREDIT | ||
ABAP code using 7.40 inline data declarations to call FM BAPI_MATVAL_DEBIT_CREDIT
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.| "SELECT single MATERIAL FROM BAPI_MATVAL_KEY INTO @DATA(ld_material). | ||||
| "SELECT single VAL_AREA FROM BAPI_MATVAL_KEY INTO @DATA(ld_valuationarea). | ||||
| "SELECT single VAL_TYPE FROM BAPI_MATVAL_KEY INTO @DATA(ld_valuationtype). | ||||
| "SELECT single REASON_CODE FROM BAPI_MATVAL_DEBI_CREDI_MISC INTO @DATA(ld_reason_code). | ||||
| "SELECT single HEADER_TXT FROM BAPI_MATVAL_DEBI_CREDI_MISC INTO @DATA(ld_doc_text). | ||||
| "SELECT single REF_DOC_NO FROM BAPI_MATVAL_DEBI_CREDI_MISC INTO @DATA(ld_ref_doc_no). | ||||
Search for further information about these or an SAP related objects