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

Former Member
0 Likes
1,338

Hye techies,

I have 2 requirements.

1. I want to know the current week in a year if i input a date. Example if i enter 01.01.2007 then the output should be 1.

2. I want to knw the day for the entered date.

thanks in advance.

Regards,

Imran.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,269

Hi,

With the help of this function you can get the current week according to date...

data: date1 type sy-datum.

date1 = '20080205'.

data: week1 type scal-week.

CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'

EXPORTING

DATE = date1

IMPORTING

WEEK = week1.

  • MONDAY = monday1

  • SUNDAY = sunday1.

write:/ week1 .

Thanks & Regards

Ashu Singh

13 REPLIES 13
Read only

JozsefSzikszai
Active Contributor
0 Likes
1,269

hi Imran,

1. HRIQ_DATE_GET_WEEK (for the aboe example you'll get 200701)

2. ISP_GET_WEEKDAY_NAME (you have to add the language as well)

hope this helps

ec

Read only

Former Member
0 Likes
1,269

Hi,

Check these FM's.

GET_WEEK_INFO_BASED_ON_DATE or DATE_TO_DAY

DATE_TO_DAY

thanks,

Ananth

Read only

Former Member
0 Likes
1,269

Hi,

1] Date_Get_Week FM which will give output as yearweek

2] Date_to_dat FM which will give output day.

Thanks

Sudharshan

Read only

Former Member
0 Likes
1,269

Hi Imran,

Check these funciton modules.

DATE_GET_WEEK : Returns week for a date

DATE_TO_DAY : Returns the Day for the entered date.

DATE_COMPUTE_DAY : Returns weekday for a date

Hope this helps you.

Regards,

Chandra Sekhar

Read only

Former Member
0 Likes
1,269

Hi,

Use these FMs

1) GET_WEEK_INFO_BASED_ON_DATE

2) DAY_IN_WEEK

\[removed by moderator\]

Bhupal

Edited by: Jan Stallkamp on Jul 25, 2008 11:03 AM

Read only

former_member673464
Active Contributor
0 Likes
1,269

hi,

For your requirements use the following function modules.

GET_WEEK_INFO_BASED_ON_DATE or DATE_GET_WEEK for week.

DAY_IN_WEEK for day.

Read only

Former Member
0 Likes
1,269

Hi,

To get the Day of particular Date use

FM

Date_compute_day.

For Week use FM

Date_get_week.

Regards,

Sujit

Read only

Former Member
0 Likes
1,269

Hi Imran,

Chk the FM's:

RH_GET_DATE_DAYNAME

return the day based on the date provied

DATE_GET_WEEK

will return the week that a date is in.

DAY_ATTRIBUTES_GET

Return useful information about a day. Will tell you the day of the week as a word (Tuesday), the day of the week (2 would be Tuedsay), whether the day is a holiday, and more

With luck,

Pritam.

Read only

Former Member
0 Likes
1,270

Hi,

With the help of this function you can get the current week according to date...

data: date1 type sy-datum.

date1 = '20080205'.

data: week1 type scal-week.

CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'

EXPORTING

DATE = date1

IMPORTING

WEEK = week1.

  • MONDAY = monday1

  • SUNDAY = sunday1.

write:/ week1 .

Thanks & Regards

Ashu Singh

Read only

Former Member
0 Likes
1,269

hi,

try any one of these

FM FOR DATE CONVERSION

u2022 Use FM CONVERSION_EXIT_SDATE_INPUT.

u2022 CONCATENATE sy-datum6(2) sy-datum4(2) sy-datum(4) INTO ... SEPARATED BY '.'.

u2022 use FM CONVERSION_EXIT_PDATE_OUTPUT

u2022 CONVERT_DATE_TO_INTERN_FORMAT Converts a date to internal format

PDOT_DATE_CONVERT Convert date (yyyymmdd >dd.mm.yyyy)

u2022 REPORT ZTEST.

DATA : V_DATE LIKE SY-DATUM,

V_DATE1(10).

V_DATE = '20070101'.

CONCATENATE V_DATE6(2) V_DATE4(2) V_DATE+0(4) INTO V_DATE1.

WRITE : V_DATE1.

Some of the FM are used are:

HR_HK_CONV_DATE_TO_INTN_FORMA

PT_IAC_GET_DATE_FORMAT

CONVERT_DATE_TO_INTERN_FORMAT

VALIDATE_BILLING_FORMAT

HRGPBS_HESA_DATE_FORMAT

HRGPBS_TPS_DATE_FORMAT

CONVERT_DATE_FORMAT

SLS_MISC_GET_USER_DATE_FORMAT

SPP02_SET_DATEFORMAT

\[removed by moderator\]

siri

Edited by: Jan Stallkamp on Jul 25, 2008 11:03 AM

Read only

Former Member
0 Likes
1,269

Hi Imran,

sorry in previous post i did not post the solution to ur second query..

wid this function u will get day according to the entered date..

data:day type DTRESR-WEEKDAY.

data date1 type D.

date1 = sy-datum.

CALL FUNCTION 'DATE_TO_DAY'

EXPORTING

date = date1

IMPORTING

WEEKDAY = day.

write:/ day.

Thanks & Regards

Ashu Singh.

Read only

Former Member
0 Likes
1,269

Hi,

u can use these FM.

date_get_week -- it returns the week for a date.

date_to_day -- it returns the day for the entered date.

Read only

Former Member
0 Likes
1,269

Hi,

Check the following Functional modules,it will help you.

DATE_GET_WEEK : Returns week for a date

DATE_TO_DAY : Returns the Day for the entered date.

Hope it is helps.

Regards,

T.D.M.