Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member182196
Contributor
5,119


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_RANGE-LOW+0(4).
L_MM
= LOC_VAR_RANGE-LOW+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_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.
ENDLOOP.
ENDIF.


ENDCASE.

 

Waiting for yours valuable suggestion :smile:

 

Thanks for reading this Blog. :smile: :smile:

17 Comments
chanda
Contributor
0 Kudos

Hi Satendra,

Very useful document, most importantly well presented.

Thanks for it & wish to see more such helpful stuff.

Best Rgds,

Sudhir.

former_member182196
Contributor
0 Kudos

Thanks Sudhir.for this wonderful appreciation and likes. :smile:

harshil_joshi
Contributor
0 Kudos

Hi Satendra,

Appreciate your efforts.

former_member182196
Contributor
0 Kudos

Thanks Harshil for appreciation :smile:

manna_das
Contributor
0 Kudos

Indeed very useful document. Thanks for sharing your experience.

RamanKorrapati
Active Contributor
0 Kudos

Useful information and nice presentation satendra.

Thanks for your time and sharing with us.

Raman

former_member182196
Contributor
0 Kudos

Thanks Manna Das :smile:

former_member182196
Contributor
0 Kudos

Thanks Raman :smile: .

I am really happy to see your feedback and appreciation :smile: :smile:

Thanks Ones again. :smile:

anshu_lilhori
Active Contributor
0 Kudos

Hi Satendra,

Nice effort and i appreciate it.

Same thing i have covered in one of my document YTD Based on Fiscal Year Period without cmod code

Which indeed requires no code.The only difference is i have given it on the basis of fiscal year period and you have given it on date input.So i think only the offset length need to be changed to get the year from date input.

Regards,

AL

former_member182196
Contributor
0 Kudos

Hi Anshu,

 

Thanks for your Feedback ? .

 

In my case and document for Jan Feb and March month should be considered as previous year so that we need code. without code it is not possible because here fiscal year will start from APR to MAR.

 

Regards,

SM

anshu_lilhori
Active Contributor
0 Kudos

Yes i just realized it.. :wink: .I missed that year part.

Regards,

AL

KodandaPani_KV
Active Contributor
0 Kudos

Hi,

Nice document.

Thanks, phani.

former_member185177
Contributor
0 Kudos

Nicely illustrated, Good job.  Thanks for sharing.  :smile:

Regards,

Krishna Chaitanya.

former_member182196
Contributor
0 Kudos

Thanks Pani :smile:

former_member182196
Contributor
0 Kudos

Thanks Krishna :smile:

former_member209700
Participant
0 Kudos

Good document ...

former_member182196
Contributor
0 Kudos

Thanks Venkat :smile:

Labels in this area