Dear friend this blog will help you to derive YTD and PYTD based on Calday input.
So first we will discuss what is YTD and PYTD.
YTD – Year-to-date is a period, starting from the beginning of the current year, and continuing up to the present day. The year usually starts on January 1 (calendar year), but depending on purpose, can start also on July 1, April 1. YTD is often provided in financial statements detailing the performance of a business entity. Providing current YTD results, as well as YTD results for one or more past years as of the same date, allows owners, managers, investors, and other stakeholders to compare the company’s current performance to that of past periods.
PYTD – Previous year data for same date input.
Derive YTD Based on Calday input
after all the selection we need this screen
Now first we creating cal day input variable
Create a date Variable here value range is less then Equal or equal to ( ≤ ) single value mandatory input.
Details tab setting
this input date variable should be less then or equal. Because when user will input any date then it will fetch data from that data or less then.
Now we need to create a customer exit variable on FISCAL YEAR.
Details tab setting
Create a new customer exit variable for date input variable. Give technical name and description and Variable process type customer exit.
Details tab settings,
Our cal day input variable is less then equal to cal day variable.
Select customer exit Fiscal year variable and select offset minus ➖ 1 for last 1Year.
Customer Exit Code for cal day variable ZCL_DAY_CUST (Cal day from customer Exit Var 1)
DATA : L_S_RANGE TYPE RSR_S_RANGESID ,
LOC_VAR_RANGE TYPE RRRANGEEXIT,
L_YY(4) TYPE C,
L_MM(2) TYPE C,
L_DD(2) TYPE C.
IF I_STEP = 2.
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE VNAM = ‘ZSJ_CALDAY’.
L_YY = LOC_VAR_RANGE–LOW+0(4).
L_MM = LOC_VAR_RANGE–LOW+4(2).
L_DD = LOC_VAR_RANGE–LOW+6(2).
L_YY = L_YY – 1.
CONCATENATE L_YY L_MM L_DD INTO L_S_RANGE–LOW.
L_S_RANGE–SIGN = ‘I’.
L_S_RANGE–OPT = ‘EQ’.
APPEND L_S_RANGE TO E_T_RANGE.
Waiting for yours valuable suggestion 🙂
Thanks for reading this Blog. 🙂 🙂