Irrespective of case get the data from database in sap

Preview:

DESCRIPTION

if you want to get the data from sap ...if the field is case sensitive that kind of cases we can go for this way and fetch the data from database irrespective of case...

Citation preview

Requirement

Get the data from database with irrespective of case …

For example :

Go to LFA1 table

Give input like

Click on execute (F8)

We got the data …

But give same input text like this ..

Now Press on Execute(F8)

We got an success message like “No table entries found for specified key”….

But the table is actually having the data…

Because of case sensitive it is showing that success messages instead of picking the data from the database..

For these kind of cases …

If you want to get the data in any program or application from the database irrespective of case…

We should follow the below code :

parameters p_name1 type name1_gp obligatory.

data wa_lfa1 type lfa1.

replace all occurrences of '*' in p_name1 with '%'.

TRANSLATE p_name1 to upper case.

EXEC SQL.SELECT * FROM lfa1 INTO :wa_lfa1      WHERE upper(NAME1) LIKE :p_name1 ENDEXEC.IF sy-subrc = 0. WRITE: / wa_lfa1-lifnr,           wa_lfa1-name1,           wa_lfa1-ort01.else.  exit.ENDIF.

After execution(F8)

Case 1 :

Case 2 :

Case 3 :

I hope you people have understood…

Thank you all…

anil.neegineni@gmail.com

Recommended