11-07-2007 3:41 PM
Hello.
I'm looking for a FM that I give a date (i.e. vbak-auart) and a payment term (i.e. vbkd-zterm) and I want a date auart+"zterm"-days.
I've been lookin on the forums but I can't find something helpfull. I know that it exists because I have used some time ago bat now I can't remember.
Thank everybody.
11-07-2007 3:48 PM
oi Marcos,
*tem como explicar melhor o q precisa?
can u plx explain better what u r needing?
about zterm its a date?
and days, it's fixed value?
Regards
Allan Cristian
11-07-2007 3:55 PM
OK
Imagine that situation:
auart = 07.11.2007 (today)
zterm = to pay in 10 days without discounts
new_date=17.11.2007
I meen:
CALL FUNCTION "function_searced"
EXPORTING
date = myauart
zterm = myzterm
IMPORTING
output = my_new_date.
You know what i mean? Thank.
11-07-2007 4:02 PM
Hi,
You can do this using FM ADD_TIME_TO_DATE
CALL FUNCTION 'ADD_TIME_TO_DATE'
EXPORTING
I_IDATE = auart
I_TIME = zterm
I_IPRKZ = 'J'
IMPORTING
O_IDATE = new_date.
Regards,
Nicolas.
11-07-2007 4:04 PM
hi Marcos
try it:
data: auart type sy-datum,
zterm type I,
new_date type sy-datum.
auart = sy-datum.
zterm = 10.
new_date = auart + zterm.
write: new_date.
Regards
Allan Cristian
11-07-2007 4:14 PM
This is not what I'm looking for.
There is a DB table that keep the payment terms and there is a function that read this table using de zterm key and take the date that you have give and add the days under the zterm table key:
Imagine this situation:
ZTERM = D010 to pay in 15 days without discounts and the pay have to be made on 5th day of month.
AUART = 07.11.2007 (today)
The FM have to give
DATE = 05.12.2007
as a resoult. (07.11.2007+15 days = 22.11.2007; pay have to be made 5th result = 05.12.2007)
If date is 16.11.2007 the FM resoult have to be 05.12.2007 and so on.
This functión exist, because I have used before.
Thank you very much.
11-07-2007 4:17 PM
Try this below given code:
I took the AUDAT for this report because AUART is the doc type, not a date..:)
REPORT ZTEST_NP.
DATA: L_T052 LIKE T052,
L_NETDT LIKE SY-DATUM,
REFE TYPE P.
PARAMETERS: P_AUDAT TYPE VBAK-AUDAT OBLIGATORY,
P_ZTERM TYPE T052-ZTERM OBLIGATORY.
START-OF-SELECTION.
SELECT SINGLE *
FROM T052
INTO L_T052
WHERE ZTERM = P_ZTERM.
IF NOT L_T052-ZSTG3 IS INITIAL.
REFE = L_T052-ZSTG3.
ELSE.
IF NOT L_T052-ZSTG2 IS INITIAL.
REFE = L_T052-ZSTG2.
ELSE.
REFE = L_T052-ZSTG1.
ENDIF.
ENDIF.
L_NETDT = P_AUDAT + REFE.
WRITE: L_NETDT.
Regards,
Naimesh Patel
11-07-2007 4:22 PM
11-07-2007 5:15 PM
hi Marcos,
try it:
TABLES: zterm.
PARAMETERS: auart TYPE sy-datum,
p_zterm(4).
DATA: ti_zterm TYPE STANDARD TABLE OF zterm WITH HEADER LINE,
new_date TYPE sy-datum.
WRITE: / auart.
SELECT SINGLE * FROM zterm INTO ti_zterm WHERE id = p_zterm.
READ TABLE ti_zterm.
new_date = auart + ti_zterm-paymdays.
WRITE: / new_date.
IF new_date+6(2) > 5.
new_date4(2) = new_date4(2) + 1.
ENDIF.
new_date+6(2) = 5.
WRITE: / new_date.
*Table ZTERM has the values:
*D009 5
*D010 15
*D011 18
Regards
Allan Cristian