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

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

IF L_MM = '01' OR L_MM = '02' OR L_MM = '03'.

CONCATENATE L_YY L_MM INTO L_S_RANGE-LOW.
CONCATENATE L_YY L_MM INTO L_S_RANGE-HIGH.

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

CONCATENATE L_YY L_MM INTO L_S_RANGE-LOW.
CONCATENATE L_YY L_MM INTO L_S_RANGE-HIGH.

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

CONCATENATE L_YY L_MM INTO L_S_RANGE-LOW.
CONCATENATE L_YY L_MM INTO L_S_RANGE-HIGH.

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

CONCATENATE L_YY L_MM INTO L_S_RANGE-LOW.
CONCATENATE L_YY L_MM INTO L_S_RANGE-HIGH.


L_S_RANGE
-SIGN = 'I'.
L_S_RANGE
-OPT = 'BT'.

APPEND L_S_RANGE TO E_T_RANGE.

ENDIF.


  
ENDLOOP.
ENDIF.

ENDCASE.


Thanks for reading this blog :smile: .


Waiting for your valuable feedback and ratings.









4 Comments
Labels in this area