Application Development 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: 

"D2008178" - FM to calculate the date of the x day in a year

Former Member
0 Kudos
232

Hi all!

I am looking for a FM to calculate the date of a certain day in the year.

For example which date has the day 178 of the year.

This has nothing to do with the factory calendar!!!

Thanks a lot for your help

CU

Peter

10 REPLIES 10

Former Member
0 Kudos
112

hi,

FM Date_to_day

try this this will give you the day according to the date

regards

sarves

Former Member
0 Kudos
112
parameters:
	p_days type i.
Data:w_date type sy-datum default sy-datum.

w_date+4(4) = '0101'.

w_date = w_date + p_days.

if w_date > sy-datum .

write 😕 'date in future', w_Date.

else.

write : w_date.

endif.

Regards,

Gurpreet

Subhankar
Active Contributor
0 Kudos
112

Hi...

You can add date,month,year to a certain date using the FM HR_SGPBS_ADD_TIME_TO_DATE .

Thanks

Subhankar

Edited by: Subhankar Garani on Feb 18, 2009 1:37 PM

Former Member
0 Kudos
112

This is jJulian date. you can look to convert julian to normal date. use OIUH_PWFROMJULIANDT FM, pass your day in format dddyyyy to date paramter there.

Former Member
0 Kudos
112

Try HR_AUPBS_MONTH_DAY

Regards

Shashi

Former Member
0 Kudos
112

hi,

Use Gurpreet code and use the function module i mentioned to get the day of the year.

regards

sarves

Former Member
0 Kudos
112

Try function CALCULATE_DATE.

-allan

Former Member
0 Kudos
112

Hi all!

Thanks for all your help...

Best solutions are the FM OIUH_PWFROMJULIANDT and the code snippet Gurpreet.

Sometimes you don´t see the trees in a forrest... ))

CU

Peter

SuhaSaha
Advisor
Advisor
0 Kudos
112

Hello Peter,

I think you can try this coding & i donot think you need a FM for this:

DATA:
v_first_dt TYPE datum,
v_date TYPE datum.

CONCATENATE sy-datum+0(4) '0101' INTO v_first_dt.

* Calculate the nth day of the year
v_date = v_first_dt + 178.

WRITE: v_date.

BR,

Suhas

0 Kudos
112

Hi Peter,

Please check this funtion module "FIMA_DATE_CREATE".

Sample code as follows:

REPORT ztest_vinay.

DATA: w_date TYPE vtbbewe-dvalut.

PARAMETERS: p_date TYPE vtbbewe-dvalut.

CALL FUNCTION 'FIMA_DATE_CREATE'

EXPORTING

i_date = p_date " Here you need to pass first day of the year

i_calendar_days = 178

IMPORTING

e_date = w_date.

WRITE: w_date.

Regards,

Vinay

Edited by: Vinay Kumar Amruth on Feb 18, 2009 2:52 PM

Edited by: Vinay Kumar Amruth on Feb 18, 2009 3:01 PM