on 11-02-2009 10:18 AM
Hello Experts ,
I am trybin to read data from infotype table pa0002 . I am accepting the Last name ( vorna ) as input .
I am trying to fetch matching records in internal table USING SELECT QUERY .
But the name (vorna ) is *case sensitive* so in table name can be stored as
Rahul
RAHUL
rahul
If user input is RahuL . Query return zero number MATCHING of records .
My requirement is Query should return all three matching records .
How can i do the comparison of name to retrive all matching records IGNORING THE CASE .
i tried following query
SELECT PERNR VORNA NACHN GBDAT FROM PA0002
INTO CORRESPONDING FIELDS OF TABLE ITAB
WHERE upper( VORNA ) = upper( STRU_USERIP-VORNA )
AND ENDDA >= SY-DATUM
AND BEGDA <= SY-DATUM .
But wont work since UPPER is not allowed ,
can anyone provide solution to this problem .
Your Help will be appericiated .
thks ,
Rushi
HI,
when you get the value in lv_value using get_attribute method of if_wd_context_node.
translate lv_value to upper case.
now pass this to SELECT query.
Regards,
Lekha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Lekha for replying ,
I am trying to develop Employee Search application ,
On one view i hv 2 ip fields first name , last name ., one button ,
and table to display employee number ( pernr ) , employee first name ( vorna ) , last name ( nachn ) .
user enter s fname , last name . and click on button .
nopw i want to display records from table pa0002 whose fname (nachn ) , last name ( vorna ) matches with fname , last name just entered by the user .
now in table name information is stored in mixed format . means some of names are in yupper case ,some are in lower case ,
like name rahul can be present intable any of the following format .
suppsoe table has 4 records
rahul
Rahul
RAHUL
rAHul
now in my application when user enters RAHUL as ip .then only third record in above list get displayed as result .
if user enters rahul as input i want all 4 records to be displayed as result .
I just want to ignore the case of name . of both name present in database table and of name entered by the user as input .
or simplay tell me the query which will work in abap and have functionality as that of following query
SELECT PERNR VORNA NACHN GBDAT FROM PA0002
INTO CORRESPONDING FIELDS OF TABLE ITAB
WHERE upper( VORNA ) = upper( STRU_USERIP-VORNA )
AND ENDDA >= SY-DATUM
AND BEGDA <= SY-DATUM .
Thks ,
Rushi
HI,
As you have explaiend above, the decision of fecthing records is upto you..
RAHUL = exact match
rahul= all records
hope your context attribute is using the domain as vorna..or else consider the string.
Please refer this thread for my reply...I have some similar test case as yours...
Regards,
Lekha.
Edited by: Lekha on Nov 2, 2009 4:55 PM
what about the field VNAMC in which the (first) name is stored in upper case. These fields are used in the search help, and are especially useful for selecting data withouth having to take the case sensitivity in account. Whether one enters RAHUL, or RAhul, or raHUL, all names are stored as RAHUL.
hi,
There are few ways to ignore case while selecting values :
1. Have all the records in either Capitals or Small Letters in DataBase Table.
2. Have one extra column with either Capitals or Small Letters to do search.
3. Declare Range Tables.
An Example of Ranges :
a. Range declared for which search criteria is there.
Data : lr_name TYPE RANGE OF fmfint-bezeich,
lr_name_line LIKE LINE OF lr_name.
Data lt_rfc type table of fmfint,
wa_rfc type fmfint,
w_output type fmfint,
t_output type table of fmfint.
b. i_name is the value entered by user in Search Criteria.
if i_name is not initial.
lr_name_line-sign = 'I'.
lr_name_line-option = 'CP'.
lr_name_line-low = i_name.
APPEND lr_name_line to lr_name.
ENDIF.
c. Select all records.
select * from fmfint into table lt_rfc.
d. Filter records using Loop and where condition
loop at lt_rfc into wa_rfc where
bezeich IN lr_name.
MOVE-CORRESPONDING lw_rfc TO w_output.
APPEND w_output TO t_output.
CLEAR: w_output,lw_rfc.
endloop.
.
now finally you have all records based on input entered in table t_output.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rushi ,
I have seen that you have solved the issue of ignoring upper case ..
I am facing same issue here.. I have an input field in which I will enter the value in any case and values in the data base are also in mixed cases. eg: Activity, Some are in Upper like ACTIVITY.. When I translate the input field value to Upper case and search then I am able to get only Upper case values but not mixed case values..
Please suugest me what to do to solve this...
Thanks in advance!
Misbah ..
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.