2006 Aug 25 6:10 PM
data year type i.
year = input+6(4).
IF input+8(2) EQ '00'.
IF year MOD 400 EQ '0'.
leap = 'X'.
ENDIF.
ELSEIF year MOD 4 EQ '0'
leap = 'X'.
ENDIF.
whats wrong in this code!
Thanks,
Bharat
2006 Aug 25 6:16 PM
data year type i.
data modval1 type i.
data modval2 type i.
year = input+6(4).
modval1 = year MOD 400.
modval2 = year MOD 4.
IF input+8(2) EQ '00'.
IF modval1 EQ 0.
leap = 'X'.
ENDIF.
ELSEIF modval2 EQ 0
leap = 'X'.
ENDIF.
Change it like this it will work.
data year type i.
data modval1 type i.
data modval2 type i.
year = input+6(4).
modval1 = year MOD 400.
modval2 = year MOD 4.
IF input+8(2) EQ '00'.
IF modval1 EQ 0.
leap = 'X'.
ENDIF.
ELSEIF modval2 EQ 0
leap = 'X'.
ENDIF.
Change it like this it will work.
2006 Aug 25 6:16 PM
data year type i.
data modval1 type i.
data modval2 type i.
year = input+6(4).
modval1 = year MOD 400.
modval2 = year MOD 4.
IF input+8(2) EQ '00'.
IF modval1 EQ 0.
leap = 'X'.
ENDIF.
ELSEIF modval2 EQ 0
leap = 'X'.
ENDIF.
Change it like this it will work.
2006 Aug 25 6:21 PM
Hi Sudhir,
Can you explain me why does the system behave like this!
Cheers,
Bharat
2006 Aug 25 6:26 PM
Hi Bharat,
1) I think your intension may be of checking whether a year is leap year or not.
2) For this you need to check only on Year
3) Try with this code.
data year type i.
data year_400 type i.
data year_4 type i.
year = input+6(4).
IF input+8(2) EQ '00'.
year_400 = YEAR MOD 400.
year_4 = YEAR MOD 4.
IF year_400 EQ '0'.
leap = 'X'.
ELSEIF year _4 EQ '0'
leap = 'X'.
ENDIF
ENDIF.
In ABAP, A condition has the following form:
<var1> <op> <var2>.
Valid compare operators <op>:
EQ (=)
NE (<>, ><)
LT (<)
LE (<=, =<)
GT (>)
GE (=>,>=)
All variables, SY fields, test module parameters, SET/GET parameters and constant values can be used as variables <var1> and <var2>.
<b>So Atrthmetic expressions can not be parts of <var1> or <var2>.</b>
Thanks,
Vinay
2006 Aug 25 6:36 PM
System does not interpret arithmatic expression in a logical condition.
2006 Aug 25 6:39 PM
Sudhir,
Do u have a link on these rules or stuff like that!
Thanks,
Bharat
2006 Aug 25 6:42 PM
Hi Bharat,
Check this link for rulues on conditions.
http://help.sap.com/saphelp_47x200/helpdata/en/d7/e2152a408e11d1896b0000e8322d00/frameset.htm
http://help.sap.com/saphelp_47x200/helpdata/en/24/4766d4416711d189ec0000e81ddfac/frameset.htm
http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3841358411d1829f0000e829fbfe/frameset.htm
Thanks,
Vinay
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |