Selection of languages via left outer join
Many ABAP developers will be familiar with this problem: In the case of a complex join across several tables, no data is returned in the result, even though all data is maintained in the main table and the other data is only accessed via LEFT OUTER JOIN. At least the data from the main table should therefore be found reliably. In these cases, the language key in the JOINs may be responsible for this.
If a table with a language key is accessed in a SELECT with a LEFT OUTER JOIN, it is decisive at which point the language is queried. If a label has not been translated for all languages, the data query returns no data. However, the aim is that in this case at least all other fields are returned, except for the description.
Example: A material and its description are to be selected from the MARA and MAKT tables. In addition to the material number, the description in the logon language should be returned (query via sy-langu).
If no description has been maintained in the logon language, at least the material number should still be returned.
To do this, the language key must be queried in the ON condition and not in the WHERE condition!
Then a LEFT OUTER JOIN will also return something from the main table (MARA-MATNR) if no description has been maintained in the appropriate language (in the MAKT). However, if the language is queried in the WHERE, the material number is not found in the MARA either. However, this is not desirable with a LEFT JOIN!
Do you have any questions?
Get in touch with us.