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

Alv Grid select error

rodrigo_paisante3
Active Contributor
0 Likes
771

Hi all,

I want to create a select like this:

SELECT mara~matnr

makt~maktx

mara~ernam

mara~meins

marc~werks

bseg~augbl

vbap~vbeln

vbap~charg

INTO CORRESPONDING FIELDS OF TABLE ti_dados

FROM mara

INNER JOIN marc ON maramatnr = marcmatnr

INNER JOIN makt ON maramatnr = maktmatnr

inner join vbap on maramatnr = vbapmatnr

WHERE mara~matnr IN s_matnr AND

makt~spras = 'PT' and

bsegmatnr = maramatnr.

But the compiler said this to me:

You cannot compare with "VBAP-VPMAT". Each comparison in the ON

condition must contain a field from the RH table.

I saw the relationship between the tables mara and vbap in the transaction se11. Is it wrong?

Thanks,

Paisante.

Message was edited by:

Rodrigo Paisante

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
751

You forget the join with bseg

Regards

6 REPLIES 6
Read only

RaymondGiuseppi
Active Contributor
0 Likes
752

You forget the join with bseg

Regards

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
751

ONe major problem is that you reference BSEG in your SELECT statement twice, once in the field list and again in the WHERE clause, but you are not actually using the table in the SELECT(either as a FROM table or an INNER JOIN).

SELECT mara~matnr
makt~maktx
mara~ernam
mara~meins
marc~werks
bseg~augbl          " <-  RIGHT HERE
vbap~vbeln
vbap~charg
INTO CORRESPONDING FIELDS OF TABLE ti_dados
      FROM mara
               INNER JOIN marc
                     ON mara~matnr = marc~matnr
               INNER JOIN makt 
                     ON mara~matnr = makt~matnr
                inner join vbap 
                      ON mara~matnr = vbap~matnr
                             WHERE mara~matnr IN s_matnr AND
                                          makt~spras = 'PT' and
                                          bseg~matnr = mara~matnr.    " <-  AND RIGHT HERE

Regards,

Rich Heilman

Read only

Former Member
0 Likes
751

Hi,

Have you pase the correct code here.

You are talking about <b>VBAP-VPMAT</b>, but i do not see that anywhere in your code.

Also, why are you reading BSEG-AUGBL in your code. BSEG is not define anywwhere in join. If you read the field from table, the table should be in JOIN. Where is BSEG?

If i comment everything related to BSEG in your code, there is no error.

*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
TABLES: mara.
SELECT-OPTIONS: s_matnr FOR mara-matnr.

DATA: BEGIN OF ti_dados OCCURS 0,
        maktx LIKE  makt-maktx,
        ernam LIKE  mara-ernam,
        meins LIKE  mara-meins,
        werks LIKE  marc-werks,
*        augbl LIKE  bseg-augbl,   " --> Comment this
        vbeln LIKE  vbap-vbeln,
        charg LIKE  vbap-charg,
      END OF ti_dados.

SELECT mara~matnr
makt~maktx
mara~ernam
mara~meins
marc~werks
*bseg~augbl       " --> Comment this
vbap~vbeln
vbap~charg
INTO CORRESPONDING FIELDS OF TABLE ti_dados
FROM mara
INNER JOIN marc ON mara~matnr = marc~matnr
INNER JOIN makt ON mara~matnr = makt~matnr
INNER JOIN vbap ON mara~matnr = vbap~matnr
WHERE mara~matnr IN s_matnr AND
makt~spras = 'PT'. " AND
*bseg~matnr = mara~matnr.      " --> Comment this
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*

Please clarify your issue.

Regards,

RS

Read only

rodrigo_paisante3
Active Contributor
0 Likes
751

Hi experts,

One problem, because bseg is a cluster table and not permit a inner join. When i was doing the select, i did this inner and the compiler show me the error.

Thanks for all answers

Read only

0 Likes
751

Hi,

If your issue is resolved, award the appropriate points and close the thread.

If you still have an issue, let us know.

Regards,

RS

Read only

rodrigo_paisante3
Active Contributor
0 Likes
751

ok, thanks to all