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

regarding date

Former Member
0 Likes
836

hi experts,

i have a simple problem. i want to display one report. in this report, i want display date. Means, in one column, i want to display difference b/w dates. i took a one local variable.

Problem: if dates are same, it doesn't display any thing, it shows only blank. how can i define that variable in date format?

Thanks in advance!!!

8 REPLIES 8
Read only

Former Member
0 Likes
791

declare variable as

l_date type sy-datum.

if the difference is 0, then populate l_date with 00000000

Read only

Former Member
0 Likes
791

hi Babu Anagani

if you want to display the differnce between 2 dates means

HR_99S_INTERVAL_BETWEEN_DATES use FM and declare one seperate variable of data type numeric and pass the FM return DAYS to that Variable

Regards

Deva

Read only

bpawanchand
Active Contributor
0 Likes
791

Hi

data :
  w_d1 type sy-datum,
  w_d2 type sy-datum,
  w_diff type d.


w_d1 = sy-datum.
w_d2 = sy-datum.

w_diff = w_d1 - w_d2.

if w_diff is initial.
   write :
     / w_diff.  "<<<<----- 00000000
else.
  write :
     / w_diff.    "<<<<------Number of days between the w_d1 & w_d2
endif.

Regards

Pavan

Read only

Former Member
0 Likes
791

Hi Babu,

Declare the variable as type sy-datum, in which you are displaying the difference of dates.

data:
w_date type sy-datum,
w_date1 type sy-datum,
w_diff type sy-datum.

w_date = sy-datum.
w_date1 = sy-datum.

w_diff = w_date - w_date1.

write: w_date.

Regards,

Chandra Sekhar

Read only

Former Member
0 Likes
791

Hi..

if you want difference in no. of DAYS,

use

DTRESR-WEEKDAY

Thanks,

Gaurav J.

Read only

Former Member
0 Likes
791

data : t_data type sy-datum .

t_date = date1 - date 2

if t_data = '00000000'

write blank

else

write date

endif

~hitesh

Read only

Former Member
0 Likes
791

Hi Babu,

Try the FM below:

SD_DATETIME_DIFFERENCE

Give the difference in Days and Time for 2 dates

With luck,

Pritam.

Read only

Former Member
0 Likes
791

HR_ECM_GET_PERIOD_BETW_DATES

using this u can find difference between the dates

hope this will be useful for you