‎2007 Apr 13 9:26 PM
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
‎2007 Apr 13 9:32 PM
‎2007 Apr 13 9:32 PM
‎2007 Apr 13 9:34 PM
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 HERERegards,
Rich Heilman
‎2007 Apr 13 9:41 PM
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
‎2007 Apr 14 2:24 AM
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
‎2007 Apr 14 2:58 AM
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
‎2007 Apr 14 3:09 AM