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
667

Hi experts,

i want to know day of the perticular date,even when i add to the 5 years.

thanks in advance

chandu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
637

Use FM DATE_TO_DAY

Regards,

Atish

5 REPLIES 5
Read only

Former Member
0 Likes
638

Use FM DATE_TO_DAY

Regards,

Atish

Read only

0 Likes
637

Hi

When you want to get name of day by using date in ABAP/4, you can apply function module "DATE_TO_DAY".

Check this sample


*&---------------------------------------------------------------------*
*&     Form get_name_of_day
*&---------------------------------------------------------------------*
FORM get_name_of_day USING   PAR_DATUM
                    CHANGING PAR_DAY_NAME.
clear par_day_name.
CALL FUNCTION ’DATE_TO_DAY’
   EXPORTING
     DATE         = par_datum
   IMPORTING
     WEEKDAY      = par_day_name
           .

ENDFORM.                   " get_name_of_day

Check this link

http://www.dbforums.com/archive/index.php/t-581692.html

http://sap.ionelburlacu.ro/abap/sap2/SAP_Functions.html

Regards

Pavan

Read only

Former Member
0 Likes
637

hi,

try using :

CALCULATE_DATE : Calculates the future date based on the input .

DATE_TO_DAY : Returns the Day for the entered date.

plz reward if useful..

Read only

Former Member
0 Likes
637

CALL FUNCTION 'MONTH_PLUS_DETERMINE'

EXPORTING

months = 1 " Number your months in your year

olddate = sy-datum " your date.

IMPORTING

newdate = gs_date.

write gs_date.

CALL FUNCTION 'RH_GET_DATE_DAYNAME'

EXPORTING

LANGU = SY-LANGU

DATE = gs_date

IMPORTING

DAYTXT = dd

EXCEPTIONS

NO_LANGU = 1

NO_DATE = 2

NO_DAYTXT_FOR_LANGU = 3

INVALID_DATE = 4

OTHERS = 5.

write dd.

regards

sayan

Read only

Former Member
0 Likes
637

Hi,

We can use FM DATE_TO_DAY or DATE_COMPUTE_DAY(Pro grammatically)

Sample code:

clear: hold_day_of_week.

CALL FUNCTION 'DATE_COMPUTE_DAY'

EXPORTING

DATE = workdate

IMPORTING

DAY = day_of_week_num

EXCEPTIONS

OTHERS = 8.

CASE day_of_week_num.

WHEN 1.

hold_day_of_week = 'Monday'.

WHEN 2.

hold_day_of_week = 'Tuesday'.

WHEN 3.

hold_day_of_week = 'Wednesday'.

WHEN 4.

hold_day_of_week = 'Thursday'.

WHEN 5.

hold_day_of_week = 'Friday'.

WHEN 6.

hold_day_of_week = 'Saturday'.

WHEN 7.

hold_day_of_week = 'Sunday'.

WHEN OTHERS.

hold_day_of_week = 'invalid'.

ENDCASE.

or

You can use DATE_COMPUTE_DAY to get the day number of the week (for example, today gives 5)

then use WEEKDAY_GET which returns an itab with seven entries (one for each day of the week.)

You enter in this itab and get the field langt to get the day name.

Reward if helpful.

Regards,

Harini.S