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: 

Date Range Dynamic Selection Variant

former_member279275
Participant
0 Kudos

Hi Expert,

Not sure am I use a correct discussion forum. I would like to set SAP standard report date range with dynamic date variant. My criteria for the date is beginning of the month to yesterday date. Eg. today is 8-Jul-2015, date range should show from 1-Jul-2015 to 7-Jul-2015.

I checked existing date dynamic selection variables but no such condition. I can only set To Date with Current -1 but not From Date. Anyone can help ? Thank you.

Regards,

Oscar

1 ACCEPTED SOLUTION

jogeswararao_kavala
Active Contributor
0 Kudos

Hello Oscar,

Assuming that your query is for a Selection screen of Standard report as you mentioned. Then....it looks very much possible.

Select First day of current month option for From Date .

Select Current date +/- ??? days option for To Date by giving value  -1  for ???.

Regards

KJogeswaraRao

4 REPLIES 4

jogeswararao_kavala
Active Contributor
0 Kudos

Hello Oscar,

Assuming that your query is for a Selection screen of Standard report as you mentioned. Then....it looks very much possible.

Select First day of current month option for From Date .

Select Current date +/- ??? days option for To Date by giving value  -1  for ???.

Regards

KJogeswaraRao

ipravir
Active Contributor
0 Kudos

Hi Oscar,

You can write a small code at INITIALIZATION event of the report.

if so_date is range table.

so_date-low= sy-datum+0(4) && sy-datum+4(2) && '01'.

so_date-high = sy-datum - 1.

so_date-sign = 'I'.

so_date-option = 'BT'.

append so_date.

Once the screen get display, you will get default set date.

or you can use RS_CREATE_VARIANT function to create static variant.

Regards,

Praveer.

former_member279275
Participant
0 Kudos

Hi All,

Thanks for your reply. As this is SAP standard report, I'm not prefer code change. As for Jogeswara's suggestion, the report selection date has a date range but in Variant Attribute, there is only one row of date field object. I can only make use of one selection variable and cannot define From and To date field separately.

Regards,

Oscar

0 Kudos

Hi Oscar

Quite right there only a couple of variants that permit for From and Date range setting and I don't think those will meet your requirements.

Another option is just to right a small front end Z Program which allow you to then have a variant in the format described by Jogeswara. This report can then submit the standard program.

Regards

Arden