irrespective of case get the data from database in sap

12
Requirement Get the data from database with irrespective of case … For example : Go to LFA1 table Give input like Click on execute (F8)

Upload: anil-kumar-neegineni

Post on 07-Nov-2014

1.155 views

Category:

Technology


0 download

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...

TRANSCRIPT

Page 1: Irrespective of case get the data from database in sap

Requirement

Get the data from database with irrespective of case …

For example :

Go to LFA1 table

Give input like

Click on execute (F8)

Page 2: Irrespective of case get the data from database in sap

We got the data …

But give same input text like this ..

Page 3: Irrespective of case get the data from database in sap

Now Press on Execute(F8)

Page 4: Irrespective of case get the data from database in sap

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 '%'.

Page 5: Irrespective of case get the data from database in sap

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)

Page 6: Irrespective of case get the data from database in sap
Page 7: Irrespective of case get the data from database in sap

Case 1 :

Page 8: Irrespective of case get the data from database in sap

Case 2 :

Page 9: Irrespective of case get the data from database in sap
Page 10: Irrespective of case get the data from database in sap

Case 3 :

Page 11: Irrespective of case get the data from database in sap
Page 12: Irrespective of case get the data from database in sap

I hope you people have understood…

Thank you all…

[email protected]