08-28-2007 12:39 PM
hallow
i doing loop that check if tmp_begda < v_date1.
1.in the first time tmp_begda = 01012006 and v_date1 = 01012007
and if go to the end if (o.k.)
2.in the second time tmp_begda = <b>01022006</b> and v_date1 = 01012007
and i go to the else statment and do modify.
why tmp begda is less then v_date?
<b>tmp_begda and v_date type sy-datum.</b>
<b>i reward</b>
this is my code
loop....
IF tmp_begda < v_date1.
ELSE.
MOVE tmp_begda TO wa_period-date1.
MODIFY period_tbl FROM wa_period TRANSPORTING date1.
ENDIF.
ENDLOOP.
08-28-2007 12:45 PM
when you are comparing the dates should be of type sy-datum and should be in the format YYYYMMDD,
chk these 2 programs
REPORT ZTEST.
DATA : V_DATE1 LIKE SY-DATUM,
V_DATE2 LIKE SY-DATUM..
V_DATE1 = '01022006'.
V_DATE2 = '01012007'.
IF V_DATE1 LE V_DATE2.
WRITE : 'yes'.
ELSE.
WRITE : 'no'.
ENDIF.
<b>Output : No.</b>
REPORT ZTEST.
DATA : V_DATE1 LIKE SY-DATUM,
V_DATE2 LIKE SY-DATUM..
V_DATE1 = '20060201'.
V_DATE2 = '20070101'.
IF V_DATE1 LE V_DATE2.
WRITE : 'yes'.
ELSE.
WRITE : 'no'.
ENDIF.
<b>Output : Yes</b>
08-28-2007 12:41 PM
Hi!
SAP handles date in the following internal format: YYYYMMDD
If you are filling dynamically those fields, try using this format.
Regards
Tamá
08-28-2007 12:45 PM
when you are comparing the dates should be of type sy-datum and should be in the format YYYYMMDD,
chk these 2 programs
REPORT ZTEST.
DATA : V_DATE1 LIKE SY-DATUM,
V_DATE2 LIKE SY-DATUM..
V_DATE1 = '01022006'.
V_DATE2 = '01012007'.
IF V_DATE1 LE V_DATE2.
WRITE : 'yes'.
ELSE.
WRITE : 'no'.
ENDIF.
<b>Output : No.</b>
REPORT ZTEST.
DATA : V_DATE1 LIKE SY-DATUM,
V_DATE2 LIKE SY-DATUM..
V_DATE1 = '20060201'.
V_DATE2 = '20070101'.
IF V_DATE1 LE V_DATE2.
WRITE : 'yes'.
ELSE.
WRITE : 'no'.
ENDIF.
<b>Output : Yes</b>
08-28-2007 12:47 PM
Hi Tal,
If you pass any value to the variable to date field then it should be in the format YYYYMMDD and it will stored in the internal format as MMYYDDDD.
Check whether you are passing value to V_DATE1 as YYYYMMDD??
Thanks,
Vinay