07-21-2005 11:51 PM
hi folks,
I have a lot of condition types that I have to check for and I am using case statement to do that. The code goes like this.
case wac-kschl.
when 'ZRAT' OR 'ZAGR' OR 'ZRCR' OR
'Y098' OR 'Y007' OR 'ZREW' OR 'Y106' OR 'ZTSR' OR 'Y127' OR 'Y125' OR 'Y126' OR 'Y124' OR 'Y157' OR 'Y092' OR 'Y085' OR 'Y090' OR 'ZMZD'
OR 'Y215' OR 'Y214' OR 'Y111' OR 'ZC$D' OR 'ZAUD'.
up till here it is working on errors and when I add few more condition types to the case statement it is throwing the error.
I have to check for all the condition types out here.
How can I correct it? Is there a better way to do it?
thanks
Santhosh
07-22-2005 12:40 AM
07-22-2005 1:54 PM
hi folks,
the error is 'the text literal is longer than 255 and see that it ends correctly'
the other error is ' after 'OR' there must be a space or equivalent character.
I have several of these condition types and I need to check for every one of them hence forth I have been using the case statement.
Even after using the 'Pretty Printer' it is throwing the same error.
Thanks for your help in advance.
Santhosh
07-22-2005 2:02 PM
Hi,
This error usually occurs when
1) Din't close the literals properly with single quotes.
2) Missing full stop.
3) Too many words in a single line (try to shorten thro pretty printer)
Check the above...
Cheers,
Sam
07-22-2005 1:40 AM
Hi Santhosh,
I think that your CASE statement has a flaw. The line length of one of the lines is too large. You need to insert a carriage-return to shorten it (or press the button 'Pretty Printer').
The code would look nicer like this:[code] CASE wac-kschl.
WHEN 'ZRAT' OR 'ZAGR' OR 'ZRCR' OR 'Y098' OR 'Y007' OR 'ZREW'
OR 'Y106' OR 'ZTSR' OR 'Y127' OR 'Y125' OR 'Y126' OR 'Y124'
OR 'Y157' OR 'Y092' OR 'Y085' OR 'Y090' OR 'ZMZD' OR 'Y215'
OR 'Y214' OR 'Y111' OR 'ZC$D' OR 'ZAUD' OR 'Z001' OR 'Z002'
OR 'Z003' OR 'Z004' OR 'Z005' OR 'Z006' OR 'Z007' OR 'Z008'
OR 'Z009' OR 'Z010' OR 'Z011' OR 'Z012' OR 'Z013' OR 'Z014'.
Do your thing here
...
WRITE: / 'OK'.
WHEN OTHERS.
WRITE: / 'NOT OK'.
ENDCASE.[/code]If this will not work for you, you could try a different approach:[code]* Local definition
DATA:
var_list(1024).
Build variable string for checking
CONCATENATE 'ZRAT ZAGR ZRCR Y098'
'Y007 ZREW Y106 ZTSR'
'Y127 Y125 Y126 Y124'
'Y157 Y092 Y085 Y090'
'ZMZD Y215 Y214 Y111'
'ZC$D ZAUD'
INTO var_list
SEPARATED BY space.
Check if the correct value is supplied
IF var_list CS wac-kschl.
Do your thing here
...
WRITE: / 'OK'.
ENDIF.[/code]Hope this helps you a bit.
Regards,
Rob.
07-22-2005 2:02 PM
Hi,
insert your condition types in an internal table zcond
( or better create a customizing table for it )
and your code is:
read table zcond with key kschl = wac-kschl.
if sy-subrc = 0.
-> your process
...
regards Andreas