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

Select from multiple tables without join statement

Former Member
0 Likes
3,868

Hey Gurus,


I would like to make a select from a multiple tables to check if there is any reference to my data. I would like to do it with some elegancy, but I don't know how.

Is in abap sql possible to do it only with the select statement?

Or I was also think about a solution that I should fill some data structure with all of the tables which I want to select from and then just loop that data structure and do the select seperately from all of the tables. I just need to check if it founds some results, so no need to store it. If this solution would be fine what data structure should I use?

Or can tell me what would be the best for this?

My code for select from one table, which I want to make for multiple tables:


SELECT SINGLE id_kniznice FROM zbr_t_autori INTO wa_id

       WHERE id_kniznice EQ ls_extract-zview-id_kniznice.

     IF sy-dbcnt > 0.

       MESSAGE i000(zbr_msgc_lib).

       ls_extract-flags-vim_mark = '*'.

       MODIFY extract FROM ls_extract.

ENDIF.   

Thank you for any posts.

Regards,

Robert

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,088

If you want a dynamic selection, look with F1 at this syntax : SELECT count(*) FROM (dbtab_syntax) WHERE (cond_syntax).

Regards,

Raymond

8 REPLIES 8
Read only

Former Member
0 Likes
2,088

hi Robert,

Have you tried using FOR ALL ENTRIES. You can fetch the next table records based on success of previous table.

Regards,

DN.

Read only

A-J-S
Active Participant
0 Likes
2,088

This message was moderated.

Read only

Former Member
0 Likes
2,088

And there we go again...

Read this topic:

And this one:

Also that one:

JOINs are really better than for all entries in most cases. Problem is people tend to ignore basic things like using pks or indexes while making them.

Read only

Former Member
0 Likes
2,088

Thank you for the valuable information I did not want to use join 'cause I didn't wanted to write down 10x JOIN in the code. But probably I explained myself wrongly, what I really wanted is what Stefan Seeburger posts. But thank you anyway, It's a useful information for the future.

Read only

Former Member
0 Likes
2,088

This message was moderated.

Read only

arthur_alvesteixeira
Active Participant
0 Likes
2,088

This message was moderated.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,089

If you want a dynamic selection, look with F1 at this syntax : SELECT count(*) FROM (dbtab_syntax) WHERE (cond_syntax).

Regards,

Raymond

Read only

Former Member
0 Likes
2,088

Thank to you all of you. The solution was that dynamic selection with (dbtab_syntax)