2006 Sep 18 12:10 PM
hi everybody there
as i have to calculate the vendor ageing
which is nothing but
AGEING = Currentdate - BLINE date
so for this i have coded as follows and use the function module but couldn't get the result .it is alwayas showing 0 means ageing is o but it is not like that
parameter:p_date1 type dats.
call function 'days_between_two_dates'
exporting
i_datum_bis = p_date1
i_datum_von = itab-zfbdt
importing
e_tag = itab-ageing
exceptions
days_method_not_defined =1
others = 2.
so what is the bug in it.
hi everybody there
as i have to calculate the vendor ageing
which is nothing but
AGEING = Currentdate - BLINE date
so for this i have coded as follows and use the function module but couldn't get the result .it is alwayas showing 0 means ageing is o but it is not like that
parameter:p_date1 type dats.
call function 'days_between_two_dates'
exporting
i_datum_bis = p_date1
i_datum_von = itab-zfbdt
importing
e_tag = itab-ageing
exceptions
days_method_not_defined =1
others = 2.
so what is the bug in it.
2006 Sep 18 12:15 PM
hi,
chk this.
PARAMETER:p_date1 TYPE <b>dats</b>,
p_date2 TYPE dats.
DATA:lv_diff TYPE <b>i</b>.
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = p_date1
i_datum_von = p_date2
IMPORTING
e_tage = lv_diff
EXCEPTIONS
days_method_not_defined = 1
OTHERS = 2.
IF sy-subrc = 0.
WRITE:/ lv_diff.
ENDIF.
rgds
anver
2006 Sep 18 12:28 PM
see anvera
i don't need both the dates to passed as parameter
i want only one date to be passed as parameter that is current date or whatever date i wish to pass.
but the second date it should pick up from table BSIK
in which one field is there ZFBDT which is nothing but
BLINE DATE
so ageing should be calculated in this way.
2006 Sep 18 12:33 PM
hi,
<b>data: p_date2 like BSIK-ZFBDT.</b>
DATA:lv_diff TYPE i.
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = <b>sy-datum</b>
i_datum_von = p_date2
IMPORTING
e_tage = lv_diff
EXCEPTIONS
days_method_not_defined = 1
OTHERS = 2.
IF sy-subrc = 0.
WRITE:/ lv_diff.
ENDIF.
nw it will work.
rgds'
anver
2006 Sep 18 12:58 PM
still after trying this also i am not getting solution.
plz yaar help me
2006 Sep 18 12:35 PM
Hi,
instead of FM use below logic
lv_age = lv_date1 - itab-zfbdt.
if lv_age > 0.
endif.
Regards
amole
2006 Sep 18 12:37 PM
hi sanjev,
use only FM.
bcoz they will consider the leap year and other problems automatically.
don try to find the difference directly.
rgds
anver
2006 Sep 18 12:42 PM
Hi,
parameter:p_date1 type dats.
p_date1 = sy-datum.
pass sy-datum in user date format separated by .
check USR01 table assume it is '.' in below example
'17.09.2006'.
itab-zfbdt = '17.08.2006'.
Now pass this values you will get ageing as 30
call function 'days_between_two_dates'
exporting
i_datum_bis = p_date1
i_datum_von = itab-zfbdt
importing
e_tag = itab-ageing
exceptions
days_method_not_defined =1
others = 2.
Regards
amole
2006 Sep 18 12:59 PM
i am not getting you clearly that what r u telling to do
plz make it clear
2006 Sep 18 1:13 PM
hi,
<b>declare ur internal table field , of type BSIK-ZFBDT or sy-datum
thats the only thing u want to do.
the other parameter is sy-datum</b>
<b>data: field like BSIK-ZFBDT.</b>
DATA:lv_diff TYPE i.
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
<b>i_datum_bis = sy-datum
i_datum_von = field</b>
IMPORTING
e_tage = <b>lv_diff</b>
EXCEPTIONS
days_method_not_defined = 1
OTHERS = 2.
IF sy-subrc = 0.
WRITE:/ <b>lv_diff</b>.
ENDIF.
nw it will work.
rgds'
2006 Sep 18 3:43 PM
Hi Sanjeev,
your itab-ageing should be of 'i' type if u are declaring of 'n', it will give u '0' only.
-Anu