Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

how to include internal table

Former Member
0 Likes
578

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
555

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

4 REPLIES 4
Read only

Former Member
0 Likes
555

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.

Read only

FabioPagoti
Active Contributor
0 Likes
555

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,

Read only

Former Member
0 Likes
556

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

Read only

anup_deshmukh4
Active Contributor
0 Likes
555

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