‎2007 May 07 9:33 AM
Dear all experts,
When I try to do the below statement, i hit an error.
LOOP T_GLT0 WHERE RACCT IN ( '0001234567' , '0001233333' ) AND
BUKRS = S_BURKS.
Is this in LOOP statement I can't use "IN". If no, what is the alternate way to write this similiar statement ?
Many thanks in advance.
‎2007 May 07 9:36 AM
LOOP T_GLT0 WHERE BUKRS = S_BURKS.
and (RACCT = '0001234567'
or RAACT = '0001233333').
‎2007 May 07 9:36 AM
LOOP at T_GLT0 WHERE RACCT IN ( '0001234567' , '0001233333' ) AND
BUKRS = S_BURKS.
regds
‎2007 May 07 9:36 AM
LOOP T_GLT0 WHERE BUKRS = S_BURKS.
and (RACCT = '0001234567'
or RAACT = '0001233333').
‎2007 May 07 9:37 AM
Hi
Move these values '0001234567' , '0001233333' into a range and you can use that with IN statement
LOOP T_GLT0 WHERE RACCT IN r_racct AND BUKRS = S_BURKS.
or
In the Loop use if conditions for Racct and Bukrs.
Reward points if useful
Regards
Anji
‎2007 May 07 9:38 AM
In a loop command this is not possible.
Try this.
LOOP at T_GLT0 where BUKRS = S_BURKS.
check RACCT IN ( '0001234567' , '0001233333' ).
.....
.......
endloop.
Reward points if helpfull.
Regards
Sachin
‎2007 May 07 9:38 AM
Hi,
The In keyword inside the loop will work with Ranges. You declare a range and fill the two values in the range and use in the LOOP. Alternatively you can use
LOOP T_GLT0 WHERE ( RACCT EQ '0001234567' or RACCT EQ '0001233333' ) AND BUKRS = S_BURKS.
ENDLOOP.
Note : if SBUKRS is not a parameter then you have to use IN S_BUKRS instead of EQ SBUKRS.
Hope this helps.
‎2007 May 07 9:40 AM
LOOP T_GLT0 WHERE ( RACCT > 0001234567 ) and ( RACCT <'0001233333 ) ANDBUKRS = S_BURKS.
Regards ,
Sooness.
‎2007 May 07 9:41 AM
LOOP T_GLT0 WHERE ( RACCT < 0001234567 ) and ( RACCT > '0001233333 ) ANDBUKRS = S_BURKS.
‎2007 May 07 9:42 AM
Hi Hong,
You can use IN operator for select options and ranges. you can not use in loop where clause.
You can achieve by create internaal table with all values in the given range by incrementing the value. Write nested loop for every racct.
do
increment racct starting from '0001234567'
and update it_racct.
enddo.
loop at it_racct.
loop at t_glto where racct it_racct-racct.
endloop.
endloop.
Thanks
Venkat
‎2007 May 07 9:44 AM
Refer the following code:
REPORT z_82235_test4 .
data: gt_mara type table of mara,
wa_mara like line of gt_mara.
RANGES: r_matnr FOR mara_matnr.
r_matnr-SIGN = 'I'.
r_matnr-OPTION = 'EQ'.
r_matnr-LOW = '1'.
r_matnr-HIGH = '1000'.
select * from mara into table gt_mara up to 10 rows.
LOOP AT gt_mara INTO wa_mara WHERE matnr in r_matnr.
WRITE: wa_mara-matnr.
clear: wa_mara.
ENDLOOP.
‎2007 May 07 9:48 AM
Hi Hong Ming Tan,
U can use ranges to do so.
put these two value in range table R_RACCT.
refer this code :
**-- Initialization of ranges
R_RACCT-SIGN = 'I'.
R_RACCT-OPTION = 'EQ'.
R_RACCT-LOW = '0001234567'.
APPEND R_RACCT.
CLEAR R_RACCT.
R_RACCT-SIGN = 'I'.
R_RACCT-OPTION = 'EQ'.
R_RACCT-LOW = '0001233333'.
APPEND R_RACCT.
CLEAR R_RACCT.
loop at glt0 whrere bukrs = s_bukrs and racct in R_RACCT.
.........
.........
endloop.
Reward points if helpful.
Regards,
Hemant
‎2007 May 07 9:53 AM
ranges : r_racct for <tablename>-racct.
*declare the tablename in which racct field is found
r_racct-sign = 'I'.
r_racct-option = 'EQ'.
r_racct-low = '0001234567'.
r_racct-high = ''.
append r_racct.
clear r_racct.
r_racct-sign = 'I'.
r_racct-option = 'EQ'.
r_racct-low = '0001233333'.
r_racct-high = ''.
append r_racct.
clear r_racct.
loop at t_glto
where racct in r_racct AND
burks in s_burks.
if burks u have declared in select option.
if s_burks is declared under parameter then use burks = s_burks.
if useful reward with points .