2006 Mar 21 8:31 AM
Hi Experts,
i have coded like this. But this condition is not working fine. how to code it?
if cdpos-tabname eq 'DMAKT'
or cdpos-tabname eq 'MARA'
or cdpos-tabname eq 'MAKT'.
do something...
elseif cdpos-tabname ne 'DMAKT'
or cdpos-tabname ne 'MARA'
or cdpos-tabname ne'MAKT'.
do something.
else.
do something.
endif.
2006 Mar 21 8:33 AM
Hi silviya,
1. try giving brackets, like this.
(and give just one ELSE)
(no ELSEIF)
2.
if ( cdpos-tabname eq 'DMAKT'
or cdpos-tabname eq 'MARA'
or cdpos-tabname eq 'MAKT') .
do something...
<b> else.</b>
ENDIF.
regards,
amit m.
2006 Mar 21 8:33 AM
Hi silviya,
1. try giving brackets, like this.
(and give just one ELSE)
(no ELSEIF)
2.
if ( cdpos-tabname eq 'DMAKT'
or cdpos-tabname eq 'MARA'
or cdpos-tabname eq 'MAKT') .
do something...
<b> else.</b>
ENDIF.
regards,
amit m.
2006 Mar 21 8:35 AM
hi silviya,
put the if condition in <b>BRACKETS</b>
if ( cdpos-tabname eq 'DMAKT' )
or ( cdpos-tabname eq 'MARA' )
or ( cdpos-tabname eq 'MAKT' ).
Regards,
Santosh
2006 Mar 21 8:37 AM
if cdpos-tabname eq 'DMAKT'
or cdpos-tabname eq 'MARA'
or cdpos-tabname eq 'MAKT'.
do something...
else.
do something.
2006 Mar 21 8:37 AM
HI,
TRY PUTTING THE CONDITIONS IN BRACKETS.
LIKE
IF ( CDPOS-TABNAME = 'DMAKT' ) OR ( CDPOS-TABNAME = 'MARA' ) OR ( cdpos-tabname eq 'MAKT').
do something.
ELSE.
do something
ENDIF.
THANKS,
PRIYA
2006 Mar 21 8:40 AM
Hi
I can't understand what you really want to do, but where you use NE option you should'nt use OR but AND
elseif cdpos-tabname ne 'DMAKT' <----
or cdpos-tabname ne 'MARA' <----
or cdpos-tabname ne'MAKT'. <----
elseif cdpos-tabname ne 'DMAKT' <----
AND cdpos-tabname ne 'MARA' <----
AND cdpos-tabname ne'MAKT'. <----
Remember: NEVER NEVER NEVER use NE together OR because the condition is always true, example.
MY_NAME = 'MAX'.
IF MY_NAME <> 'MAX' OR
MY_NAME <> 'BOB'.
-
> It's true because MY_NAME <> 'BOB'
MY_NAME = 'BOB'.
IF MY_NAME <> 'MAX' OR
MY_NAME <> 'BOB'.
-
> It's true because MY_NAME <> 'MAX'
MY_NAME = 'TIM'.
IF MY_NAME <> 'MAX' OR
MY_NAME <> 'BOB'.
-
> It's true because MY_NAME <> 'MAX' and MY_NAME <> 'BOB'
Max
2006 Mar 21 8:42 AM
Hai thomas,
Just check this out...
if ((cdpos-tabname eq 'DMAKT')
or (cdpos-tabname eq 'MARA')
or (cdpos-tabname eq 'MAKT')).
do something...
elseif ((cdpos-tabname ne 'DMAKT')
or (cdpos-tabname ne 'MARA')
or (cdpos-tabname ne'MAKT')).
do something........
else.
do something.
endif.
Regards,
Srikanth.
Reward points if helpful.
2006 Mar 21 8:47 AM
Hi Silviya,
Is it syntax error or execution error?
It shouldn't be a syntax error. There is no problem in writing the IF condition.Needn't hav to put in brackets.
Isn't cdpos is an internal table with header line?
Try giving like this.
if cdpos-tabname eq 'DMAKT' or cdpos-tabname eq 'MARA'
or cdpos-tabname eq 'MAKT'.
do something.
else.
do something.
endif.
no need of the second if condition.
Regards,
Sylendra.
2006 Mar 21 1:47 PM
Hi Silviya,
you can consider writing a <b>CASE</b> statement.
case cdpos-tabname.
when 'DMAKT' or 'MARA' or 'MAKT'.
do something...
when others.
do something.
endcase.
regards,
Kinshuk Saxena