Application Development and Automation 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: 
Read only

Select statement to search - case sensitive

Former Member
0 Likes
1,747

Hi all,

I have to do a search on the field BSTKD_E for table VBKD. However that field is case sensitive. We do not know what the users will input to do a search, therefore I need to search regardless of whether it is in uppercase, lowercase or mixed. I understand that it can be done by EXEC SQL. But besides this, any other method?

We are using MSSQL now but will be migrating to DB2 soon. I heard that the EXEC SQL is server dependent. Is it so?

If yes, can somebody help me to code the following to be native SQL for MSSQL and DB2? (Actually hope not to use this method)

SELECT fvbeln fposnr INTO TABLE lt_vbeln

FROM vbkd AS f JOIN vbup AS p ON fvbeln = pvbeln AND

fposnr = pposnr JOIN vbak AS k ON fvbeln = kvbeln

WHERE fbstkd_e in lr_po_num AND pabsta NE 'C' AND k~auart = 'ZOR'.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,672

As far as i understand the case sensitive search can be handled with native SQL only.

I heard that the EXEC SQL is server dependent. Is it so? ==> yes

Regarding the syntax , it varies for diff DB platforms .

As far as i understand the case sensitive search can be handled with native SQL only.

I heard that the EXEC SQL is server dependent. Is it so? ==> yes

Regarding the syntax , it varies for diff DB platforms .

10 REPLIES 10
Read only

Former Member
0 Likes
1,672

convert the input that user enters into uppercase always. Irrespective of whether the user entrs in upper case or lower case, convert it into uppercase always and then try to search the field.

Read only

0 Likes
1,672

Dear priti suryawanshi

what if the value in db table-field contains mixed cases ????

This Qn is discussed several times in this forum..

its better get the values into a itab and then use some functions on that field to sort it out !!!

Read only

0 Likes
1,672

Hi Priti,

The user will enter in the sales order and I don't think I can control on how they enter it and there are already records with mixed uppercase and lowercase. Therefore would prefer to to control it in the program itself.

Read only

0 Likes
1,672

Hi Keshu,

I understand that this can work. But this will be pulling alot of data from the DB and this will slow down the performance of the program. Therefore wondering if there are better methods.

Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,673

As far as i understand the case sensitive search can be handled with native SQL only.

I heard that the EXEC SQL is server dependent. Is it so? ==> yes

Regarding the syntax , it varies for diff DB platforms .

Read only

0 Likes
1,672

Hi Sandeep,

Do you know the syntax for DB2 and MSSQL?

Read only

0 Likes
1,672

Unfortunately no , but you may search in other forms .

Read only

viquar_iqbal
Active Contributor
0 Likes
1,672

Hi

you can convert the BSTKD_E for table VBKD value into uppercase /lowercase no matter what user enters and then use it in select query.

TRANSLATE text TO UPPER CASE.

Thanks

Viquar iqbal

Read only

0 Likes
1,672

Hi Viquar,

I understand that this can work. But I will be pulling alot of data from the DB and this will slow down the performance of the program. Therefore wondering if there are better methods.

Read only

Former Member
0 Likes
1,672

Cannot find any better solution, therefore decided to translate the data in the table to uppercase using an update program. Also added in user exit to translate to uppercase for all future SO.