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

All Dates between two given Dates

shaik_zia
Explorer
0 Likes
8,953

Hi,

I need all the dates between two given dates in select-options .

For example the range in select-options is 01/01/2007 - 31/03/2007 .

I need all the dates between the two given dates .

How can i do this .Is there any FM for this ?

Regards,

Zia

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,353

use this

CSCP_PARA1_GET_PERIODS

data:begin of daytab occurs 0.

include structure scscp_period_str.

data:end of daytab.

call function 'CSCP_PARA1_GET_PERIODS'

exporting

i_datuv = r_budat-low

i_datub = r_budat-high

i_timeunit = 'D'

tables

et_dates = daytab.

here u have to put one more logic.

loop at daytab where datuv in r_budat.

endloop.

So u will get all the dates

Regards

prabhu

5 REPLIES 5
Read only

Former Member
0 Likes
3,354

use this

CSCP_PARA1_GET_PERIODS

data:begin of daytab occurs 0.

include structure scscp_period_str.

data:end of daytab.

call function 'CSCP_PARA1_GET_PERIODS'

exporting

i_datuv = r_budat-low

i_datub = r_budat-high

i_timeunit = 'D'

tables

et_dates = daytab.

here u have to put one more logic.

loop at daytab where datuv in r_budat.

endloop.

So u will get all the dates

Regards

prabhu

Read only

Former Member
0 Likes
3,353

Use FM

CSCP_PARA1_GET_PERIODS

Read only

Former Member
0 Likes
3,353

hi dear

you can simply do this in abap coding

by just giving

if datfrom > datto in where condition of ur select program

reward points if useful

regards

amit singla

Read only

Former Member
0 Likes
3,353

its better to do in while ---endwhile.

I am here giving u pseudocode

date1 = 01/01/2007.

date2 =- 31/03/2007

while date1 <= date2.

date1= date1 + 1.

endwhile.

here at each loop pass u get a different date which is less than date2.

Hence u can get all the dates between those two dates.

regards,

Sujatha.

Message was edited by:

Sujatha Reddy

Read only

Former Member
0 Likes
3,353

Hi Shaik,

Plz check this out.

select-options: s_date for sy-datum.

s_date-low = '01/01/2007'.

s_date-sign = 'E'.

s_date-option = "EQ".

s_date-high = '31/03/2007'.

Regards,

Kiran B