How to frame the select query for wildcard search.
Hi Experts,
I have an input field P_USERALIAS.This value could contain the actual value or the wildcard for example : user can enter P_USERALIAS as SAP123 or S or SAPABC123 . I need to generate a dynamic search on table USREFUS depending on what has been entered.Please help.
Useful answers will be rewarded.
Regards,
Shrita Sharma.
THIS IS A TEST REPORT FOR WILDCARD SEARCH**
TABLES: USREFUS.
PARAMETERS: P_NAME1 TYPE string.
RANGES: R_NAME1 FOR USREFUS-USERALIAS.
DATA: T_usrefus LIKE usrefus OCCURS 0 WITH HEADER LINE.
*replace
if p_name1 cs '*'.
replace all occurrences of '*' in p_name1 with '%'.
SELECT * FROM usrefus
INTO TABLE T_usrefus
WHERE useralias like P_NAME1.
else.
SELECT * FROM usrefus
INTO TABLE T_usrefus
WHERE useralias = p_name1.
endif.
LOOP AT T_usrefus.
WRITE: / T_usrefus-useralias.
ENDLOOP.
**THANKS & REGARDS
SHRITA SHARMA.
Similar Messages
-
How to change the browser used for Google search from context menu of selected text?
How to change the browser used for Google search from context menu of selected text?
It uses Safari. But I want to use Chrome (it's my default browser).How to change the browser used for Google search from context menu of selected text?
It uses Safari. But I want to use Chrome (it's my default browser). -
How to insert the select query result into table?
How to insert the select query result into table?
SELECT top 20 creation_time
,last_execution_time
,total_physical_reads
,total_logical_reads
,total_logical_writes
, execution_count
, total_worker_time
, total_elapsed_time
, total_elapsed_time / execution_count avg_elapsed_time
,SUBSTRING(st.text, (qs.statement_start_offset/2) + 1,
((CASE statement_end_offset
WHEN -1 THEN DATALENGTH(st.text)
ELSE qs.statement_end_offset END
- qs.statement_start_offset)/2) + 1) AS statement_text
FROM sys.dm_exec_query_stats AS qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st
ORDER BY total_elapsed_time / execution_count DESC;
Thanks,
Tirumala1. SELECT INTO
Below method will create table when data is inserted from one table to another table. Its useful when you need exactly same datatype as source table.
Use AdventureWorks2008R2;
Go
---Insert data using SELECT INTO
SELECT AddressLine1, City
INTO BothellAddresses
FROM Person.Address
where City = 'Bothell';
GO
---VERIFY DATA
Select AddressLine1, City
FROM BothellAddresses
---DROP TABLE
DROP TABLE BothellAddresses
GO
2. INSERT INTO SELECT
Below method will need table to be created prior to inserting data. Its really useful when table is already created and you want insert data from
another table.
Use AdventureWorks2008R2;
Go
---Create Table
CREATE TABLE BothellAddresses (AddressLine1 NVARCHAR(60), City NVARCHAR(30))
---Insert into above table using SELECT
INSERT INTO BothellAddresses(AddressLine1, City)
SELECT AddressLine1, City
FROM Person.Address
where City = 'Bothell';
---VERIFY DATA
Select AddressLine1, City
FROM BothellAddresses
---DROP TABLE
DROP TABLE BothellAddresses
GO
Regards,
Vishal Patel
Blog: http://vspatel.co.uk
Site: http://lehrity.com -
How to optimize the select query that is executed in a cursor for loop?
Hi Friends,
I have executed the code below and clocked the times for every line of the code using DBMS_PROFILER.
CREATE OR REPLACE PROCEDURE TEST
AS
p_file_id NUMBER := 151;
v_shipper_ind ah_item.shipper_ind%TYPE;
v_sales_reserve_ind ah_item.special_sales_reserve_ind%TYPE;
v_location_indicator ah_item.exe_location_ind%TYPE;
CURSOR activity_c
IS
SELECT *
FROM ah_activity_internal
WHERE status_id = 30
AND file_id = p_file_id;
BEGIN
DBMS_PROFILER.start_profiler ('TEST');
FOR rec IN activity_c
LOOP
SELECT DISTINCT shipper_ind, special_sales_reserve_ind, exe_location_ind
INTO v_shipper_ind, v_sales_reserve_ind, v_location_indicator
FROM ah_item --464000 rows in this table
WHERE item_id_edw IN (
SELECT item_id_edw
FROM ah_item_xref --700000 rows in this table
WHERE item_code_cust = rec.item_code_cust
AND facility_num IN (
SELECT facility_code
FROM ah_chain_div_facility --17 rows in this table
WHERE chain_id = ah_internal_data_pkg.get_chain_id (p_file_id)
AND div_id = (SELECT div_id
FROM ah_div --8 rows in this table
WHERE division = rec.division)));
END LOOP;
DBMS_PROFILER.stop_profiler;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN TOO_MANY_ROWS
THEN
NULL;
END TEST;The SELECT query inside the cursor FOR LOOP took 773 seconds.
I have tried using BULK COLLECT instead of cursor for loop but it did not help.
When I took out the select query separately and executed with a sample value then it gave the results in a flash of second.
All the tables have primary key indexes.
Any ideas what can be done to make this code perform better?
Thanks,
Raj.As suggested I'd try merging the queries into a single SQL. You could also rewrite your IN clauses as JOINs and see if that helps, e.g.
SELECT DISTINCT ai.shipper_ind, ai.special_sales_reserve_ind, ai.exe_location_ind
INTO v_shipper_ind, v_sales_reserve_ind, v_location_indicator
FROM ah_item ai, ah_item_xref aix, ah_chain_div_facility acdf, ah_div ad
WHERE ai.item_id_edw = aix.item_id_edw
AND aix.item_code_cust = rec.item_code_cust
AND aix.facility_num = acdf.facility_code
AND acdf.chain_id = ah_internal_data_pkg.get_chain_id (p_file_id)
AND acdf.div_id = ad.div_id
AND ad.division = rec.division;ALSO: You are calling ah_internal_data_pkg.get_chain_id (p_file_id) every time. Why not do it outside the loop and just use a variable in the inner query? That will prevent context switching and improve speed.
Edited by: Dave Hemming on Dec 3, 2008 9:34 AM -
How to create the select option for the Plant in screen (Module pool)
HI,
I am developing one module pool program and I have below requirement,
currently plant is acting like PARAMETER and the now it should be changed to select option.
how to create the select option in the screen
Thanks and regarding,
Malla
Moderator message - Cross post locked
Edited by: Rob Burbank on Dec 16, 2009 1:41 PMSteps to get SELECT-OPTIONS in module pool programs.
1.Start one dialog program with SAPMZ_001.
Place the below code in the TOP include of the dialog program.
TABLES marc.
SELECTION-SCREEN BEGIN OF SCREEN 3200 AS SUBSCREEN.
SELECT-OPTIONS: werks FOR marc-werks.
SELECTION-SCREEN END OF SCREEN 3200.
2 .Create one screen 3000.
Go to Layout of the screen and Define subscreen area on the screen and Name it as l_subscreen.
Place the below code in the Flow logic of the screen.
PROCESS BEFORE OUTPUT.
CALL SUBSCREEN l_subscreen INCLUDING 'SAPMZ_001' '3200'.
PROCESS AFTER INPUT.
CALL SUBSCREEN l_subscreen.
Activate all.
Create Transaction code for the dialog program .
Execute the transaction code. You will see the select-option for werks how we see on Selection-screen. -
How to write the select query with complex where condition
Hi all,
Can u help me in writing following select query.
select * from zu1cd_corr where time_stamp between firstday and lastday .
In the above query time_stamp contains the date and time.
where as firstday and lastday contains the dates.
I need to compare the date in the time_stamp with the firstday and lastday.
But time_stamp contains the time also and it is char of 14 characters length.Hi,
If that is the case u can do as advait specified....
if the firstday and secondday are select-options then declare two more variables having 14 character length and then concatenate '000000' to firstday variable and '240000' to last day variable and then write ur query.
CLEAR : lv_firstday,
lv_lastday.
concatenate firstday '000000' to lv_firstday.
concatenate lastday '240000' to lv_lastday.
ranges : r_Date for zu1cd_corr-time_stamp.
r_date-sign = 'I'.
r_date-option = 'BT'.
r_Date-low = lv_firstday.
r_Date-high = lv_lastday.
append r_date.
select * from zu1cd_corr into table it_zu1cd_corr where time_stamp in r_Date.
I hope it helps.
Regards,
Nagaraj -
How to mofidy the selection text for a report
Dears,
Do you know how to modify a selection text in the selection screen of a standard report, such as changing "Storage Location" in the selection screen of report MB5B to "storage Loc"?
one of a way to realize it is to modify the text of relevant data element.
except modifying the data element directly, It seems that use SE63 could do it, but I forgot how to use it.
Thanks all for your reply.
ZhongkaiHi Liu,
Check this link for translations thru SE63:
http://help.sap.com/saphelp_sm310/helpdata/en/b4/54601d77f38e429ffad9e3e11c1b25/content.htm
Hope this helps you.
Regards,
Chandra Sekhar -
How to set the default query for query component.
I have a query component on the page, and there are 2 system query in the saved search dropdown list.
Here is my system saved search
Saved Search:
Search by worker
Search by organization.
when the page load the default search panel is always search by worker.
I want to default the search panel search by organization. How do I implement this.Thanks for your reply. Maybe I not describe my question clearly, I want to display different search form.
For example
when search by work, the search form displayed as firstname, lastname, gender etc.
when search by work, the search form dispaly as organization name , manager name etc.
I resolve this issue by customize the queryMode object. -
How to change the lable text for a search parameter in af:query
Hello.
I have a db table with a column "Date Requested". I have created a search functionality using the ViewCriteria with bind variables to filter the results in a given date range based on the Date Requested Column. I have used it as the af:query with table as results on the screen.
I want to change the label on the screen for that search attribute as "From Date" and "To Date". Right now I see the Date Requested as the label name in the af:query component
Please let me know if you have any suggestions.
Thanks,
Vinay PolisettiVinay,
Not Sure. As per the below threads there is a bug (bug 12806987) raised for this sometime back. Not sure about the status of it.
View Criteria: I can´t change the labels to bind variable
Label of bind variables with Criteria inside ViewCriteria
You could probably try the follow the below link and try to change it programatically.
Binaries: Customizing the <af:query> component display by overriding CriteriaItemAttributeHints
Cheers
AJ -
How to terminate the running query for a report?
Hi,
When I run a report, the SQL query takes too long.
This causes an overload on database.
How do I stop query from running after some time?It is NOT possible in OBIEE 10g.
In OBIEE 11g, When a scheduled report job is in running status, you can now cancel the running job from the Report Job History page.
Check this Section 6.9, ["Canceling a Running Job." |http://docs.oracle.com/cd/E23943_01/bi.1111/e22257/view_manage_rpt_his.htm#cancel_runj]
And only possible since 11.1.1.5
regards
Jorge
p.s If this answers your question then please mark my answer as "Correct" or "Helpful" -
How to edit the selectable languages for spell checking?
Hallo Mozzila Community
After using Firefox nightly 23 on Chakra Linux via bundle and I think it messed up my settings of the spell checker via Firefox sync.
The Problem pop up on openSUSE and Chakra Linux but not In Kubuntu 12.04(it has separate language packs).
I want to have German and English GB and maybe Bosnian or Croatian spell checker but I can not select it via right click -languages.
Now I have on both Chakra Linux and openSUSE 12.3 Firefox 20 by default maybe 30 languages installed but I can not select the language I want.
For example on Chakra Linux Firefox 20 I have only German variants selectable,German Luxenbourg,German Belgium ... and so and I can not select other language via add-on or about:config spellchecker.dictionary; it stay alwas on a German variant so I need to edit the right click language selector to bring it to work.
2.Example on openSUSE can not select German and En_GB but I can select a bunch of other languages I do not need in the right click languages selctor.
Both are Firefox 20 with openSUSE KDE modifications and have all available spell dictionary installed.
So how can I edit the list of selectable languages on the right click-languages?There is a difference between language packs that affect the Firefox user interface and spell check dictionaries.
*http://kb.mozillazine.org/Language_packs
At least one dictionary should be installed and have a check mark to indicate that it is selected.
*Open the "Add Dictionaries" link to install a dictionary if you do not have one.
*Make sure that [X] "Check Spelling" in the right-click context menu is check-marked.
You can look here for dictionaries:
*https://addons.mozilla.org/firefox/language-tools/
*http://kb.mozillazine.org/Dictionaries
*http://kb.mozillazine.org/Spell_checking -
How to write the SQL query for generating triangular numbers
Hi,
I have a table ..which stores the sequence number like this
Seq :
1000
1200
1300
1500
1800
1900
Now i want to get a result like this
1000 1000
1200 2200
1300 3500
1500 5000
1800 6800
1900 8700
how can it be achieved. I tried using Lead and lag. but only I can add the n+1 or n-1 results. Please help.I've never heard it called 'triangular numbers' before but I think you're looking for a 'running total':
SQL> WITH data AS
2 (
3 SELECT 1000 AS num FROM dual UNION ALL
4 SELECT 1200 AS num FROM dual UNION ALL
5 SELECT 1300 AS num FROM dual UNION ALL
6 SELECT 1500 AS num FROM dual UNION ALL
7 SELECT 1800 AS num FROM dual UNION ALL
8 SELECT 1900 AS num FROM dual
9 )
10 /* END SAMPLE DATA */
11 SELECT num, SUM(num) OVER (ORDER BY num) AS running_total
12 FROM data
13 ORDER BY 1
14 ;
NUM RUNNING_TOTAL
1000 1000
1200 2200
1300 3500
1500 5000
1800 6800
1900 8700
6 rows selected. -
Select query for every 1000 records
Hi all ,
Please help me in the issue . I am using select query Select * from table up to 1000 rows for acheving the records but i want this process to retrigger once the process of 1000 records is compleded again it needs to fetch the next 1000 records and process the same . I am changing the status of the processed records once it is processed . Can can one tell me how to retrigger the select query once the 1000 records are processes.
Thanks in advance,Hi Eric,
After selecting the 1000 records, find the key value of the last record. Build up the range as GT. Again use the select query.
For example,
Select * into table lt_data from ztab
where key in r_key
up to 1000 rows.
regards,
Niyaz -
Select Query for smart form-invoice
Hi Folks,
I have to fetch the following fields as per the requirement for desiging a invoice smartform.I had copied lb_bill_invoice smartform into z format.
Can anyone here please give me the select query for the same.
fields to fetched are as follows:-
1.vbrp-arktx,
2.vbrp-fkimg,
3.konv-kbetr with respect to vbrk-knumv
4.konv-kwert.
And also what all I have to give in format interface and global definitions of the smartform.
please help me in this regard.
Points will be given.
K.Kiran.Hi,
declare the variables V_arktx(40) and v_Qty like vbrp-fkimp and other varaibles for Kbetr, kwert, knumv on the global definitions.
select single arktx fkimg into (v_arktx, v_qty) from vbrp
where vbeln = LBBIL_IT_REFPURORD-BIL_NUMBER.
select single knumv into v_knumv from vbrk where where vbeln = LBBIL_IT_REFPURORD-BIL_NUMBER.
this select has to fire in the item level and in the loop.
so have to write in the correct place.
select kbetr kwert into (v_kbetr, v_kwert) from konv
where where knumv = v_knumv and kposn = LBBIL_IT_REFPURORD-ITM_NUMBER.
regards,
anji -
How to write selection Query for the following requirment.
Hi All,
I am new to ABAP, I need a help ,
I need to select all plants(WERKS) from MARC at Plant/Material level,
then I need to take all sales organozation(VKORG) from T001w,
then I need the company code(BUKRS) from TVKO based on VKORG,
then I need the currency key(WAERS) from T001 based on BUKRS,
Can any one help me in writing selection Query for the same?
Thanks All,
Debrup.Hi,
Its easy for you if you learn SELECT with JOIN to complete your task. So SEARCH the forum with SELECT statement and you will get a lot of examples using which you can write your own.
If you struck up anywhere revert back.
Regards
Karthik D
Maybe you are looking for
-
I can only navigate back/forward one page at a time. The drop down box that used to allow me to see the recent pages and select the page I wanted to go to was immediately to the right of the "forward" button. I can right click over the forward/back b
-
VS 2005 Design Environment - CR v10 CrystalReportsViewer Problem
I have a Design time VS 2005 web page which has a CrystalReportsViewer control which references a CrystalReportSource control which has a FileName property that points to an external file which is a Crystal .rpt file of a report created by CR v10 Dev
-
Where can i find a download for acrobat x pro
where can i find a download for acrobat x pro, i lost a hard drive and i am trying to get everything back ?
-
Why is the headphone jack on the bottom?
I was really excited for the iPhone 5 but now I don't think I'll be getting one. For me, changing the location of the headphone jack is entirely unnecessary. I've been reading up on this, and the only reason I can find for it is because people say
-
Hi, I want to build a query which shows all accounts. What I mean even if there is a 0 value for that account in that period i want to see all the values for the account number. Can anyone help me? Thanks