cancel
Showing results for 
Search instead for 
Did you mean: 

Number of days.

Former Member
0 Kudos

BKPF-BUDAT + [BSEG-ZBD1T u2013 day of today = days in arrears (invoice was due)

above logic how i will put in my sap script using subroutine.

BKPF-BUDAT + [BSEG-ZBD1T u2013 day of today = days in arrears .

EX: 20.04.2009 + 30 - 15.05.2005 = 24

How can i show above logic in my script using subroutines.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

You can call a subroutine of any program using the statement:

PERFORM GET_DATE IN PROGRAM XXXX

USING &BKPF-BUDAT&

USING &BSEG-ZBD1T&

CHANGING &W_DATE&

ENDPERFORM

In the variable w_date you will get the calculated date which can be used in the script

Thanks,

Sowmya

Answers (2)

Answers (2)

Former Member
0 Kudos

HI,

/: PERFORM <form> IN PROGRAM <prog>
/: USING &BKPF-BUDAT&
/: USING &BSEG-ZBD1T &
/: CHANGING &W_DATE&
/: ENDPERFORM

FORM <form> TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
DATA : 
BUDAT TYPE SY-DATUM,
ZBD1T TYPE SY-DATUM,
W_DATE TYPE I.

READ TABLE IN_PAR WITH KEY u2018BKPF-BUDATu2019.
CHECK SY-SUBRC = 0.
BUDAT = IN_PAR-VALUE.

READ TABLE IN_PAR WITH KEY u2018BSEG-ZBD1T' .
CHECK SY-SUBRC = 0.
ZBD1T = IN_PAR-VALUE.

w_date =  BUDAT  +  ZBD1T - SY-DATUM.

READ TABLE IN_PAR WITH KEY u2018W_DATE' .
CHECK SY-SUBRC = 0.
MODIFY OUT_PAR INDEX SY-TABIX

ENDFORM.

For more help refer to this link..http://help.sap.com/saphelp_40b/helpdata/en/d1/803279454211d189710000e8322d00/content.htm

Former Member
0 Kudos

Hi,

By creating the SUBROUTINE POOLS, call the perform with the required export, import parameters, and code accordingly for the perform in the subroutine pool.

It works!!!!

Regards,

Santhosh.