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

Former Member
0 Likes
1,631

Hi,

I have a date 18.06.2006 and 18.11.2006,and i want to display in range s_date where 18.06.2006 to be 01.06.2006 and 18.11.2006 to be 30.11.2006.means in that begining date of the first month and last date of the second month should be display like s_date eq 01.06.2006 to 30.11.2006.i have the two dates in the internal table.now how to find the date range for the above dates.

Thanks,

Rajendra.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,225

TAKE YOUR DAY 18.06.2006.

VDATE = '20060618'

TAKE THREE VARIABLE V_YEAR = VDATE(4).

V_MON = VDATE+4(2).

V_DAY = '01'.

CONCATENATE V_YEAR V_MON V_DATE INTO VDATE1.

FOR LAST DAY USE FM 'LAST_DAY_OF_MONTHS' AND PASS THE VALE 18.11.2006.

REGARDS

SHIBA DUTTA

7 REPLIES 7
Read only

Former Member
0 Likes
1,225

Hi to polupate the first day of the month ..

s_date-sign = 'I'.

s_date-option = 'BT'.

simply put 01 in the internal table date .. say it_date-date+6(2) = '01'

and s_date-low = it_date-date

and for the last day use this FM.

RP_LAST_DAY_OF_MONTHS and pass the second day from the internal table

and pass this date to s_date-high.

Read only

Former Member
0 Likes
1,225

Hi,

Exactly wat do u mean by date range

Is it the diff betn 2 dates

then daterange = s_date-High - s_date-low

U can use this Fm to find last day of any month 'RE_LAST_DAY_OF_MONTH'

For the first day just s_date-low+6(2) = '01'.

Regards

bheema

Read only

Former Member
0 Likes
1,225

Hi Rajendra,

Please refer the below link to find the first & last day of the months,

Regards,

Hema.

    • Reward points if it is useful.

Read only

Former Member
0 Likes
1,225

for first day

use this ..

20061212

itab-date+4(4) = 0101.

or if it is

12122006

itab-date+0(4) = 0101.

this will capture the first day .

for the last day .

use the Fm

RP_LAST_DAY_OF_MONTHS

pass the next date to this and the o/p will be the last date of month .

hope this helps

regards,

vijay

Read only

Former Member
0 Likes
1,226

TAKE YOUR DAY 18.06.2006.

VDATE = '20060618'

TAKE THREE VARIABLE V_YEAR = VDATE(4).

V_MON = VDATE+4(2).

V_DAY = '01'.

CONCATENATE V_YEAR V_MON V_DATE INTO VDATE1.

FOR LAST DAY USE FM 'LAST_DAY_OF_MONTHS' AND PASS THE VALE 18.11.2006.

REGARDS

SHIBA DUTTA

Read only

Former Member
0 Likes
1,225

there is a function module to convert the data to initial and end data, do one thing try the function moudle to convert starting data using the function module and if u need end of data, split the date, month, year in to 3 variables and increment the year by 1 and convert the date to end date ur problem will be solved.

Read only

anversha_s
Active Contributor
0 Likes
1,225

hi,

chk this code. you can use ethis logic

tables: mkpf.


data : date like sy-datum.
data : date1 like sy-datum.

select-options: s_date for mkpf-budat.

initialization.

CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
EXPORTING
iv_date = sy-datum
IMPORTING
EV_MONTH_BEGIN_DATE = date
EV_MONTH_END_DATE = date1
.
s_date-option = 'EQ'.
s_date-sign = 'I'.
s_date-low = date.
s_date-high = date1.

append s_date.

Regards

Anver