‎2007 May 22 3:33 AM
Hi,
can anyone correct this statement
select * from zco where co = siitab-id.
ENDSELECT.
if co = '11' and /cotyp = '14'.
j_itab-typ = 'aa' OR 'bb' OR 'cc' OR 'dd' OR 'dd'.
J_ITAB-RCOST_CENTER_ID = 'Y'
co = 'aa' and cotyp = '10'.
j_itab-typ = 'aa'.
else.
messsage e001 with ' values are out of range
endif.
‎2007 May 22 3:35 AM
see the code below :
REPORT ZTEST3 line-size 400.
select * from zco where co = siitab-id.
if co = '11' and /cotyp = '14'.
j_itab-typ = 'aa' OR 'bb' OR 'cc' OR 'dd' OR 'dd'.
J_ITAB-RCOST_CENTER_ID = 'Y'
co = 'aa' and cotyp = '10'.
j_itab-typ = 'aa'.
else.
messsage e001 with ' values are out of range
endif.
ENDSELECT.
You need to use if condition between select endselect.
‎2007 May 22 3:42 AM
Hi,
iam getting error in this line.....
j_itab-typ = 'aa' OR 'bb' OR 'cc' OR 'dd' OR 'dd'.
for OR operator its not allwoing this
Anjali
‎2007 May 22 3:43 AM
Hi
select single * from zco where co = siitab-id.
if co = '11' and /cotyp = '14'.
j_itab-typ = 'aa' OR 'bb' OR 'cc' OR 'dd' OR 'dd'.
J_ITAB-RCOST_CENTER_ID = 'Y'
co = 'aa' and cotyp = '10'.
j_itab-typ = 'aa'.
else.
messsage e001 with ' values are out of range
endif.
Thanks
Venki
‎2007 May 22 3:46 AM
use like this :
if j_itab-typ = 'aa' OR
if j_itab-typ = 'bb' OR
if j_itab-typ = 'cc' OR
if j_itab-typ = 'dd' .
endif.
endif
endif
endif
‎2007 May 22 3:48 AM
'OR' and 'AND' are used only for conditional statement and not for ASSIGNMENT.
SELECT * from zco where co = siitab-id.
if co = '11' and cotyp = '14'.
j_itab-typ1 = 'aa'.
j_itab-typ2 = 'bb'.
j_itab-typ3 = 'c'.
j_itab-typ4 = 'd'.
J_ITAB-RCOST_CENTER_ID = 'Y'.
co = 'aa'.
cotyp = '10'.
j_itab-typ = 'aa'.
else.
messsage e001 with ' values are out of range
endif.
ENDSELECT.
‎2007 May 22 3:48 AM
Hi,
what about my previous condition... if i use this then i will ahve n no of if's
anjali
‎2007 May 22 3:51 AM
i did not have system right now..
if j_itab-typ1 = 'aa' or j_itab-typ1 = 'bb' or j_itab-typ1 = 'cc'.
endif.
check this condition
‎2007 May 22 3:51 AM
Hi Anjali,
I don't understand why you are using or when you are assing a value
j_itab-typ = 'aa' OR 'bb' OR 'cc' OR 'dd' OR 'dd' -- this is not correct syntax
the control doesn't know which value you are assingning this is correct when your checking
if j_itab-typ = 'aa' OR 'bb' OR 'cc' OR 'dd' OR 'dd'.-- yOu can do this here you are check whether it has anyone of those value
j_itab-typ = 'aa' OR 'bb' OR 'cc' OR 'dd' OR 'dd' - this doesn't make any sense for me
tell me what you are trying to do
Thanks
venki
‎2007 May 22 3:52 AM
Is these your conditions
if co = '11' and cotyp = '14'.
and
j_itab-typ1 = 'aa' or j_itab-typ1 = 'bb' or j_itab-typ1 = 'cc' or j_itab-typ1 = 'dd'
if this is. try this
SELECT * from zco where co = siitab-id.
if co = '11' and cotyp = '14'.
if j_itab-typ1 = 'aa' or
j_itab-typ1 = 'bb' or
j_itab-typ1 = 'cc' or
j_itab-typ1 = 'dd'.
J_ITAB-RCOST_CENTER_ID = 'Y'.
co = 'aa'.
cotyp = '10'.
j_itab-typ = 'aa'.
endif.
else.
messsage e001 with ' values are out of range
endif.
ENDSELECT.
‎2007 May 22 4:00 AM
Hi Ardrian,
-
if co = '11' and cotyp = '14'.
j_itab-typ1 = 'aa'.
j_itab-typ2 = 'bb'.
j_itab-typ3 = 'c'.
j_itab-typ4 = 'd'.
J_ID = 'Y'.
co = 'aa'.
cotyp = '10'.
j_itab-typ = 'aa'.
...................................
in this if my IF condition is true ... it can fall under any one type....
for this can i go head with case and when...
plz suggest me.
‎2007 May 22 4:07 AM
Hi Venki,
IF my coid is '11' and '14'.
then they types with be either one of it j_itab-typ1 = 'aa'.
j_itab-typ2 = 'bb'.
j_itab-typ3 = 'c'.
j_itab-typ4 = 'd'.
J_ITAB-RCOST_CENTER_ID = 'Y'.
anjali
‎2007 May 22 4:11 AM
CASE Statment
case j_itab-typ1
when 'aa'.
J_ITAB-RCOST_CENTER_ID = 'Y'.
when 'bb'.
J_ITAB-RCOST_CENTER_ID = 'Y'.
when = 'c'.
J_ITAB-RCOST_CENTER_ID = 'Y'.
when 'd'.
J_ITAB-RCOST_CENTER_ID = 'Y'.
when others.
message
endcase.
‎2007 May 22 4:17 AM
i am not clear your requirement and why you are using nested select query,
alrady you have jtab,then use loop..
loop at jtab.
get the data from ur ztable comapre with jtab.
endloop.
‎2007 May 22 1:06 PM
hi Anjali
do this may be help you
select * from zco where co = siitab-id.
if co = '11' and cotyp = '14'.
if j_itab-typ = 'aa' OR
j_itab-typ = 'bb' OR
j_itab-typ = 'cc' OR
j_itab-typ = 'dd' OR
j_itab-typ = 'dd'.
J_ITAB-RCOST_CENTER_ID = 'Y'
co = 'aa' .
cotyp = '10'.
j_itab-typ = 'aa'.
else.
messsage e001 with ' values are out of range
endif.
ENDSELECT.