Skip to Content

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.

Date Variable—

 

 

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

 

 

This is the code to derive YTD based on Calday input.

 

Customer Exit Code to derive YTD from Calday.

 

DATA : L_S_RANGE TYPE RSR_S_RANGESID ,
LOC_VAR_RANGE
TYPE RRRANGEEXIT,
L_PP
(3) TYPE C,
L_QQ
(3) TYPE C,
L_YY
(4) TYPE C,
L_MM
(2) TYPE C,
L_DD
(2) TYPE C.

 

CASE I_VNAM.

WHEN ‘ZVAR_YR_CUST’. {Customer Exit Variable}
IF I_STEP = 2.
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE VNAM = ‘ZSJ_CALDAY’. {Input Variable}

L_YY = LOC_VAR_RANGELOW+0(4).
L_MM
= LOC_VAR_RANGELOW+4(2).

IF L_MM = ’01’ OR l_MM = ’02’ OR L_MM = ’03’.

L_YY = L_YY 1.

ENDIF.
L_S_RANGE
LOW = L_YY.
L_S_RANGE
SIGN = ‘I’.
L_S_RANGE
OPT = ‘EQ’.

APPEND L_S_RANGE TO E_T_RANGE.
ENDLOOP.

ENDCASE.

 

Derive PYTD based on Calday –

 

We need this selection Screen after all the selection

 

 

 

Create a new customer exit variable for date input variable. Give technical name and description and Variable process type customer exit. 

 

 

 

Go in Details tab and maintain all these settings.

 

 

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.

 

CASE I_VNAM.

 

WHEN ‘ZCL_DAY_CUST’.
IF I_STEP = 2.
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE VNAM = ‘ZSJ_CALDAY’.

L_YY = LOC_VAR_RANGELOW+0(4).
L_MM
= LOC_VAR_RANGELOW+4(2).
L_DD
= LOC_VAR_RANGELOW+6(2).

L_YY = L_YY 1.
CONCATENATE L_YY L_MM L_DD INTO L_S_RANGELOW.
L_S_RANGE
SIGN = ‘I’.
L_S_RANGE
OPT = ‘EQ’.

APPEND L_S_RANGE TO E_T_RANGE.
ENDLOOP.
ENDIF.

ENDCASE.

 

Waiting for yours valuable suggestion 🙂

 

Thanks for reading this Blog. 🙂 🙂

To report this post you need to login first.

17 Comments

You must be Logged on to comment or reply to a post.

    1. Satendra Mishra Post author

      Hi Anshu,

      Thanks for your Feedback 🙂 .

      in my document for Jan Feb and March month should be in previous year so we need code. with code it is not possible. bcz he fiscal year will start from APR to MAR.

      Regards,

      SM

      (0) 

Leave a Reply