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

Syntax error regarding table

Former Member
0 Likes
901

Hi Gurus,

I am working on a select statement, initially I have wriiten a select statement using the inner joins but then we had some performance issues and I have advised not to use joins...and after that I have written the following statement:

select:

mara~matnr

mara~means

mara~mtart

marc~werks

mard~lgort

from

mara as mara,

mard as mard,

marc as marc

where

(maramatnr = mardmatnr) and (marcmatnr = mardmatnr) and (marcwerks = mardwerks).

but when I am executing this stattement it's iving me an error :

Wrong table name or table alias name table alias name "VBSEGS". table

can you please tell me how make it right

4 REPLIES 4
Read only

Former Member
0 Likes
679

the syntax you are using is still assuming you want a join because you are trying to get from multiple tables.

If you want to do this without joins, you will need to do your first select into an Internal Table, then do the second select

using values from the 1st table, and repeat for 3rd.

See syntax for SELECT ... FOR ALL ENTRIES IN

Read only

0 Likes
679

Hi,

Instead of giving the join conditions in the WHERE addition give it in the ON addition.

for example:

select maramatnr maktmaktx

from mara inner join makt

on maramatnr = maktmatnr.

endselect.

Regards

Naren

Read only

Adi_Bathineni
Participant
0 Likes
679

Hi

Instead of using select statment in your way, use for all entries to get the data from differnet tables.

Ex: MARA, MARC and MARD are Table

Select Matnr Maktx from mara into table itab1 where matnr = '1234'.

select x y from mard into table itab2 for all entries in itab1 where matnr = itab1-matnr.

same thing follows for the 3rd tale also.

Regards,

Adi

Read only

Former Member
0 Likes
679

The above selection logic is also an inner join...break them into three SELECT statements using FOR ALL ENTRIES statement. Also there is some error as you have not provided the join condition using ON statement.