The Business Information Warehouse (SAP BW) key figures are either about cumulative values (for example sales, number of pieces sold) or non-cumulative values (for example number of employees, warehouse stock). Key figures that are defined as non-cumulative values form a key figure group with further key figures that contain the values for the non-cumulative value changes (inflows and outflows). In order to be able to plan non-cumulative values, all key figures that belong to such a key figure group must therefore be compared with each other, so that no inconsistencies occur.
The function to accumulate balances offers you an alternative approach for this comparison, by determining values for the respective missing key figure, for the updating of balances over time. You determine the key figures, from which the key figure group is made up, here within SEM-BPS (and not with the key figure definition in SAP BW). Either the closing balance or the non-cumulative value change (applied to the period) can be calculated. Here is the following general formula that it is based on:
The general use of this function is that you receive direct access to all balance-relevant values for a given key figure for every desired period. This occurs without time-intensive translations having to be carried out beforehand, as would be necessary for the query of values direct from the data basis.
In the parameter groups for the function to accumulate balances, you define which balances should be planned. For this you can choose four key figures at most for the opening balance, the closing balance as well as the inflows and outflows in the balance.
It is not absolutely necessary to enter a key figure name for all fields. By omitting a key figure you can use the function in various ways:
- If no key figure name is entered for the outflows in the balance, then the function interprets the key figure for the inflows as the non-cumulative value change that can also have a negative value. Therefore the value of the key figure that you enter under inflows corresponds in this case to the balance of the outflows and inflows. A detailed conclusion about the real outflows and inflows is not possible with this type of data retention.
- If no key figure name is entered for the opening balance, then no closing balance can be determined for the first period of the package. On the contrary it is assumed that the closing balance has already been determined in the first period of the planning package and can serve as the starting point for the update of balances in the following periods.
Period | Opening Balance | Inflow | Outflow | Closing Balance |
001.2000 | 100 | 80 | 20 | 160 |
002.2000 | 160 | 50 | 70 | 140 |
003.2000 | 140 | 120 | 30 | 230 |
Period | Opening Balance | Inflow | Outflow | Closing Balance |
001.2000 | 100 | 60 | 160 | |
002.2000 | 160 | -20 | 140 | |
003.2000 | 140 | 90 | 230 |
Date Amount Open_Bal Close_Bal
1/01/2012 100 0 100
3/01/2012 -20 100 80
4/01/2012 200 80 280
4/01/2012 10 280 290
5/01/2012 10 290 300
Variable Selection : From Date and To Date.
Create Customer Exit Variable on Calendar Day (0CALDAY)
Create ZC_FYFD variable on 0CALDAY, the properties are..
Type of Variable = Characteristic
Variable Name = ZC_FYFD
Processing by = Customer Exit
Characteristic = Calendar Day
Variable Represents = Interval
Variable Entry = Mandatory
Check ready for input
********************Begin of Data Type Declaration*********************************
DATA: L_S_RANGE TYPE RSR_S_RANGESID,
LOC_VAR_RANGE LIKE RRRANGEEXIT,
zbuper LIKE t009b-poper,
zbdatj LIKE t009b-bdatj,
ZDT1 TYPE SY-DATUM,
ZFDT TYPE SY-DATUM,
ZLDT TYPE SY-DATUM.
********************End of Data Type Declaration************************************
****************************************Begin***************************************
********To get the Financial Year From and To dates based on System/Current Date****
********************Surendra Kumar Reddy Koduru***23-10-2009************************
CASE i_vnam.
WHEN 'ZC_FYFD'.
IF i_step = 1.
ZDT1 = SY-DATUM.
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
I_DATE = ZDT1
* I_MONMIT = 00
I_PERIV = 'V3'
IMPORTING
E_BUPER = zbuper
E_GJAHR = zbdatj
EXCEPTIONS
INPUT_FALSE = 1
T009_NOTFOUND = 2
T009B_NOTFOUND = 3
OTHERS = 4
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'FIRST_AND_LAST_DAY_IN_YEAR_GET'
EXPORTING
I_GJAHR = zbdatj
I_PERIV = 'V3'
IMPORTING
E_FIRST_DAY = ZFDT
E_LAST_DAY = ZLDT
EXCEPTIONS
INPUT_FALSE = 1
T009_NOTFOUND = 2
T009B_NOTFOUND = 3
OTHERS = 4
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
l_s_range-low = ZFDT.
l_s_range-high = ZLDT.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
APPEND l_s_range TO e_t_range.
ENDIF.
ENDCASE.
*****************************************End*****************************************
****
Save and Activate the above code and project.
Code Example:
DATA: L_S_RANGE TYPE RSR_S_RANGESID.
* Current month to date variable ZCMTD example.
WHEN 'ZCMTD'.
* you variable name
data: ZCMTD_LOW like sy-datum.
*defining variable for using as a starting date of the interval
ZCMTD_LOW = sy-datum. *initializing it with the current date
ZCMTD_LOW+6(2) = '01'.
*replacing last two symbols (day) in the current date with '01'(see ref.1)
CLEAR L_S_RANGE.
L_S_RANGE-LOW = ZCMTD_LOW.
*initializing low interval limit
L_S_RANGE-HIGH = SY-DATUM.
*initializing high interval limit
L_S_RANGE-SIGN = 'I'.
*defining interval as inclusive
L_S_RANGE-OPT = 'BT'.
APPEND L_S_RANGE TO E_T_RANGE.
* Current month to date variable ZCMTD example end.
ENDCASE.
The result of this will be an interval from the first day of the current month till
the current system date.
nice article....thanq u rakesh...!
ReplyDelete