SAP CUSTOMER_BALANCE Function Module for
CUSTOMER_BALANCE is a standard customer balance 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 customer balance FM, simply by entering the name CUSTOMER_BALANCE into the relevant SAP transaction such as SE37 or SE38.
Function Group: F035
Program Name: SAPLF035
Main Program: SAPLF035
Appliation area: F
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function CUSTOMER_BALANCE 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 'CUSTOMER_BALANCE'".
EXPORTING
ANZBP = "Number of posting periods in Fyear variant
BUKRS = "Company code
GJAHR = "Current fiscal year
KUNNR = "Customer
MONAT = "Current Month
PERIV = "Fiscal year variant
XH12MON = "Determine highest 12 period balance?
XH6MON = "Determine highest 6 period balance?
IMPORTING
H06JA = "Fiscal year with highest 6 period balances
UML03 = "Balance 3 months ago
UML04 = "Balance 4 months ago
UML05 = "Balance 5 months ago
UML06 = "Balance 6 months ago
UML07 = "Balance 7 months ago
UML08 = "Balance 8 months ago
UML09 = "Balance 9 months ago
UML10 = "Balance 10 months ago
UML11 = "Balance 11 months ago
UML12 = "Balance 12 months ago
H06MO = "Month with highest 6 period balances
UMP2U = "Sales in the current fiscal year
VMP2U = "Sales in the previous fiscal year
H06SA = "Highest 6 period balance
H12JA = "Fiscal year with highest 12 period balance
H12MO = "Month with highest 12 period balance
H12SA = "Highest 12 period balance
SALDO = "Balance
UML01 = "Balance 1 month ago
UML02 = "Balance 2 months ago
EXCEPTIONS
NO_BALANCE = 1
IMPORTING Parameters details for CUSTOMER_BALANCE
ANZBP - Number of posting periods in Fyear variant
Data type: T009-ANZBPOptional: No
Call by Reference: No ( called with pass by value option)
BUKRS - Company code
Data type: KNC1-BUKRSOptional: No
Call by Reference: No ( called with pass by value option)
GJAHR - Current fiscal year
Data type: KNC1-GJAHROptional: No
Call by Reference: No ( called with pass by value option)
KUNNR - Customer
Data type: KNC1-KUNNROptional: No
Call by Reference: No ( called with pass by value option)
MONAT - Current Month
Data type: T009-ANZBPOptional: No
Call by Reference: No ( called with pass by value option)
PERIV - Fiscal year variant
Data type: T009-PERIVOptional: No
Call by Reference: No ( called with pass by value option)
XH12MON - Determine highest 12 period balance?
Data type: T019-DYNCLOptional: No
Call by Reference: No ( called with pass by value option)
XH6MON - Determine highest 6 period balance?
Data type: T019-DYNCLOptional: No
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for CUSTOMER_BALANCE
H06JA - Fiscal year with highest 6 period balances
Data type: RF035-H06JAOptional: No
Call by Reference: No ( called with pass by value option)
UML03 - Balance 3 months ago
Data type: KNC1-UM01SOptional: No
Call by Reference: No ( called with pass by value option)
UML04 - Balance 4 months ago
Data type: KNC1-UM01SOptional: No
Call by Reference: No ( called with pass by value option)
UML05 - Balance 5 months ago
Data type: KNC1-UM01SOptional: No
Call by Reference: No ( called with pass by value option)
UML06 - Balance 6 months ago
Data type: KNC1-UM01SOptional: No
Call by Reference: No ( called with pass by value option)
UML07 - Balance 7 months ago
Data type: KNC1-UM01SOptional: No
Call by Reference: No ( called with pass by value option)
UML08 - Balance 8 months ago
Data type: KNC1-UM01SOptional: No
Call by Reference: No ( called with pass by value option)
UML09 - Balance 9 months ago
Data type: KNC1-UM01SOptional: No
Call by Reference: No ( called with pass by value option)
UML10 - Balance 10 months ago
Data type: KNC1-UM01SOptional: No
Call by Reference: No ( called with pass by value option)
UML11 - Balance 11 months ago
Data type: KNC1-UM01SOptional: No
Call by Reference: No ( called with pass by value option)
UML12 - Balance 12 months ago
Data type: KNC1-UM01SOptional: No
Call by Reference: No ( called with pass by value option)
H06MO - Month with highest 6 period balances
Data type: RF035-H06MOOptional: No
Call by Reference: No ( called with pass by value option)
UMP2U - Sales in the current fiscal year
Data type: RF42B-UMP2UOptional: No
Call by Reference: No ( called with pass by value option)
VMP2U - Sales in the previous fiscal year
Data type: RF42B-UMP2UOptional: No
Call by Reference: No ( called with pass by value option)
H06SA - Highest 6 period balance
Data type: RF035-H06SAOptional: No
Call by Reference: No ( called with pass by value option)
H12JA - Fiscal year with highest 12 period balance
Data type: RF035-H12JAOptional: No
Call by Reference: No ( called with pass by value option)
H12MO - Month with highest 12 period balance
Data type: RF035-H12MOOptional: No
Call by Reference: No ( called with pass by value option)
H12SA - Highest 12 period balance
Data type: RF035-H12SAOptional: No
Call by Reference: No ( called with pass by value option)
SALDO - Balance
Data type: KNC1-UMSAVOptional: No
Call by Reference: No ( called with pass by value option)
UML01 - Balance 1 month ago
Data type: KNC1-UM01SOptional: No
Call by Reference: No ( called with pass by value option)
UML02 - Balance 2 months ago
Data type: KNC1-UM01SOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
NO_BALANCE - No balance
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for CUSTOMER_BALANCE 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: | ||||
| lv_anzbp | TYPE T009-ANZBP, " | |||
| lv_h06ja | TYPE RF035-H06JA, " | |||
| lv_no_balance | TYPE RF035, " | |||
| lv_uml03 | TYPE KNC1-UM01S, " | |||
| lv_uml04 | TYPE KNC1-UM01S, " | |||
| lv_uml05 | TYPE KNC1-UM01S, " | |||
| lv_uml06 | TYPE KNC1-UM01S, " | |||
| lv_uml07 | TYPE KNC1-UM01S, " | |||
| lv_uml08 | TYPE KNC1-UM01S, " | |||
| lv_uml09 | TYPE KNC1-UM01S, " | |||
| lv_uml10 | TYPE KNC1-UM01S, " | |||
| lv_uml11 | TYPE KNC1-UM01S, " | |||
| lv_uml12 | TYPE KNC1-UM01S, " | |||
| lv_bukrs | TYPE KNC1-BUKRS, " | |||
| lv_h06mo | TYPE RF035-H06MO, " | |||
| lv_ump2u | TYPE RF42B-UMP2U, " | |||
| lv_vmp2u | TYPE RF42B-UMP2U, " | |||
| lv_gjahr | TYPE KNC1-GJAHR, " | |||
| lv_h06sa | TYPE RF035-H06SA, " | |||
| lv_h12ja | TYPE RF035-H12JA, " | |||
| lv_kunnr | TYPE KNC1-KUNNR, " | |||
| lv_h12mo | TYPE RF035-H12MO, " | |||
| lv_monat | TYPE T009-ANZBP, " | |||
| lv_h12sa | TYPE RF035-H12SA, " | |||
| lv_periv | TYPE T009-PERIV, " | |||
| lv_saldo | TYPE KNC1-UMSAV, " | |||
| lv_xh12mon | TYPE T019-DYNCL, " | |||
| lv_uml01 | TYPE KNC1-UM01S, " | |||
| lv_xh6mon | TYPE T019-DYNCL, " | |||
| lv_uml02 | TYPE KNC1-UM01S. " |
|   CALL FUNCTION 'CUSTOMER_BALANCE' " |
| EXPORTING | ||
| ANZBP | = lv_anzbp | |
| BUKRS | = lv_bukrs | |
| GJAHR | = lv_gjahr | |
| KUNNR | = lv_kunnr | |
| MONAT | = lv_monat | |
| PERIV | = lv_periv | |
| XH12MON | = lv_xh12mon | |
| XH6MON | = lv_xh6mon | |
| IMPORTING | ||
| H06JA | = lv_h06ja | |
| UML03 | = lv_uml03 | |
| UML04 | = lv_uml04 | |
| UML05 | = lv_uml05 | |
| UML06 | = lv_uml06 | |
| UML07 | = lv_uml07 | |
| UML08 | = lv_uml08 | |
| UML09 | = lv_uml09 | |
| UML10 | = lv_uml10 | |
| UML11 | = lv_uml11 | |
| UML12 | = lv_uml12 | |
| H06MO | = lv_h06mo | |
| UMP2U | = lv_ump2u | |
| VMP2U | = lv_vmp2u | |
| H06SA | = lv_h06sa | |
| H12JA | = lv_h12ja | |
| H12MO | = lv_h12mo | |
| H12SA | = lv_h12sa | |
| SALDO | = lv_saldo | |
| UML01 | = lv_uml01 | |
| UML02 | = lv_uml02 | |
| EXCEPTIONS | ||
| NO_BALANCE = 1 | ||
| . " CUSTOMER_BALANCE | ||
ABAP code using 7.40 inline data declarations to call FM CUSTOMER_BALANCE
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 ANZBP FROM T009 INTO @DATA(ld_anzbp). | ||||
| "SELECT single H06JA FROM RF035 INTO @DATA(ld_h06ja). | ||||
| "SELECT single UM01S FROM KNC1 INTO @DATA(ld_uml03). | ||||
| "SELECT single UM01S FROM KNC1 INTO @DATA(ld_uml04). | ||||
| "SELECT single UM01S FROM KNC1 INTO @DATA(ld_uml05). | ||||
| "SELECT single UM01S FROM KNC1 INTO @DATA(ld_uml06). | ||||
| "SELECT single UM01S FROM KNC1 INTO @DATA(ld_uml07). | ||||
| "SELECT single UM01S FROM KNC1 INTO @DATA(ld_uml08). | ||||
| "SELECT single UM01S FROM KNC1 INTO @DATA(ld_uml09). | ||||
| "SELECT single UM01S FROM KNC1 INTO @DATA(ld_uml10). | ||||
| "SELECT single UM01S FROM KNC1 INTO @DATA(ld_uml11). | ||||
| "SELECT single UM01S FROM KNC1 INTO @DATA(ld_uml12). | ||||
| "SELECT single BUKRS FROM KNC1 INTO @DATA(ld_bukrs). | ||||
| "SELECT single H06MO FROM RF035 INTO @DATA(ld_h06mo). | ||||
| "SELECT single UMP2U FROM RF42B INTO @DATA(ld_ump2u). | ||||
| "SELECT single UMP2U FROM RF42B INTO @DATA(ld_vmp2u). | ||||
| "SELECT single GJAHR FROM KNC1 INTO @DATA(ld_gjahr). | ||||
| "SELECT single H06SA FROM RF035 INTO @DATA(ld_h06sa). | ||||
| "SELECT single H12JA FROM RF035 INTO @DATA(ld_h12ja). | ||||
| "SELECT single KUNNR FROM KNC1 INTO @DATA(ld_kunnr). | ||||
| "SELECT single H12MO FROM RF035 INTO @DATA(ld_h12mo). | ||||
| "SELECT single ANZBP FROM T009 INTO @DATA(ld_monat). | ||||
| "SELECT single H12SA FROM RF035 INTO @DATA(ld_h12sa). | ||||
| "SELECT single PERIV FROM T009 INTO @DATA(ld_periv). | ||||
| "SELECT single UMSAV FROM KNC1 INTO @DATA(ld_saldo). | ||||
| "SELECT single DYNCL FROM T019 INTO @DATA(ld_xh12mon). | ||||
| "SELECT single UM01S FROM KNC1 INTO @DATA(ld_uml01). | ||||
| "SELECT single DYNCL FROM T019 INTO @DATA(ld_xh6mon). | ||||
| "SELECT single UM01S FROM KNC1 INTO @DATA(ld_uml02). | ||||
Search for further information about these or an SAP related objects