‎2008 Apr 25 1:07 PM
Hello,
I was trying to do a SELECT statement reading data from mara and AUSP. Therefore I want to use a left outer join. The problem is that it doesn't want to accept the on clause using the OBJEK attribut in AUSP. The Strange thing is that I know that I could access it in another programm.
TABLES: ausp, mara.
* temporary table to work with
DATA:
BEGIN OF line,
* Attributes from AUSP
atwrt TYPE AUSP-atwrt,
ATINN TYPE AUSP-ATINN,
OBJEK TYPE AUSP-OBJEK,
* Attributes from MARA
mbrsh TYPE mara-mbrsh,
MANDT TYPE mara-MANDT,
MATNR TYPE mara-MATNR,
* ...
END OF line,
itab LIKE SORTED TABLE OF line
WITH NON-UNIQUE KEY MATNR.
* Put the requested values in temporary table
SELECT
ausp-atwrt
ausp-ATINN
ausp-OBJEK
mara-mbrsh
mara-MANDT
mara-MATNR
* ...
into corresponding fields of table itab
FROM mara LEFT OUTER JOIN ausp
ON AUSP-OBJEK = MATNR.There must be a syntax error I don't understand. Can you find it?
‎2008 Apr 25 1:13 PM
Hi Daniel,
Here Main problem is that you have to replace - (hyphens) with ~ (Tide's), as well as no need of using INTO CORRESPONDING FIELDS OF ( as it degrades PERFORMANCE )as shown below:
DATA:
BEGIN OF line,
* Attributes from AUSP
atwrt TYPE AUSP-atwrt,
ATINN TYPE AUSP-ATINN,
OBJEK TYPE AUSP-OBJEK,
* Attributes from MARA
mbrsh TYPE mara-mbrsh,
MANDT TYPE mara-MANDT,
MATNR TYPE mara-MATNR,
* ...
END OF line,
itab LIKE SORTED TABLE OF line
WITH NON-UNIQUE KEY MATNR.
* Put the requested values in temporary table
SELECT ausp~atwrt
ausp~ATINN
ausp~oBJEK
mara~mbrsh
mara~MANDT
mara~MATNR
* ...
into table itab
FROM mara LEFT OUTER JOIN ausp
ON AUSP~OBJEK = mara~MATNR.Regards,
Sunil
‎2008 Apr 25 1:10 PM
you do an array fetch into a sorted table
it´s a wonder that the syntax checker doesnt even whine.
use a standard table and it will work
‎2008 Apr 25 1:15 PM
hm unfortunatley no effect about that, I changed the code like that and same error:
itab LIKE STANDARD TABLE OF line
WITH NON-UNIQUE KEY MATNR.
‎2008 Apr 25 1:13 PM
Hi Daniel,
Here Main problem is that you have to replace - (hyphens) with ~ (Tide's), as well as no need of using INTO CORRESPONDING FIELDS OF ( as it degrades PERFORMANCE )as shown below:
DATA:
BEGIN OF line,
* Attributes from AUSP
atwrt TYPE AUSP-atwrt,
ATINN TYPE AUSP-ATINN,
OBJEK TYPE AUSP-OBJEK,
* Attributes from MARA
mbrsh TYPE mara-mbrsh,
MANDT TYPE mara-MANDT,
MATNR TYPE mara-MATNR,
* ...
END OF line,
itab LIKE SORTED TABLE OF line
WITH NON-UNIQUE KEY MATNR.
* Put the requested values in temporary table
SELECT ausp~atwrt
ausp~ATINN
ausp~oBJEK
mara~mbrsh
mara~MANDT
mara~MATNR
* ...
into table itab
FROM mara LEFT OUTER JOIN ausp
ON AUSP~OBJEK = mara~MATNR.Regards,
Sunil
‎2008 Apr 25 1:24 PM
Hi I have another problem here. When I try to print the values to screen, I get the error that there is a headline missing.
LOOP AT itab.
WRITE: / itabOBJEK, itabATINN, itab~atwrt.
ENDLOOP.
‎2008 Apr 25 1:38 PM
Yes, with this kind of tables you need a hear (workarea).
Your workarea in that case is the line structure. You must do your loop like this:
LOOP AT itab into line.
WRITE: / lineOBJEK, lineATINN, line~atwrt.
ENDLOOP.
I hope it helps.
Artur.