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

function module usage in vendor ageing report for ageing calculation

Former Member
0 Likes
1,513

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.

10 REPLIES 10
Read only

anversha_s
Active Contributor
0 Likes
1,213

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

Read only

0 Likes
1,213

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.

Read only

0 Likes
1,213

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

Read only

0 Likes
1,213

still after trying this also i am not getting solution.

plz yaar help me

Read only

Former Member
0 Likes
1,213

Hi,

instead of FM use below logic

lv_age = lv_date1 - itab-zfbdt.

if lv_age > 0.

endif.

Regards

amole

Read only

0 Likes
1,213

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

Read only

Former Member
0 Likes
1,213

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

Read only

0 Likes
1,213

i am not getting you clearly that what r u telling to do

plz make it clear

Read only

0 Likes
1,213

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'

Read only

Former Member
0 Likes
1,213

Hi Sanjeev,

your itab-ageing should be of 'i' type if u are declaring of 'n', it will give u '0' only.

-Anu