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

Date Range on Selection Screen not working

adeel_sarwar
Contributor
0 Likes
864

Hi All,

I have a selection screen with 3 selection options on there to run a report.

1) Today

2) Yesterday

3) This week

Now the first two are working fine but number 3 This Week isn't. Any reason why? This week basically means Monday to Friday of this week. E.g. If I have This week Clicked on Monday it would just show Mondays result, if I run this report on Wednesday with This week clicked it should show Monday, Tuesday & Wednesday.

Regards

Adeel

FORM posting_date .

*

CLEAR : rg_finl.

IF rb_1 = 'X'.

rg_finl-sign = 'I'.

rg_finl-option = 'EQ'.

rg_finl-low = sy-datum.

APPEND rg_finl.

CLEAR rg_finl.

ELSEIF rb_2 = 'X'.

rg_finl-sign = 'I'.

rg_finl-option = 'EQ'.

rg_finl-low = sy-datum - 1.

APPEND rg_finl.

CLEAR rg_finl.

ELSEIF rb_3 = 'X'.

rg_finl-sign = 'I'.

rg_finl-option = 'BT'.

rg_finl-low = sy-datum.

rg_finl-high = sy-datum - 7.

APPEND rg_finl.

CLEAR rg_finl.

ELSEIF rb_4 = 'X'.

rg_finl[] = s_budat[].

ENDIF.

*

ENDFORM.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
733

Hi,

In the third case, LOW & HIGH values are reversed. Try changing them, might work.

LOW = SY-DATUM-7.

HIGH = SY-DATUM.

Regards,

Manne.

5 REPLIES 5
Read only

Former Member
0 Likes
734

Hi,

In the third case, LOW & HIGH values are reversed. Try changing them, might work.

LOW = SY-DATUM-7.

HIGH = SY-DATUM.

Regards,

Manne.

Read only

Former Member
0 Likes
733

Hello

You a wrong:

Instead


rg_finl-low = sy-datum.
rg_finl-high = sy-datum - 7.

you need:



rg_finl-low = sy-datum - 7.
rg_finl-high = sy-datum.

Read only

Former Member
0 Likes
733

HI ,

use this Fm

HRWPC_BL_DATES_WEEK_INTERVAL

BWSO_DATE_GET_FIRST_WEEKDAY

for week calculation.

Regards,

Vijay

Read only

0 Likes
733

Hi All,

Thanks for your comments. It works now. Vijay, I know enought ABAP to get me by this was a problem by a programmer just trying to fix it.

Any chance you could help me with a code snipplet which I could write and get this working as per your FM?

Thanks

Read only

venkat_o
Active Contributor
0 Likes
733

Change

rg_finl-low = sy-datum.
rg_finl-high = sy-datum - 7.

To

rg_finl-low = sy-datum  - 7.
rg_finl-high = sy-datum.

Thanks

Venkat.