Search code examples
abapopensql

SAP How to create a view with special conditions and aliases


I want to make a view for following SELECT statement:

SELECT ma~matnr ma~mtart ma~ernam ma~ersda ma~laeda de~maktx as maktx_de fr~maktx as maktx_fr it~maktx as maktx_it
FROM mara as ma
LEFT JOIN MAKT as de ON de~matnr = ma~matnr AND de~spras = 'DE'
LEFT JOIN MAKT as fr ON fr~matnr = ma~matnr AND fr~spras = 'FR'
LEFT JOIN MAKT as it ON it~matnr = ma~matnr AND it~spras = 'IT'
INTO CORRESPONDING FIELDS OF TABLE g_it_material

How can I do that? Where can I choose aliases and special conditions in SE11?


Solution

  • Unfortunately the case you've described isn't possible with a dictionary view.

    You can certainly define the conditions, but you cannot define field aliases. The only option that would give you a similar result is to define an OR condition for each language and then process the rows accordingly (it would give you one row per language per material, however). I doubt that would be an acceptable alternative.

    Note Answer changed - I originally missed the point that you had three joins to MAKT.