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: 

can we apply an uppercase function on the DB field

former_member186491
Contributor
0 Kudos

Hi All,

If we can apply an uppercase function on the DB field like in Native SQL as below -


SELECT MAKTX from MAKT into table it_makt where UPPER(MAKTX) like '%TEST%'.


For the context, we can set the case for a DB-Field in other SQL before matching with input value. So, what happens is, before comparing the input text-value - which is in upper-case - even the DB-Field value is converted to upper-case and then comparing would make both the case as upper-case. Hence, it would give all matching values, irrespective of whatsoever combination of upper or lower case letters are there in the string. Hence, even the DB might be having values like


Test

tEst

TEst


or any other combination, all these would be coming into result-set.


If you want to check, please use SE38 and run the ADBC_QUERY report. There you can pass Native query as per below screen shot -






But, this is not allowed in ABAP open SQL. Any suggestion, how we can achieve this.


Thanks in advance.


Thanks.

Kumar Saurav.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

The upper() is not available on every database (ORACLE, MSSQL, DB2 are OK) but as SAP also runs on some other database, Open SQL wont support this (You can look for information in any related note like 1269398 - Case-insensitive search in input help (F4) for BW)

So either create/identify another field (without lowercase) or use native SQL statements, either with EXEC SQL / ENDEXEC or ADBC methods, the ADBC_QUERY report uses the last solution.

Regards,

Raymond

3 REPLIES 3

DominikKraemer
Active Participant
0 Kudos

Hello,

most of the text tables already contain a field with the values in full uppercase, so does MAKT:

MAKT-MAKTG

Cheers,

Dominik

raymond_giuseppi
Active Contributor
0 Kudos

The upper() is not available on every database (ORACLE, MSSQL, DB2 are OK) but as SAP also runs on some other database, Open SQL wont support this (You can look for information in any related note like 1269398 - Case-insensitive search in input help (F4) for BW)

So either create/identify another field (without lowercase) or use native SQL statements, either with EXEC SQL / ENDEXEC or ADBC methods, the ADBC_QUERY report uses the last solution.

Regards,

Raymond

0 Kudos

Thanks Raymond, got clarified.

Thanks.

Kumar Saurav.