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 Query

Former Member
0 Likes
1,004

Hi All,

select *

INTO TABLE ITAB

FROM ypbs

WHERE name IN s_name.

the entries in ypbs

ab

AB

Ab

aB

now in selection screen i will give A* then the output will be

AB and Ab but my requirement is to get all the entries starts with A/a.

helpme in this regard

ponts will rewarded

thanks

11 REPLIES 11
Read only

Former Member
0 Likes
977

Hi Padmasri

What you can do is when you are filling the data into your internal table fill in UPERCASE

use this FM

call function 'AIPC_CONVERT_TO_UPPERCASE'

exporting

i_input =

  • I_LANGU = 'EN'

importing

e_output =

Now it will work fine

reward points if helpful

regards

hitesh

Read only

0 Likes
977

Hi,

previously client have the data in the table both in lower/upper case,now we have to retrieve both

Read only

former_member404244
Active Contributor
0 Likes
977

Hi,

do like this

select *

INTO TABLE ITAB

FROM ypbs

WHERE name = 'A%' or 'a%'.

Regards,

Nagaraj

Read only

Former Member
0 Likes
977

Hi,

Check whether you have rightly declared the type of the select option with the field which you are trying to query.

i.e., Check whether the declaration for your select options is ,

select-options s_name for ypbs-name.

From the values that you have mentioned I gather that the domain of the field

YPBA-NAME is made case sensitive(Lowercase is checked). So the Select option will also behave in the same way.

Also convert the case of the input value and append into the range s_name before passing it on to the select query.

loop at s_name.

s_name1 = s_name.

append s_name1.

TRANSLATE s_name-low TO UPPER CASE.

append s_name1.

TRANSLATE s_name-low TO LOWER CASE.

append s_name1

endloop.

sort s_name1.

delete adjacent duplicates from s_name1.

s_name[] = s_name1[] .

Hope this helps.

Reward points if helpful.

Edited by: majisha bharathan on Jan 14, 2008 12:42 PM

Read only

0 Likes
977

Hi Majisha,

here is my code

SELECT-OPTIONS : S_NAME FOR Ypbs-NAME OBLIGATORY.

RANGES: s_name1 FOR ypbs-name.

loop at s_name.

TRANSLATE s_name-low TO UPPER CASE.

append s_name1.

TRANSLATE s_name-low TO LOWER CASE.

append s_name1.

endloop.

s_name] = s_name1[.----


>>>>plz check here

SELECT *

INTO TABLE ITAB

FROM Ypbs

WHERE NAME IN s_name. "or NAME IN s_name2.

IF SY-SUBRC = 0.

LOOP AT ITAB.

WRITE :/05 ITAB-NAME.

ENDLOOP.

ENDIF.

Read only

0 Likes
977

Hi,

By mistake they may be printed by the concerned person

remove the braces and try.

s_name = s_name1

Regards

Read only

0 Likes
977

try like this...


SELECT-OPTIONS : s_name FOR ypbs-name OBLIGATORY.
RANGES: s_name1 FOR ypbs-name.
RANGES: s_name2 FOR ypbs-name.




TRANSLATE s_name-low TO LOWER CASE.
s_name1-low = s_name-low.
s_name1-sign = s_name-sign.
s_name1-option = s_name-option.
APPEND s_name1.

TRANSLATE s_name-low TO UPPER CASE.
s_name2-low = s_name-low.
s_name2-sign = s_name-sign.
s_name2-option = s_name-option.
APPEND s_name2.



SELECT *
INTO TABLE itab
FROM ypbs
WHERE name IN s_name1 OR name IN s_name2 .

IF sy-subrc = 0.
  LOOP AT itab.
    WRITE :/05 itab-name.
  ENDLOOP.
ENDIF.

Read only

0 Likes
977

Hi Padmasri,

The browser is acts in a very wierd way,

I was trying to move the entire table contents of s_name1 to s_name using square braces. But somehow its not getting displayed prperly.

Use S_NAME[ ] = S_NAME1[ ] .

Read only

Former Member
0 Likes
977

Hi,

You use following code..

range s_name2 for s_name.

s_name2 = s_name[].

loop at s_name2.

translate s_name2-low to upper.

translate s_name2-low to upper.

modify s_name2.

endloop.

loop at s_name.

translate s_name-low to lower.

translate s_name-low to lower.

modify s_name.

endloop.

select *

INTO TABLE ITAB

FROM ypbs

WHERE name IN s_name or name IN s_name2.

L.Velu

Read only

Former Member
0 Likes
977

Hi Padmasri

The code below will work only for when user gives one latter and does patternr search

-


constants c_rule type char52 value 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz'.

loop at s_name.

translate s_name-low+0(1) using c_rule.

append r_name1.

endloop.

append lines of r_name1 to s_name.

select *

INTO TABLE ITAB

FROM ypbs

WHERE name IN s_name.

-


May be on similar lines you can try to write a generic code which will take care of all possible cases. Other option would be retrieve all the data then using String Comparision operators, delete the unwanted records. Second options looks more reasonable and feasibly.

~ Ranganath

Read only

Former Member
0 Likes
977

Hi All,

help me ..requirement is urgent

my question is not answered