SAP Tables

GET_BALANCE_RG1 SAP Function module - Maintains RG1 opening/closing balances






GET_BALANCE_RG1is a standard SAP function module available within R/3 SAPsystems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import/export parameters, exceptions etc as well as any documentation contributions specific to the object. See here to view full function module documentation and code listing, simply by entering the name GET_BALANCE_RG1 into the relevant SAP transaction such as SE37 or SE80.

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 GET_BALANCE_RG1 or its description.


Pattern for FM GET_BALANCE_RG1 - GET BALANCE RG1
Associated Function Group: J2I6
Released Date: Not Released
CALL FUNCTION 'GET_BALANCE_RG1' "Maintains RG1 opening/closing balances
  EXPORTING
*   i_datum = SY-DATUM          " sy-datum
    i_exgrp =                   " j_1ipart1-exgrp
*   i_werks =                   " t001w-werks
    i_matnr =                   " mara-matnr
    i_form =                    " j_2irg1bal-form
    i_func =                    " j_2icomm-c1
*   i_rg1bal =                  " j_2irg1bal
  IMPORTING
    e_rg1bal =                  " j_2irg1bal    RG1 Balance record
  EXCEPTIONS
    NOT_FOUND = 1               "               Not found
    PARAMETER_ERROR = 2         "               Parameter error
    ERROR_OCCURED = 3           "               Unknown error occured
    .  "  GET_BALANCE_RG1

ABAP code example for Function Module GET_BALANCE_RG1

The ABAP code below is a full code listing to execute function module GET_BALANCE_RG1 including all data declarations. The code uses the latest in-line data declaration syntax but I have included an abap code snipet 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_e_rg1bal   TYPE J_2IRG1BAL.

DATA(ld_i_datum) = 20170927.

SELECT single EXGRP
FROM J_1IPART1
INTO @DATA(ld_i_exgrp).


SELECT single WERKS
FROM T001W
INTO @DATA(ld_i_werks).


SELECT single MATNR
FROM MARA
INTO @DATA(ld_i_matnr).


SELECT single FORM
FROM J_2IRG1BAL
INTO @DATA(ld_i_form).


DATA(ld_i_func). = 'some text here'
DATA(ld_i_rg1bal) = 20170927.. CALL FUNCTION 'GET_BALANCE_RG1' EXPORTING * i_datum = ld_i_datum i_exgrp = ld_i_exgrp * i_werks = ld_i_werks i_matnr = ld_i_matnr i_form = ld_i_form i_func = ld_i_func * i_rg1bal = ld_i_rg1bal IMPORTING e_rg1bal = ld_e_rg1bal EXCEPTIONS NOT_FOUND = 1 PARAMETER_ERROR = 2 ERROR_OCCURED = 3 . " GET_BALANCE_RG1
IF SY-SUBRC EQ 0.   "All OK ELSEIF SY-SUBRC EQ 1. "Exception   "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception   "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception   "Add code for exception here 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_e_rg1bal TYPE J_2IRG1BAL ,
ld_i_datum TYPE SY-DATUM ,
ld_i_exgrp TYPE J_1IPART1-EXGRP ,
ld_i_werks TYPE T001W-WERKS ,
ld_i_matnr TYPE MARA-MATNR ,
ld_i_form TYPE J_2IRG1BAL-FORM ,
ld_i_func TYPE J_2ICOMM-C1 ,
ld_i_rg1bal TYPE J_2IRG1BAL .

ld_e_rg1bal = 20170927.
ld_i_datum = 20170927.

SELECT single EXGRP
FROM J_1IPART1
INTO ld_i_exgrp.


SELECT single WERKS
FROM T001W
INTO ld_i_werks.


SELECT single MATNR
FROM MARA
INTO ld_i_matnr.


SELECT single FORM
FROM J_2IRG1BAL
INTO ld_i_form.


DATA(ld_i_func). = 'some text here'
ld_i_rg1bal = 20170927..