Skip to Content

In this blog, I want to show you how to create QTD Variable for 0Calday Input.

First let we know what is QTD (Quarter to Date)?

A Period between the start of the quarter to the present date. It acts as a financial tool to highlight all business

activities undertaken by a company from the start of the quarter to the date at which the information on activities

were collated. QTD is useful in informing corporate decision-makers the progress of the business in that quarter.


We need to create a selection like this.



So, First we need to create Calday input input variable below like this.


Create a date Variable here value range is less then Equal or equal to ( ≤ ) single value mandatory input.

Date Variable—




Maintain below this Details tab Settings



Our cal day input variable is less then equal to cal day variable.




Now we are going to create ZQUA_DATE_CUST Variable on top of 0Cal year/month object.


Process Type – Customer Exit

Reference Char – Cal Year/Month




Details tab settings


Variable Type – Interval

Variable is Mandatory

Un check check box for variable is ready for input



Then save and Exit.


Now write ABAP code to Derive QTD from Calday


DATA : L_S_RANGE TYPE RSR_S_RANGESID ,
LOC_VAR_RANGE
TYPE RRRANGEEXIT,


  L_YY(4) TYPE C,
L_MM
(2) TYPE C.

CASE I_VNAM.

WHEN ‘ZQUA_DATE_CUST’. (QTD Customer Exit Variable)
IF I_STEP = 2.
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE VNAM = ‘ZSJ_CALDAY’. (Cal day 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’.

CONCATENATE L_YY L_MM INTO L_S_RANGELOW.
CONCATENATE L_YY L_MM INTO L_S_RANGEHIGH.

ELSEIF L_MM = ’04’ OR L_MM = ’05’ OR L_MM = ’06’.

CONCATENATE L_YY L_MM INTO L_S_RANGELOW.
CONCATENATE L_YY L_MM INTO L_S_RANGEHIGH.

ELSEIF L_MM = ’07’ OR L_MM = ’08’ OR L_MM = ’09’.

CONCATENATE L_YY L_MM INTO L_S_RANGELOW.
CONCATENATE L_YY L_MM INTO L_S_RANGEHIGH.

ELSEIF L_MM = ’11’ OR L_MM = ’12’ OR L_MM = ’13’.

CONCATENATE L_YY L_MM INTO L_S_RANGELOW.
CONCATENATE L_YY L_MM INTO L_S_RANGEHIGH.

L_S_RANGESIGN = ‘I’.
L_S_RANGE
OPT = ‘BT’.

APPEND L_S_RANGE TO E_T_RANGE.

ENDIF.

   ENDLOOP.
ENDIF.

ENDCASE.


Thanks for reading this blog 🙂 .


Waiting for your valuable feedback and ratings.









To report this post you need to login first.

4 Comments

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

Leave a Reply