‎2010 Feb 03 1:36 AM
hi,
i have code where the "w_chepctycod" is a single value...but now my requirements is that it will have 2 entries...
-
select single ZCHEPCTYCOD
from Z2RLCHEPCTYCOD
into w_chepctycod
where land1 = s_bukrs-low(02).
SELECT * FROM z2rlbasedat
APPENDING TABLE ts_z2rlbasedat
FOR ALL ENTRIES IN ts_z3rl_docket_umi
WHERE zzumicur = ts_z3rl_docket_umi-zzumicur AND
( status = c_rej OR
status = c_sus ) and
CHEPCTYCOD = w_chepctycod.
-
for the first SELECT, i will remove single and make internal table...
select ZCHEPCTYCOD
from Z2RLCHEPCTYCOD
into table ts_chepctycod
where land1 = s_bukrs-low(02).
but in my second SELECT, how will I inculde 'ts_chepctycod' ??????
kindly help....
thanks
‎2010 Feb 03 3:02 AM
Hi,
Keep you first select statement as it is
select single ZCHEPCTYCOD
from Z2RLCHEPCTYCOD
into w_chepctycod
where land1 = s_bukrs-low(02).
SELECT * FROM z2rlbasedat
APPENDING TABLE ts_z2rlbasedat
FOR ALL ENTRIES IN ts_z3rl_docket_umi
WHERE zzumicur = ts_z3rl_docket_umi-zzumicur AND
( status = c_rej OR
status = c_sus ) .
Now, you check for w_chepctycod
the code will be something like this,
Loop at ts_z2rlbasedat .
read table Z2RLCHEPCTYCOD with key CHEPCTYCOD = ts_z2rlbasedat -chepctycod .
if sy-subrc eq 0.
*----
Your program logic
else.
delete ts_z2rlbasedat .
endif.
endloop.
You can try this, may this will help
Rani
‎2010 Feb 03 2:18 AM
Hi JaiKarthik,
You can populate the entries in ts_chepctycod into a range table... say it r_chepctycod.
And then your 2nd selection will be:
SELECT * FROM z2rlbasedat
APPENDING TABLE ts_z2rlbasedat
FOR ALL ENTRIES IN ts_z3rl_docket_umi
WHERE zzumicur = ts_z3rl_docket_umi-zzumicur AND
( status = c_rej OR
status = c_sus ) AND
CHEPCTYCOD IN r_chepctycod.
‎2010 Feb 03 2:25 AM
Hi JaiKarthik...really cool table and field names
as you want to select data according to all the rows from an internal table, you have to use 'for all entries' as you already did for the other table. the problem is that i really do not know if it's possible to use this addition twice in just one select statement.
if i had a misunderstanding of your question please let me know,
‎2010 Feb 03 3:02 AM
Hi,
Keep you first select statement as it is
select single ZCHEPCTYCOD
from Z2RLCHEPCTYCOD
into w_chepctycod
where land1 = s_bukrs-low(02).
SELECT * FROM z2rlbasedat
APPENDING TABLE ts_z2rlbasedat
FOR ALL ENTRIES IN ts_z3rl_docket_umi
WHERE zzumicur = ts_z3rl_docket_umi-zzumicur AND
( status = c_rej OR
status = c_sus ) .
Now, you check for w_chepctycod
the code will be something like this,
Loop at ts_z2rlbasedat .
read table Z2RLCHEPCTYCOD with key CHEPCTYCOD = ts_z2rlbasedat -chepctycod .
if sy-subrc eq 0.
*----
Your program logic
else.
delete ts_z2rlbasedat .
endif.
endloop.
You can try this, may this will help
Rani
‎2010 Feb 03 3:14 AM
Hello JaiKarthik ,
The best practice is to make a RANGE for your selection in your first query and then use this range in further queries...!
hope it works for you ...! you can read F1 help for RANGE