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

find the date functions

Former Member
0 Likes
760

hello,how can i find the weeks pass the date what i input,if have any functions?

for example,i creat one PO on 2006.8.7,next time,i will judge the PO was pass 4 weeks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
732

Hi

Not sure about your requirement, if you want to add or subtract no.of weeks for a date you can try using FM: HRWPC_BL_DATES_WEEK_INTERVAL.

Kind Regards

Eswar

Note: Reward for helpful answers.

6 REPLIES 6
Read only

Former Member
0 Likes
732

Here u can use a fm for a financial year. This will solve the problem but i think this is not the correct FM as u have to pass one more parameter i.e, the tax_year_begin. just check it out once if it helps u.

HR_IE_NUM_PRSI_WEEKS

Read only

amit_khare
Active Contributor
0 Likes
732

Hi,

I am unablt o see any direct FM there for this.

But you can go like this, ?Use this FM DATE_GET_WEEK with Current date and then again with that PO date.

It will return you the Calender Week for both you can subtract it and there is your result.

Hope you find it helpful.

Regards,

Amit

Read only

Former Member
0 Likes
733

Hi

Not sure about your requirement, if you want to add or subtract no.of weeks for a date you can try using FM: HRWPC_BL_DATES_WEEK_INTERVAL.

Kind Regards

Eswar

Note: Reward for helpful answers.

Read only

Former Member
0 Likes
732

Hi,

DATA: weeknum1 LIKE SCAL-WEEK,

weeknum2 LIKE SCAL-WEEK,

week_diff type i.

CALL FUNCTION 'DATE_GET_WEEK'

EXPORTING

date = '20060907'

IMPORTING

WEEK = weeknum1

EXCEPTIONS

DATE_INVALID = 1

OTHERS = 2.

CALL FUNCTION 'DATE_GET_WEEK'

EXPORTING

date = '20060807'

IMPORTING

WEEK = weeknum2

EXCEPTIONS

DATE_INVALID = 1

OTHERS = 2.

week_diff = weeknum1 - weeknum2.

write : 'No of weeks pass ' , week_diff.

Rgds,

Shakuntala

Read only

0 Likes
732

THANK YOU EVERYONE.

Read only

0 Likes
732

>

> week_diff = weeknum1 - weeknum2.

>

> write : 'No of weeks pass ' , week_diff.

>

> Rgds,

> Shakuntala

Sorry but this is the worst idea I can imagine. Hopefully you never used that in a productive environment. I'm now in a similar situation and found your thread while looking for some ideas to avoid unnecessary coding. Ok, it's now almost three years old, but perhaps someone might still read this.

Let weeknum1 be '200903' and weeknum2 be '200843' (yes, the FM returns YYYY.WW). Then the (mathematical) difference would be 60 "weeks", i.e. more than one year?? I don't think so.

Please be more carefully and test your coding against situations that one does not think about in the first moment, e.g. a change of year between to dates.

Regards,

Andreas