Friday, February 17, 2012

Error in source system (Message no. RSAR502)

Error in source system CLNT100


Message no. RSAR502

Diagnosis
With Remote Function Call to system CLNT100 error Screen output without connection to user. ccurred.

Procedure
Remove the cause of the error.

Resolution:

1.Found out the answer: it was a mistake of me. I forgot to open the system (SCC4 and SE06) before restoring source system. As a reaction, the system generates a message, but cannot display as ALEREMOTE is a system user. This generated a short dump in the source system. Resetting ALEREMOTE to DIALOG user made the message visible.

2. Change the User type from System user to Dialogue user and keep the source system in modifiable state for few mins(until establishing the src.system connection).

Monday, February 13, 2012

Inflow/Outflow



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:

Closing balance = opening balance + inflows – outflowsas well as
Opening balance (current period) = closing balance (current period – 1)The time period for which the update of balances is executed, results from the value restriction of the time characteristic you selected in the planning package or level.
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.
Only apply the function to accumulate balances for those key figures that are not defined as non-cumulative values in the Business Information Warehouse. The reason for this is that the additional key figures (for non-cumulative value changes or inflows and outflows) compounded to a non-cumulative value defined in SAP BW are not included in InfoCubes, which contain a non-cumulative value. As a result no access possibilities would exist for the additional key figures from SEM-BPS. You can determine the exact key figure definition with the help of the SAP BW Administrator Workbench.Features : When creating a planning function to accumulate balances, only select the characteristic that contains the time dimension. The value restriction of this characteristic determines the time period in the planning package or level, for which the update of balances takes place.
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.
In addition in the parameter groups you can define whether the closing balance should be calculated according to the formula mentioned above, or whether inversely the non-cumulative value change is to be calculated on the basis of planned closing balances according to the following formula:
Balance change (current period) = closing balance (current period) – closing balance (current period – 1)Example 1: Calculating the Closing Balance

PeriodOpening BalanceInflowOutflowClosing Balance
001.20001008020160
002.20001605070140
003.200014012030230
Example 2: Calculating the Non-Cumulative Value Change on the Basis of the Closing Balance
PeriodOpening BalanceInflowOutflowClosing Balance
001.200010060160
002.2000160-20140
003.200014090230


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.













Friday, February 10, 2012

BOM Item Details - Extracting from FUNCTION MODULE


For this,
Create the structure YCPS_BOM_STR same as STPO_API02.
Copy the function group RSAX and use the function module structure RSAX_GET_DATA_SIMPLE .

Algorithm of the Function module:
•Selections to be included are Plant, Alternative BOM, BOM Usage and material.
•Among these selections Plant needs to be entered. If there is no specific value enter (0001 to 9999).
•Select all the relevant materials from MAST table into internal table for the selections given above.
•Call the FM CSAP_MAT_BOM_ITEM_SELECT for each material.
•This FM will give all the Components, its Qty, Its UOM, Valid From and Valid to Date for each material passed.
•Include the logic for conversions to different data types like DATE and QUAN.





FUNCTION FUNCTION-MODULE NAME.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_REQUNR) TYPE SRSC_S_IF_SIMPLE-REQUNR
*" REFERENCE(I_DSOURCE) TYPE SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL
*" REFERENCE(I_MAXSIZE) TYPE SRSC_S_IF_SIMPLE-MAXSIZE OPTIONAL
*" REFERENCE(I_INITFLAG) TYPE SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL
*" REFERENCE(I_READ_ONLY) TYPE SRSC_S_IF_SIMPLE-READONLY OPTIONAL
*" TABLES
*" I_T_SELECT TYPE SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL
*" I_T_FIELDS TYPE SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL
*" E_T_DATA STRUCTURE YCPS_BOM_STR OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
*"----------------------------------------------------------------------
* Auxiliary Selection criteria structure
DATA: L_S_SELECT TYPE SRSC_S_SELECT,
LT_DATE LIKE STKO-DATUV,
I_QTY TYPE STPO-MENGE,
L_TABIX LIKE SY-TABIX.
DATA: L_COMP_QTY(18).
DATA: BEGIN OF I_MAST OCCURS 0,
MATNR LIKE MAST-MATNR, "MATERIAL
WERKS LIKE MAST-WERKS, "PLANT
STLAN LIKE MAST-STLAN, "BOM USAGE
STLNR LIKE MAST-STLNR, "BOM
STLAL LIKE MAST-STLAL, "ALTERNATIVE BOM
END OF I_MAST.
DATA: I_STPO LIKE STPO_API02 OCCURS 0 WITH HEADER LINE,
YCPS_BOM_TAB LIKE YCPS_BOM_STR OCCURS 0 WITH HEADER LINE.
TABLES: MAST.
RANGES: R_MATNR FOR MAST-MATNR,
R_WERKS FOR MAST-WERKS,
R_STLAN FOR MAST-STLAN,
R_STLAL FOR MAST-STLAL.
* Maximum number of lines for DB table
STATICS: S_S_IF TYPE SRSC_S_IF_SIMPLE,
S_COUNTER_DATAPAKID LIKE SY-TABIX.
* Initialization mode (first call by SAPI) or data transfer mode
* (following calls) ?
IF I_INITFLAG = SBIWA_C_FLAG_ON.
************************************************************************
* Initialization: check input parameters
* buffer input parameters
* prepare data selection
************************************************************************
* Check DataSource validity
CASE I_DSOURCE.
WHEN 'DATA-SOURCE NAME'.
WHEN OTHERS.
IF 1 = 2. MESSAGE E009(R3). ENDIF.
* this is a typical log call. Please write every error message like this
LOG_WRITE 'E' "message type
'R3'"   message class
'009' "message number
I_DSOURCE "message variable 1
' '. "message variable 2
RAISE ERROR_PASSED_TO_MESS_HANDLER.
ENDCASE.
APPEND LINES OF I_T_SELECT TO S_S_IF-T_SELECT.
* Fill parameter buffer for data extraction calls
S_S_IF-REQUNR = I_REQUNR.
S_S_IF-DSOURCE = I_DSOURCE.
S_S_IF-MAXSIZE = I_MAXSIZE.
* Fill field list table for an optimized select statement
* (in case that there is no 1:1 relation between InfoSource fields
* and database table fields this may be far from beeing trivial)
APPEND LINES OF I_T_FIELDS TO S_S_IF-T_FIELDS.
ELSE. "Initialization mode or data extraction ?
************************************************************************
* Data transfer: First Call OPEN CURSOR + FETCH
* Following Calls FETCH only
************************************************************************
* First data package -> OPEN CURSOR
IF S_COUNTER_DATAPAKID = 0.
CLEAR: R_MATNR,
R_WERKS,
R_STLAN,
R_STLAL.
REFRESH: R_MATNR,
R_WERKS,
R_STLAN,
R_STLAL.
*-- Material Number
LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'MATNR'.
MOVE-CORRESPONDING L_S_SELECT TO R_MATNR.
APPEND R_MATNR.
ENDLOOP.
*-- Plant
LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'WERKS'.
MOVE-CORRESPONDING L_S_SELECT TO R_WERKS.
APPEND R_WERKS.
ENDLOOP.
*-- Item Category
LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'STLAN'.
MOVE-CORRESPONDING L_S_SELECT TO R_STLAN.
APPEND R_STLAN.
ENDLOOP.
*-- Alternative BOM
LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'BOM_ALT'.
MOVE-CORRESPONDING L_S_SELECT TO R_STLAL.
APPEND R_STLAL.
ENDLOOP.
SELECT * INTO CORRESPONDING FIELDS OF TABLE I_MAST
FROM MAST
WHERE WERKS IN R_WERKS
AND MATNR IN R_MATNR
AND STLAN IN R_STLAN
AND STLAL IN R_STLAL.
IF SY-SUBRC EQ 0.
SORT I_MAST BY WERKS MATNR STLNR.
DELETE I_MAST WHERE WERKS = ''.
ENDIF.
LOOP AT I_MAST.
CALL FUNCTION 'CSAP_MAT_BOM_ITEM_SELECT'
EXPORTING
* I_STPO =
MATERIAL = i_mast-matnr
PLANT = i_mast-werks
BOM_USAGE = i_mast-stlan
ALTERNATIVE = i_mast-stlal
* VALID_FROM = p_datuv
* VALID_TO = p_datub
FL_MATERIAL_CHECK = 'X'
FL_FOREIGN_KEY_CHECK = 'X'
* IMPORTING
* FL_WARNING =
TABLES
T_STPO = i_stpo
EXCEPTIONS
ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT I_STPO.
L_COMP_QTY = I_STPO-COMP_QTY.
REPLACE ALL OCCURRENCES OF ',' IN L_COMP_QTY WITH SPACE.
CONDENSE L_COMP_QTY.
I_QTY = L_COMP_QTY.
MOVE-CORRESPONDING I_MAST TO YCPS_BOM_TAB.
*Individual mapping is done as the valid to and from date is not in BW format
YCPS_BOM_TAB-BOM_ALT = I_STPO-BOM_ALT.
YCPS_BOM_TAB-ITEM_CATEG = I_STPO-ITEM_CATEG.
YCPS_BOM_TAB-BOM_NO = I_STPO-BOM_NO.
YCPS_BOM_TAB-ITEM_NO = I_STPO-ITEM_NO.
YCPS_BOM_TAB-ITEM_NODE = I_STPO-ITEM_NODE.
YCPS_BOM_TAB-ITEM_COUNT = I_STPO-ITEM_COUNT.
YCPS_BOM_TAB-COMPONENT = I_STPO-COMPONENT.
YCPS_BOM_TAB-COMP_QTY = I_QTY.
YCPS_BOM_TAB-COMP_UNIT = I_STPO-COMP_UNIT.
YCPS_BOM_TAB-VALID_FROM+0(4) = I_STPO-VALID_FROM+6(4).
YCPS_BOM_TAB-VALID_FROM+4(2) = I_STPO-VALID_FROM+0(2).
YCPS_BOM_TAB-VALID_FROM+6(2) = I_STPO-VALID_FROM+3(2).
YCPS_BOM_TAB-VALID_TO+0(4) = I_STPO-VALID_TO+6(4).
YCPS_BOM_TAB-VALID_TO+4(2) = I_STPO-VALID_TO+0(2).
YCPS_BOM_TAB-VALID_TO+6(2) = I_STPO-VALID_TO+3(2).
YCPS_BOM_TAB-RECURSIVE = I_STPO-RECURSIVE.
YCPS_BOM_TAB-DEP_LINK = I_STPO-DEP_LINK.
YCPS_BOM_TAB-ALE_IND = I_STPO-ALE_IND.
YCPS_BOM_TAB-CHG_NO_TO = I_STPO-CHG_NO_TO.
YCPS_BOM_TAB-CREATED_ON = I_STPO-CREATED_ON.
YCPS_BOM_TAB-CREATED_BY = I_STPO-CREATED_BY.
YCPS_BOM_TAB-CHANGED_ON = I_STPO-CHANGED_ON.
YCPS_BOM_TAB-CHANGED_BY = I_STPO-CHANGED_BY.
YCPS_BOM_TAB-FLDELETE = I_STPO-FLDELETE.
APPEND YCPS_BOM_TAB.
ENDLOOP.
REFRESH I_STPO.
ENDLOOP.
ENDIF. "First data package ?
IF I_STPO IS INITIAL.
RAISE NO_MORE_DATA.
ENDIF.
APPEND LINES OF YCPS_BOM_TAB TO E_T_DATA.
S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
REFRESH YCPS_BOM_TAB.
ENDIF.
ENDFUNCTION.

Monday, February 6, 2012

Stock Valuation - Business Logic




Closing Stock, Opening Stock :: Valuation



Finding Value of Closing Stock from Sales

We may be able to ascertain what is left out if we know what has been sold. This logic may be applied in finding the value of closing stock. However, to know this, we need to ascertain the value of cost of goods sold.
      i.        Gross Profit = Sales − Cost of Goods Sold
     ii.        Cost of Goods Sold = Opening Stock + Purchases + Direct Expenses − Closing Stock
    iii.        Gross Profit = Sales − (Opening Stock + Purchases + Direct Expenses − Closing Stock) [From (i) and (ii)]
= Sales − Opening Stock − Purchases − Direct Expenses + Closing Stock
    iv.        Closing Stock = Opening Stock + Purchases + Direct Expenses + Gross Profit − Sales [From (iii)]
To use this relation to obtain the value of closing stock, we need the information relating to Gross Profit. All other information in this relation is readily available from the accounting records.


Gross Profit Ratio

• Ratio : Percentage
Ratio is a comparison between two numerical quantities of the same kind.
Ratio between two quantities is expressed in the form a : b or
a
b
, where "a" and "b" do not have a common factor.
Percentage = Ratio × 100
• Gross Profit Ratio
Gross Profit Ratio is the ratio of Gross Profit to Net Sales Value or Cost of Goods Sold.
» To Sales
Gross Profit Ratio
=
Gross Profit
Net Sales

Gross Profit as a % of Sales
=
Gross Profit
Net Sales
× 100
(Or)
=
Gross Profit Ratio (to Sales) × 100
» To Cost of Goods Sold
Gross Profit Ratio
=
Gross Profit
Cost of Goods Sold

Gross Profit as a % of Cost of Goods Sold
=
Gross Profit
Cost of Goods Sold
× 100
(Or)
=
Gross Profit Ratio (to Cost) × 100
• Inter-Relationship between the two Ratios
The Gross Profit Ratio (to Sales) and Gross Profit Ratio (to Cost of Goods Sold) are interrelated and one can be obtained if the other is known.
» Finding GP Ratio (to Cost) when GP Ratio (to Sales) is known
The data relating to the Gross Profit as a % of Sales given can be considered in three different forms. The formula used for conversion (expressing the interrelationship) varies depending on the form of the data considered.
• Data on 1 Scale
Expressing the data on 1 scale, amounts to expressing the value either in decimals or as a fraction.
Consider the following data:
§ Sales = x
§ Gross Profit Ratio (to Sales) = y (one scale)
Gross Profit
=
Sales × Gross Profit Ratio (to Sales)
=
x × y
=
Xy

Cost of Goods Sold
=
Sales − Gross Profit
=
x − xy
=
x (1 − y)

Gross Profit Ratio (to Cost)
=
Gross Profit
Cost of Goods Sold
=
xy
x (1 − y)
=
y
(1 − y)
» Example
Given » Gross Profit Ratio (to Sales) is 0.25 y
=
0.25

Therefore, Gross Profit Ratio (to Cost)
=
y
(1 − y)
=
0.25
(1 − 0.25)
=
0.25
0.75
=
1
3
=
0.33

Gross Profit (as a % to Cost)
=
Gross Profit Ratio (to Cost) × 100
=
0.33 × 100
=
33
1
3
%
• Data on 100 Scale
Expressing the data on 100 scale implies expressing the % without using the denominator 100.
[42% is taken as 42 for calculation purposes if it is taken on a 100 scale.]
Let the data on 100 scale be represented by 'm'. y =
m
100
Substituting this value for 'y' in the above formula we get,
Gross Profit Ratio (as a % of Cost)
=
y
(1 − y)
× 100
=
m
100
(1 −
M
100
)
× 100
=
m
100
100 − m
100
× 100
=
m
100
×
100
100 − m
× 100
=
m
100 − m
× 100
» Example
Given » Gross Profit is 25% of Sales m =25
Therefore, Gross Profit as a % of Cost
=
M
100 − m
× 100
=
25
100 − 25
× 100
=
25
75
× 100
=
100
3
=
33
1
3
• Data as a ratio with numerator 1
In some cases, for some common values that we use in problem solving, we use a formula based on the Gross Profit Ratio expressed as a ratio with a numerator 1.
Let the data be represented by
1
a
y =
1
a
Substituting this value for 'y' in the formula in (1) we get,
Gross Profit Ratio (to Cost)
=
y
(1 − y)
=
1
a
(1 −
1
a
)
=
1
a
a − 1
a
=
1
a
×
a
a − 1
=
1
a − 1
» Example
Given » Gross Profit Ratio (to Sales)
=
1
4
a = 4

Gross Profit Ratio (to Cost)
=
1
a − 1
=
1
4 − 1
=
1
3

Gross Profit (as a % to Cost)
=
Gross Profit Ratio (to Cost) × 100
=
1
3
× 100
=
33
1
3
%
» Finding GP Ratio (to Sales) when GP Ratio (to Cost) is known
The data relating to the Gross Profit as a % of Cost of Goods Sold given can be considered in three different forms. The formula used for conversion (expressing the interrelationship) varies depending on the form of the data considered.
• Data on 1 Scale
Expressing the data on 1 scale, amounts to expressing the value either in decimals or as a fraction.
Consider the following data:
Gross Profit
=
Cost of Goods Sold × Gross Profit (to Cost of Goods Sold)
=
p × q
=
Pq

Sales
=
Cost of Goods Sold + Gross Profit
=
p + pq
=
p (1 + q)

Gross Profit Ratio (to Sales)
=
Gross Profit
Net Sales
=
pq
p (1 + q)
=
q
(1 + q)
» Example
Given » Gross Profit Ratio (to Cost) is 0.2 p = 0.2
Therefore, Gross Profit Ratio (to Sales)
=
q
(1 + q)
=
0.2
(1 + 0.2)
=
0.2
1.2
=
1
6

Gross Profit (as a % to Sales)
=
Gross Profit Ratio (to Cost) × 100
=
1
6
× 100
=
16
2
3
%
• Data on 100 Scale
Expressing the data on 100 scale implies expressing the % without using the denominator 100.
[35% is taken as 35 for calculation purposes if it is taken on a 100 scale.]
Let the data on 100 scale be represented by 'n'. q =
n
100
Substituting this value for 'q' in the above formula we get,
Gross Profit as a % of Sales
=
q
(1 + q)
× 100
=
n
100
(1 +
n
100
)
× 100
=
n
100
100 + n
100
× 100
=
n
100
×
100
100 + n
× 100
=
n
100 + n
× 100
» Example
Given » Gross Profit is 20% of Cost n =20
Therefore, Gross Profit as a percentage of Saes
=
n
100 + n
× 100
=
20
100 + 20
× 100
=
20
120
× 100
=
1
6
× 100
=
16 2/3%
• Data as a ratio with numerator 1
In some cases, for some common values that we use in problem solving, we use a formula based on the Gross Profit Ratio expressed as a ratio with a numerator 1.
Let the data be represented by
1
b
q =
1
b
Substituting this value for 'q' in the formula in (1) we get,
Gross Profit Ratio (to Sales)
=
q
(1 + q)
=
1
b
(1 +
1
b
)
=
1
b
b + 1
b
=
1
b
×
b
b + 1
=
1
b + 1
» Example
Given » Gross Profit Ratio (to Sales) is
1
5
b = 5

Gross Profit Ratio (to Sales)
=
1
b + 1
=
1
5 + 1
=
1
6

Gross Profit Ratio (as a % to Sales)
=
Ratio × 100
=
1
6
× 100
=
16
2
3
%
» Frequently used conversions
• Hundred Scale
As a % of Cost
20
25
33
1
3
50
66
2
3
100
As a % of Sales
16
2
3
20
25
33
1
3
40
50
• One Scale
As a % of Cost
0.2
0.25
0.333
0.5
0.666
1
As a % of Sales
0.166
0.20
0.25
0.333
0.4
0.5
• Inverse
As a % of Cost
1
5
1
4
1
3
1
2
2
3
1
1
As a % of Sales
1
6
1
5
1
4
1
3
2
5
1
2


Gross Profit is generally Non-Uniform

The gross profit earned by an organsation is in almost all cases not a figure that can be easily derived (without the availability of the value of closing stock). Deriving the value of closing stock would be far easier than deriving the value of gross profit made (based on sales).
• Variety of Products being Sold
The organisation may be selling a number of products with different selling prices and different rates of gross profits.
In such cases, if the gross profit figure is to be ascertained from the sales figure, sales records should be maintained so as to give the sales details relating to each product with a distinct Gross Profit %. This would involve a lot of work and would be impractical, more so where there are a large number of products being dealt with.
• Variations in Sale Prices
The prices charged to customers are dependent on a number of factors like the market conditions, the immediate competition existing in the market, the loyalty of the customers etc.
Depending on the market conditions, some times the prices may be varied instantaneously.
Depending on the customer to whom the product is being sold, the prices may be varied (a discount may be given to loyal customers) etc.
In such a situations there would not be uniformity in the Gross profit percentage and it would be near to impossible to ascertain the gross profit made using the sales figures.
Since using the figure of gross profit to ascertain the value of closing stock available in the organisation is not a feasible idea, we look at other methods for finding out the value of closing stock.

How is the Value of Closing Stock Ascertained?

• Physical Stock
Closing stock is the stock/goods unsold at the end of the accounting period.
The details relating to the physical stock would be readily available with the organisation only if the inventory records are being maintained by the organisation. In other cases the physical stock would have to be ascertained by stock taking.
• Stock Value
There is no specific ledger account in financial accounting that would give us the information relating to the value of closing stock ready hand.
The value of closing stock is available ready hand only if inventory records are being maintained that too from the inventory records.
The value of Closing Stock is ascertained by Physical Verification of Stock on the last day of the accounting period and its valuation at Cost or Market Price (Net Realisable Value) whichever is lesser
This is the most common method for valuing the closing stock.
The information relating to the value of closing stock is not regularly required by the organisation. It is however required at the end of the accounting period for the purpose of evaluation of the Cost of Goods Sold.

Convention of Conservatism

• Net Realisable Value of Stock
For the purpose of Valuation of closing Stock, Market Price implies Net Realisable Value/Rate and not the Selling Price.
Net Realisable Value of stock is the net sale realisation excluding all the expenses directly and exclusively relatable to the sale (Sale commission, Brokerage etc) from the Sale Realisation.
Therefore, in trying to ascertain the Market Price to be used for valuation, care should be taken to ensure that such expenses are deducted from the sales price to ascertain the net realisable value of stock.
• Convention of Conservatism
By the Convention of Conservatism we take into consideration all those expenses and losses of which we are aware, even if they relate to the subsequent accounting periods.
The act of valuing closing stock at cost or market price is based on the "Convention of Conservatism".

Convention of Conservatism : Valuation of Closing Stock : Illustration

Following is the "Trading a/c" relating to an organisation, wherein the Closing Stock has been recorded at cost.
Dr
Trading a/c
Cr

Particulars
Amount
(in Rs)
Particulars
Amount
(in Rs)
To Opening Stock
To Purchases
To Direct Expenses
To Gross Profit
20,000
2,48,000
54,000
94,000
By Sales
By Closing Stock
3,80,000
36,000
4,16,000
4,16,000


final,accounts,financial,accounting,trading,profit,loss,account,balance,sheet,trial,balance,work,sheet,adjustments
» Closing Stock details
The closing stock is made up of
§ Batch N :: 600 units valued at Rs. 36/unit with a total value of Rs. 21,600
§ Batch M :: 600 units valued at Rs. 24/unit with a total value of Rs. 14,400
§ Total 1,200 units with a total value of Rs. 36,000
Value here implies cost + direct expenses
The selling prices and the related expenses are
§ Batch N :: Rs. 50/unit
§ Batch M :: Rs. 50/unit [Regular price]
Batch M :: Rs. 25/unit [Current price]
This stock represents an outdated model of the product and the present market conditions would enable the stock to be sold only at a price of Rs. 25 per unit.
§ The sales of all stocks are made through a dealer who would charge a commission of 10% of the sale proceeds.
» Cost and Net Realisable Values of Closing Stock
From the available data, Closing stock can be valued at two different rates. Cost and Market Price (Net Realisable Rate).
§ 600 units [Batch N]
                           i.   Cost = Rs. 36/unit.
                          ii.   Market Price = Rs. 50/unit.
                         iii.   Expenses directly relatable to sale = Rs. 5/unit
(10% of selling price = Rs. 50/unit × 10%).
                         iv.   Net Realisable Value = Rs. 45/unit
[Market Price (Rs. 50/unit) − Expenses relatable to sale (Rs. 5/unit)]
§ 600 units [Batch M]
                           i.   Cost = Rs. 24/unit.
                          ii.   Market Price = Rs. 25/unit.
                         iii.   Expenses directly relatable to sale = Rs. 2.50/unit
(10% of selling price = Rs. 25/unit × 10%).
                         iv.   Net Realisable Value = Rs. 22.50/unit
[Market Price (Rs. 25/unit) − Expenses relatable to sale (Rs. 2.50/unit)].
» Valuation of Closing Stock based on Convention of Conservatism
§ 600 units [Batch N]
Cost = Rs. 36/unit. Net Realisable Rate = Rs. 45/unit.
Since Cost < Net Realisable Value, the goods are to be valued at cost.
Value of 600 units is Rs. 21,600 (600 units × Rs. 36/unit)
§ 600 units [Batch M]
Cost = Rs. 24/unit. Net Realisable Rate = Rs. 22.50/unit.
Since Net Realisable Value < Cost, the goods are to be valued at the net realisable value.
Value of 600 units is Rs. 13,500 (600 units × Rs. 22.50/unit)
Value of Closing stock if valued at cost = Rs. 14,400 (600 units × Rs. 24/unit)
The Closing Stock should be valued therefore at Rs. 35,100 (Rs. 21,600 + 13,500).
» Trading a/c
If value of Closing Stock is taken based on the Convention of Conservatism, the Trading a/c would be
Dr
Trading a/c
Cr

Particulars
Amount
(in Rs)
Particulars
Amount
(in Rs)
To Opening Stock
To Purchases
To Direct Expenses
To Gross Profit
20,000
2,48,000
54,000
93,100
By Sales
By Closing Stock
3,80,000
35,100
4,15,100
4,15,100
The Gross profit has gone down by Rs. 900 since closing stock is considered at a lesser value.

Role of Convention of Conservatism

The convention of conservatism asks us to take into consideration all those expenses and losses relating to the subsequent periods of which we are aware.
» Future Losses
Where the Net realisable value of stock is less than its cost, the organisation may incur a loss.
In the above case, the organisation may have to incur a loss of Rs. 900 [Rs. 14,400 (cost) − Rs. 13,500 (net realisable value)].
• When?
This loss would have to be borne by the organisation if it sells the stock at the net realisable rate.
Since it is the end of the accounting period, such a sale at such a price, if at all it takes place, would be in the subsequent accounting period.
Thus, the organisation may have to incur this loss in the future.
• Is the loss for sure?
The loss may have to be incurred in the future only if the stock has to be sold at Rs. 25 per unit (which gives a net realisation of Rs. 22.50).
We may consider such a loss a certainty in cases where the stock is required to be sold at the lower price on account of it becoming obsolete, losing demand etc.
Bu where the lower market rate is on account of normal market fluctuation and if the rates go up in the subsequent period and the product can be sold at a higher price, this loss need not be incurred.

How is the loss absorbed?

Based on the Convention of Conservatism, the loss though it may have to be incurred in the future period, is absorbed in the current period itself, since its information is known.
This will be the case where the lower valuation is on account of conditions which are certain (obsolete goods, demand going down etc).
» Crediting a Nominal a/c implies gain
The value of closing stock is credited to the "Trading a/c". By the principle of credit in relation to nominal accounts (Credit all Incomes and Gains), we can assume the value to indicate a gain.
Reducing the value of closing stock would therefore amount to reducing the credit made to the Trading a/c, which would be reducing the gain. Debiting an amount is an equivalent of deducting the amount from the opposite side i.e. the credit side. Therefore, reducing the gain is the same as taking in additional loss.
Therefore, the loss is absorbed by considering the value of closing stock at a lesser value i.e. the net realisable value. [In the above example, by considering the closing stock at the lower value, the estimated loss of Rs. 900 relating to the subsequent accounting periods has been absorbed in the current period itself.]

Value of Closing Stock = Value of Opening Stock of the Subsequent Period

The Closing Stock a/c relating to an accounting period and the Opening Stock a/c relating to the subsequent accounting period represent the same account. Therefore, the value of the closing stock at the end of the accounting period and the opening stock at the beginning of the subsequent accounting period are the same.
• Closing Stock a/c
The "Closing Stock a/c" is a real account and is created at the last moment of the accounting period.
It represents Stock as an asset. The balance in the "Closing Stock a/c" is carried forward to the next accounting periods.
• Opening Stock a/c
The account that we name "Closing Stock a/c" is renamed "Opening Stock a/c" at the beginning of the next accounting period while bringing the values of assets and liabilities into the books of accounts with the help of an "Opening Entry".
This "Opening Stock a/c" is treated as an equivalent of a Nominal account.
Like other nominal accounts it is closed at the end of the accounting period. It is closed by transfer to the "Trading a/c" since it goes into the value of cost of goods sold.
» Note
The value of Opening and Closing stocks relating to a particular accounting period do not mean the same. They are two indicated by distinct ledger accounts - Opening stock by "Opening Stock a/c" which is a nominal account and Closing stock by "Closing Stock a/c" which is a Real account.
They may or may not have the same values.