cancel
Showing results for 
Search instead for 
Did you mean: 

how to get data for a previous month

Former Member
0 Kudos

I have this date as Number and in YYYYMMDD

I want to run the report automatically after the previous month.

{CLSPAYTP.OTTRND} in 20150401 to 20150430 and

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Paul,

See if this works:

cdate(picture(totext({CLSPAYTP.OTTRND},'#'), 'xxxx/xx/xx')) IN LastFullMonth


P.S: If the report is based off of a SQL Query, I would recommend adding this to the where clause instead of doing this in the selection formula.

If the report is based off of a Table/View, you should consider creating a 'SQL Expression' that converts the number field to date and then use that SQL Expression in the selection formula for better performance.


-Abhilash

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

First extract the MM from YYYYMMDD and then get previous month by subtraction i.e, MM - 1.

And then concatenate it in the format YYYYMMDD and use.

Ramji

Former Member
0 Kudos

Hi Paul,

please go thorugh the following threads , i hope it would give you some insight.

http://scn.sap.com/thread/1108650

and

http://crystaltricks.com/wordpress/?p=159

Regards

Ganesh