09-10-2014 12:41 PM
Dear Gurus,
I suppose to make a web service using FM which take input of name and in return, deliver all information about that name from PA0001 and PA0002. How can i do this?
For example: There are 2 record of names "ABC XYZ" and "ABC EFG" in PA0001. Field is SNAME in PA0001. But it can only bring record if we give full name to field SNAME like "ABC XYZ". But i want that if user enter just "ABC" it bring all records that have name "ABC". I mean if i pass just "ABC" to field SANAME, it should bring "ABC XYZ" and "ABC EFG".
how can i write a select query for this purpose. I tried using this but it does not work.
select * from PA0001 into CORRESPONDING FIELDS OF TABLE itab
where SNAME = ' *ABC* ' .
How can i do this? Kindly help.
Regards
09-10-2014 12:57 PM
Hi,
You May Use like operator to achieve pattern
select * from PA0001 into CORRESPONDING FIELDS OF TABLE itab
where SNAME like ' ABC% ' .
09-10-2014 12:57 PM
Hi,
You May Use like operator to achieve pattern
select * from PA0001 into CORRESPONDING FIELDS OF TABLE itab
where SNAME like ' ABC% ' .
09-10-2014 1:09 PM
Dear Somendra,
hanks for your reply
Does it work like *ABC*?
I checked the way you said with one name. It brought 21 records from PA0001 , however, there are 89 records of that name in PA0001. I think your suggested way work like ABC* but i want something that work like *ABC*.
Regards
09-10-2014 1:20 PM
09-11-2014 5:59 AM
Dear Somendra,
Thanks fro your reply. I want to ask one thing. The web service that i am making , suppose to return employee details on input parameters of Employee number, employee name, email, designation and department. So what you think. Using Select * from like %" is best for this purpose?? will select queries work fine? any other idea you have or shall i proceed with this?
Regards
09-11-2014 6:09 PM
Hi Imran,
Yes. You can use LIKE % for all the fields mentioned above in the post in WHERE condition of SELECT QUERY.
Thanks.
09-17-2014 12:55 PM
Dear Naveen,
I want to ask one more thing. If there is sentence like *abc efg xyz*, and if i want to convert it like this, %abc%efg%xyz. HOW CAN I DO THAT?
LET ME KNOW PLEASE.
Regards
09-17-2014 1:22 PM
Hi Imran,
If the space between abc efg xyz should be the preserved then it is better to use %abc efg xyz% for the search. This is because if you use %abc%efg%xyz% then other words like abcdefghxyz will also be considered. Let me know for more information.
thanks
09-17-2014 2:58 PM
In the sql condition, "%" represents any character string, even an empty one, and "_" represents any character. So you can play with CONCATENATE or REPLACE statement to adapt your code.
Regards,
Raymond