Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

OpenSQL compare substring with data in an internal table

0 Kudos

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.

  • SAP Managed Tags:
0 REPLIES 0