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: 

Sdata field cannot be used where condition

0 Kudos
SELECT *
FROM edid4
INTO CORRESPONDING FIELDS OF TABLE lt_edid4
FOR ALL ENTRIES IN lt_docnum
WHERE docnum EQ lt_docnum-docnum
AND segnum EQ '000001'
AND segnam IN lr_segnam
AND hlevel EQ '01'
AND sdata IN lr_objkey2.

Hi guys i am getting this error can you help me?

The field "SDATA" is a long string or a text and cannot be used in the WHERE condition.

4 REPLIES 4

matt
Active Contributor

You'll need to select without the sdata clause, then loop through lt_edid4 and eliminate records not in lr_objkey2.

0 Kudos
SELECT *
FROM edid4
INTO CORRESPONDING FIELDS OF TABLE lt_edid4
FOR ALL ENTRIES IN lt_docnum
WHERE docnum EQ lt_docnum-docnum
AND segnum EQ '000001'
AND segnam IN lr_segnam
AND hlevel EQ '01'.
* AND sdata IN lr_objkey2.
LOOP AT lt_edid4 INTO DATA(ls_edid).
DELETE lt_edid4 FROM lr_objkey2.
ENDLOOP.

According to what you said, will this work for me?

matt
Active Contributor

Something like that yes.

Sandra_Rossi
Active Contributor

In Open SQL, it's not possible directly (see Matthew answer).

Note that the transaction code WE09 permits to find IDocs based on SDATA.

You may also try with native SQL. Below code that you shouldn't use productively, it's just to quickly test if native SQL supports it, if yes you may use AMDP, ADBC or HANA SQL Script (don't know for HANA CDS).

DATA edid4 TYPE edid4.
EXEC SQL PERFORMING select_row_from_edid4.
  SELECT DOCNUM, SDATA FROM EDID4 WHERE SUBSTRING( SDATA, 1, 1 ) = 'A' INTO :EDID4-DOCNUM,:EDID4-SDATA
ENDEXEC.
FORM select_row_from_edid4.
  WRITE: / edid4-docnum, edid4-sdata.
ENDFORM.