04-18-2017 8:37 AM
Hi
I am trying to have a WHERE clause in which portion of a field is to be compared with contents of a range table.
The SQL goes like:
SELECT idnlf maktx m~meins m~matnr prodh
INTO CORRESPONDING FIELDS OF TABLE lt_data
FROM mara AS m
JOIN makt AS k ON m~matnr = k~matnr AND k~spras = sy-langu
JOIN eina AS a ON m~matnr = a~matnr
JOIN mvke AS v ON m~matnr = v~matnr
WHERE v~prodh+2(3) in so_pmdpt.
Here so_pmdpt is a selection option (range table of 3 character long PRODH3).
The above OpenSQL statement doesn't compile/activate because v~prodh+2(3) is not correct syntax. PRODH is an 18 character long field and I need to compare only the substring from character 3 to character 5.
Can someone please hep me resolve this?
The reason I want to filter data in the query is because MARA is a huge table and then when its joined with MVKE becomes even bigger.
Cheers.
Regards
S.