Searching for strings (parts or with pattern) is cumbersome if the table field isn't defined as case-insensitive.
Example:
Search all requests in "E07T" where "AS4TEXT" contains "Sales."
With a normal SELECT * FROM E070T WHERE AS4TEXT LIKE gv_text" values like SALES or sales will not be found.
By using EXEC-SQL, there's a way to do this selection Case-insensitive:
Code
REPORT xy.
DATA:
gt_e07t TYPE TABLE OF e07t WITH HEADER LINE,
gv_reqtxt(60).
PARAMETERS p_text TYPE rzielort.
*** Selection by Request text
*** Native SQL needed since as4text is case sensitive but we
*** want to search case-insensitive
gv_reqtxt = p_text.
TRANSLATE gv_reqtxt TO UPPER CASE.
CONCATENATE '%' gv_reqtxt '%' INTO gv_reqtxt.
*** Change SAP-wildcards to DB-wildcards TRANSLATE gv_reqtxt USING '*%'.
TRANSLATE gv_reqtxt USING '+_'.
EXEC SQL PERFORMING append_e07t.
SELECT * FROM e07t INTO :gt_e07t
WHERE upper(as4text) LIKE :gv_reqtxt ENDEXEC.
DESCRIBE TABLE gt_e07t LINES sy-dbcnt.
CHECK sy-dbcnt GT 0.
LOOP AT gt_e07t.
WRITE: / gt_e07t-trkorr, gt_e07t-as4text.
ENDLOOP.
*&---------------------------------------------------------------------*
*& Form append_e07t
*&---------------------------------------------------------------------*
* text
*-----------------------------------------------------------------------*
FORM append_e07t.
APPEND gt_e07t.
ENDFORM. "append_e07t