Logic For Calculating Net Due Date with payment term and baseline date
Instead of using a Function Module for calculating the Net due date, the following logic could be used. For a few requirements where you don’t want to consider t052-zfael and t052-zmona while calculating the net due date this logic could be used. For example for payement term FB00 the calender days for baseline date(zfael) and additional months(zmona) are ‘0’ . But for FO10 , zfael = 10, zmona = 2, so when your baseline date is 05.10.2012 your net date would become 10.12.2012.
SELECT *
INTO w_t052
FROM t052
UP TO 1 ROWS
WHERE zterm EQ bsad-zterm.
ENDSELECT.
IF w_t052-ztag3 GT 0.
w_zfbdt = bsad-zfbdt + w_t052-ztag3.
ELSEIF w_t052-ztag2 GT 0.
w_zfbdt = bsad-zfbdt + w_t052-ztag2.
ELSEIF w_t052-ztag1 GT 0.
w_zfbdt = bsad-zfbdt + w_t052-ztag1.
ELSE.
MOVE bsad-zfbdt TO w_zfbdt.
ENDIF
IF w_zfbdt GT sy-datum AND
bsad-shkzg EQ c_credit AND
t001-land1 NE ‘XX’.
MOVE sy-datum TO w_zfbdt.
ENDIF