Application Development and Automation 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: 
Read only

Variant for a Report

Former Member
0 Likes
1,370

Hello..

I have a report which has date as select option..

This report executes both in foreground and in background...

In foreground it runs for the date the user enters...

In background I want it should run for the current system date..The report will be scheduled daily at 11 pm. so each day it should take the current date as its input ...

How is this possible???

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,314

Hi,

If you are using SAP 4.7 versions, while saving the variant:

Give the variant name and description.

Then for the date variable , in the field attributes, click check box Selection variable. Then press selection variables button. Press Dynamic date calculation (Traffic light for D column will turn green).

Then click the list box, and select Current date.

Save the variant.

Best Regards,

Suresh

Hello..

I have a report which has date as select option..

This report executes both in foreground and in background...

In foreground it runs for the date the user enters...

In background I want it should run for the current system date..The report will be scheduled daily at 11 pm. so each day it should take the current date as its input ...

How is this possible???

10 REPLIES 10
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,314

At initialization.

p_date = sy-datum.

start-of-selection.

check sy-batch value and proceed.

Read only

Former Member
0 Likes
1,314

Set the the default date in selection screen by using Default Sy-datum.

Read only

Former Member
0 Likes
1,314

Hi

USe this piece of code:

INITIALIZATION.

if sy-batch = 'X'.

s_date-low = sy-datum.

endif.

Cheers

Ravish

Read only

Former Member
0 Likes
1,314

Just change the program where u used the select-options, there set the default value as sy-datum.

then if u run the report in background then it will take the current date.


SELECT-OPTIONS: date FOR sy-datum DEFAULT sy-datum.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,314

Hi,

Set the default value of date field as current date. Use INITIALIZATION event


SELECT-OPTIONS : s_datum FOR sy-datum.

INITIALIZATION.
  IF sy-batch = 'X'.
    s_datum-low = sy-datum.
  ENDIF.

Hope this helps you.

Regards,

Tarun

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
1,314

Hi

At Initialization section,you can set the selection-screen date field as you required and validate the same using sy-batch for background processing and else for foreground processing.

Regards,

Sreeram Kumar Madisetty

Read only

Former Member
0 Likes
1,315

Hi,

If you are using SAP 4.7 versions, while saving the variant:

Give the variant name and description.

Then for the date variable , in the field attributes, click check box Selection variable. Then press selection variables button. Press Dynamic date calculation (Traffic light for D column will turn green).

Then click the list box, and select Current date.

Save the variant.

Best Regards,

Suresh

Read only

0 Likes
1,314

Hi..Thanx...Ur answer solved my Problem....

Read only

Former Member
0 Likes
1,314

Hi All...

All the answers were of gr8 help...I got two solutions to my problem..

Thank u all...

Read only

Former Member
0 Likes
1,314

Hi,

If you are using SAP 4.7 versions, while saving the variant:

Give the variant name and description.

Click the check box, only for background processing.

Then for the date variable , in the field attributes, click check box Selection variable. Then press selection variables button. Press Dynamic date calculation (Traffic light for D column will turn green).

Then click the list box, and select Current date.

Save the variant.

If it is ECC 6.0,

Click the check box, only for background processing.

Then in the selection variable column for the DATE field, There will be an F4 help. Select D - Dynamic date calculation.

Then in name of variable (Input only using F4 column), press F4 and choose 'Current date'.

This is an easy solution by using Variants. There is no need to change your code, if you use this method.

Best Regards,

Suresh