Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Need new variable to find "Last 24 months excluding current month"

Former Member
0 Kudos

I want to filter my query by the Cal. yr/month dimension (OCALMONTH), and need to create a customer exit variable that will allow me to filter for the last 24 months excluding the current month. Any help provided would be greatly appreciated. Thanks!

3 REPLIES 3

Former Member
0 Kudos

hello,

If you are making a select stm....try on the where....using between.

bye

Gabriel

Former Member
0 Kudos

Use this FM CCM_GO_BACK_MONTHS

Enter the current date &

the number of month you want to goback + 1

(for excluding current month).

DATA: current_YYYYMM TYPE RSCALMONTH,

past_YYYYMM TYPE RSCALMONTH.

current_YYYYMM = SY-DATUM(6).

ADD 1 to current_YYYYMM. '<------exclude current month.

past_YYYYMM = 'date output from the above FM'(6).

Now select the record from table:

using

SELECT *

FROM <>

WHERE <YYYYMM> BETWEEN (current_YYYYMM AND past_YYYYMM).

Regards,

A.Singh

Message was edited by:

Amarjit Singh

Former Member
0 Kudos

Hi Daren

try this way

SO_HZFRM-LOW is Selection option From Date

SO_HOZTO-LOW is Selection option To date

this is work properly

*-- Select green tyres and there quantity

SELECT ZGREEN_TY ZOUTSTND_QTY

INTO CORRESPONDING FIELDS OF TABLE IT_GREEN_REQPLAN

FROM ZTAB_PP_001

WHERE ZALLOC_FROM GE SO_HZFRM-LOW

AND ZALLOC_TO LE SO_HOZTO-LOW

AND ZPLANT EQ SO_PLANT-LOW

AND ZACTIVE = 'YES'.

Rewards if helpful.