Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

How to calculate difference between two dates and insert result into a variable.

$
0
0

Diff = date_today - tag

*date_today: today's date.

*tag : is always an earlier date than today's date.

 

tag is a field in table ztab.

 

i have coded:

 

DATA :

  date_today  TYPE sy-datum,

  w_days TYPE i,

  w_months TYPE i,

  w_years TYPE i.

 

date_today  = sy-datum .

 

 

CALL FUNCTION 'C14B_DIFF_BT_2_DATES'

 

  EXPORTING

i_date_from = wa_ztab-tag 

i_date_to = date_today

 

IMPORTING

e_days = w_days

e_months = w_months

e_years = w_years

 

  EXCEPTIONS

plausibility_check_failed = 1.

 

WRITE /:

  w_days,

  w_months,

  w_years.

 


 

Q) will the following code work right? if yes, then how can i insert the result into "diff" variable ??


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>