Select query to find material# corresponding to particular value
Hello,
I have an internal table which has a field called 'series' which is basically the
the last five digits of mara-prdha.
With the 'series' number in hand, i need to find the corresponding materials. Thus, need to write a
select query to for all series numbers in the internal table to find their materials.
How do i do this?
Thanks,
Blessy
Try out this code..
data : it_mara type standard table of mara.
types : begin of s_series,
series type MARA-PRDHA,
end of s_series.
data : it_series type table of s_series.
data : wa_series like line of it_series.
wa_series-series = '00001'. " Appped prdha value from ur table
append wa_series to it_series.
data : v_series type string.
loop at it_series into wa_series.
CONCATENATE '_____________' wa_series-series into v_series.
select * from mara into mara where prdha like v_series.
append mara to it_mara.
ENDSELECT.
endloop.
Note : Performance will be low
Similar Messages
-
Query to find all Debug profile & trace values on PO module
Hi
we are using oracle11i(11.5.10.2 on windows 2000 server)
i want to know all debug & trace values for PO & workflow moule using query.
is any one having idea regarding query?
Thanks
With Regards
A-ZPlease see these docs/threads.
Problem with 11.5.10.2
Problem with 11.5.10.2
Query To Get Enabled Trace/Log/Debug Profile Options [ID 559618.1]
Also, see this docs for the queries you can run to list the value of the profile options at all levels.
Note: 201945.1 - How to list E-Business Suite Profile Option values for all levels using SQLPlus
Note: 282382.1 - How to Search all of the Profile Options for a Specific Value
Note: 367926.1 - How To Find All Users With A Particular Profile Option Set?
Thanks,
Hussein -
Problem is select query.
Hello SDNites,
I have a req where I need to use select query to fetch data. But the conditions which is to be placed in this select query has 3 checkboxes corresponding to the same field. Either of them can be selected at a time. Please let me know how can we put this condition effectively in one select query.
Thanks,
AbhishekHi Abhishek,
Depending on your check box selection u can concatenate the string for where ckause....
For eg:-
concatenate `'` 'A' `'` into fs.
concatenate `'` 'F' `'` into fs1.
if cb1 = 'X' and CB2 = 'X'.
CONCATENATE 'bstyp' '=' FS 'OR' 'bstyp' '=' FS1 INTO FS SEPARATED BY SPACE.
endif.
select * from dbtab into table itab where (fs).
depending on ur check box selection u can change ur VARIABLE FS to be used in where clause....... But u just need to use single select query. -
SQl query to find incompatibility defined
If two programs are defined as incompatible with one another, the data these programs cannot access simultaneously must also be identified.
This can be found from concurrent program->define from front end ebs login, but is there any SQL query to find this for a particular program or request set??
Thanks in advance.Please search the forum before posting similar questions.
Concurrent-Conflict
Re: Concurrent-Conflict
Thanks,
Hussein -
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 -
Hi All,
i_dfkkko-xblnr
IF NOT i_dfkkko[] IS INITIAL .
SELECT opbel
belnr
FROM erchc
INTO TABLE i_erchc1
FOR ALL ENTRIES IN i_dfkkko
WHERE opbel EQ i_dfkkko-xblnr.
ENDIF.
I am using the above select query.problem is when i put the value
of i_dfkkko-xblnr by going to the table erchc i am getting the record.But this qury is not resulting any value.
i have checked in debug mode copied the value of xblnr of i_dfkkko
and went to erchc table and passed to opbel of erchc i got the reords.
can anybody pls help..
Rgds,
SaiHi,
The database would be having the value with leading zeroes.
Use FM "CONVERSION_EXIT_ALPHA_INPUT" to conver the values & then pass to select query.
_dfkkko-xblnr
IF NOT i_dfkkko[] IS INITIAL .
loop at i_dfkkko.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
VALUE(INPUT) = i_dfkkko-xblnr
IMPORITNG
VALUE(OUTPUT) = i_dfkkko-xblnr.
modify i_dfkkko.
endloop.
SELECT opbel
belnr
FROM erchc
INTO TABLE i_erchc1
FOR ALL ENTRIES IN i_dfkkko
WHERE opbel EQ i_dfkkko-xblnr.
ENDIF. -
How can i use SUM aggregate in select query?
HI,
GURUS,
How can i use SUM function in Select Query and i want to store that value into itab.
for ex:
TABLES: vbap.
types: begin of ty_vbap,
incluse type vbap,
sum type string,
end of ty_vbap.
data: i_vbap type TABLE OF ty_vbap,
w_vbap type ty_vbap.
SELECT sum(posnr) FROM vbap into table i_vbap up to 5 rows.
(or)
SELECT sum(posnr) FROM vbap into table i_vbap group by vbeln.
loop at i_vbap into w_vbap
" which variable have to use to display summed value.
endloop.
if above code is not understandable pleas give ome sample code on above query.
Thank u,
shabeer ahmed.Hi,
Check this sample code.
TABLES SBOOK.
DATA: COUNT TYPE I, SUM TYPE P DECIMALS 2, AVG TYPE F.
DATA: CONNID LIKE SBOOK-CONNID.
SELECT CONNID COUNT( * ) SUM( LUGGWEIGHT ) AVG( LUGGWEIGHT )
INTO (CONNID, COUNT, SUM, AVG)
FROM SBOOK
WHERE
CARRID = 'LH ' AND
FLDATE = '19950228'
GROUP BY CONNID.
WRITE: / CONNID, COUNT, SUM, AVG.
ENDSELECT.
Regards,
Sravanthi -
Query to find out which workflow(s) use a particular message ? wf_messages
Hi guys
Hoping someone can help.
I've a list of particular notfication messages, which are stored in the WF_MESSAGES_TL and WF_MESSAGES table, and I need to find out which workflows use them.
Can anyone tell me what table I can query to find this out ?
There's no referential integrity which I can use to find this out, and google has turned up nothing so far.
Any ideas ?
Thanks a lot
ScottYou can use this and tweak it around:
select p.process_item_type, p.process_name, p.activity_name, a.message
from wf_process_activities p, wf_activities a
where p.process_item_type=a.item_type and
p.activity_name=a.name and
a.end_date is null;-- means the active/current activity
Regards,
Alejandro -
Can anybody provide the SQL query to find the files uploaded in a particular folder?
Hi All,
Can anybody provide the SQL query to find the documents (document name) uploaded in a particular folder? While clicking on folder in
GUI I'm hitting the Timeout error. I would like to find the files uploaded into this folder from SQLPLUS.
Any help is greatly appreciated.
With best regards,
NevinNevin,
Be great if we could know the version of Portal. For Rel. 1, here's the query
select id,masterthingid from wwv_things
where siteid = &site
and cornerid = &corner
&site - Content Area id
&corner - Folder id
if you don't know the folder id, use
select id from wwv_corners where siteid = &site
and name = &folder
Hope this helps. I have run into this situation before. Usually, the culprits were
one of the following:
1. Junk Characters in description of item (caused due to Copy-Paste)
2. Special Characters in the File name
Hi All,
Can anybody provide the SQL query to find the documents (document name) uploaded in a particular folder? While clicking on folder in
GUI I'm hitting the Timeout error. I would like to find the files uploaded into this folder from SQLPLUS.
Any help is greatly appreciated.
With best regards,
Nevin -
Query to find vendor number with whom a particular item was last purchased.
Hi All,
I want to frame a SQL query to find vendor number with whom a particular item was last purchased.
I got to know that we can find this by looking at the open Purchase Order or the Material Transactions for the transaction type of ‘PO Receipt’ whichever is the latest.
Can anyone please help me in framing such query.
Regards,
ShrutiHere is a hint
Use the mtl_system_items_b table to get the inventory_item_id.
Use it in the po_lines_all table to get po_header_id
Use it in po_headers_all table to get vendor_id
Use it in po_vendors to get segment1 (i.e. vendor#)
Hope this helps,
Sandeep Gandhi -
Query to find the list of BP without having Particular GL transactions.
Hi Experts,
I want the query to find the List of Business partner who is not having Journal entry for Certain General ledger.
Scenario: we are creating JE for TDS posting.
so, i want to know the list of BP , who and all not having particular TDS GL for the particular period.
Thanks in advance,
DwarakHi Dwarak,
Sure, no problem
DECLARE @AcctCode AS NVARCHAR(100)
SELECT @AcctCode=T0.AcctCode FROM OACT T0 WHERE T0.AcctCode='[%0]'
DECLARE @DateFrom AS DATETIME
SELECT @DateFrom=T1.RefDate FROM JDT1 T1 WHERE T1.RefDate=[%1]
DECLARE @DateTo AS DATETIME
SELECT @DateTo=T2.RefDate FROM JDT1 T2 WHERE T2.RefDate=[%2]
SELECT CardCode FROM OCRD WHERE CardType='S'
AND CardCode NOT IN(
SELECT DISTINCT ContraAct FROM JDT1
WHERE Account=@AcctCode AND RefDate BETWEEN @DateFrom AND @DateTo)
Ok, now, here's the problem that I just encountered. This query will work, but, no matter how we fill the parameter, it will show you the very same result. To be honest, I don't know what's wrong with this query.
If you change all the variables ( @AcctCode and @DateFrom and @DateTo ) directly, it will give you the accurate result. Take this as an example:
SELECT CardCode FROM OCRD WHERE CardType='S'
AND CardCode NOT IN(
SELECT DISTINCT ContraAct FROM JDT1
WHERE Account='10030201' AND RefDate BETWEEN '2011-09-01' AND '2011-09-20')
I hard-code the account code, date from and date to for selection. System will show you the accurate result, but using parameter as in first query, system show same result no matter how we fill the parameter.
Sorry, it seems that I could only partially solved your problem here. I already tried to create a stored procedure and executing the stored procedure with parameter, but still, somehow SBO show very same result no matter if we change the parameter.
So, my solution need user to manually change the parameter in query. I know, this is a stupid solution, I'm afraid I can't help you to achieve perfect solution here. Maybe anyone here in the forum could guide me to fix my mistake in first query and how to rectify it?
Best Regards,
Hendry Wijaya -
Finding the original quanitity on sales order : Select Query on CDPOS ?
Hello ABAPers,
I have created a sales order and I changed the order quantity over many times using Va02. If i want to programatically determine the orginal quantity, on the sales order when it was created , how would i determine ?
I thought, I would do a select query on CDPOS table and find out. But i found from se16 that for the Object ID - VERKBELEG and Object id = 00000XXXXX ( where XXXXX is sales order number), the VBEP and VBAP entries for Update mode shows no Old_vales and New_values.
But if i click on environment>Changes> in Va02 for that particular Sales order, I see the old and new values list.
Why is this not listed in CDPOS ? How do I progrmatically determine the original quanitity on Sales order ?
Thanks
SHKHi Ferry,
That FM did the trick. I ended up creating a FM myself to find the original qty and original unit. Somehow select qry on CDHDR and CDPOS, returned empty field for Old_value and new_value. Here is my FM below
FUNCTION z_sw_originalqty_on_so.
*"*"Local interface:
*" IMPORTING
*" VALUE(I_VBELN) TYPE VBELN OPTIONAL
*" VALUE(I_POSNR) TYPE POSNR OPTIONAL
*" EXPORTING
*" VALUE(I_ORIGINAL_QTY) TYPE KWMENG
*" VALUE(I_ORIGINAL_UNIT) TYPE VRKME
DATA : i_editpos TYPE TABLE OF cdred INITIAL SIZE 1 .
DATA : wa_editpos LIKE LINE OF i_editpos.
DATA : wa_editpos1 LIKE LINE OF i_editpos.
DATA : i_cdhdr TYPE TABLE OF cdhdr INITIAL SIZE 1.
DATA : i_cdpos TYPE TABLE OF cdpos INITIAL SIZE 1.
DATA : wa_cdhdr LIKE LINE OF i_cdhdr.
DATA : wa_cdpos LIKE LINE OF i_cdpos.
DATA : i_objid TYPE cdhdr-objectid.
DATA : delimiter(1) VALUE ' '.
DATA : lv_org_qty(127) TYPE c,
lv_org_unit(127) TYPE c.
DATA : l_tabkey TYPE cdpos-tabkey.
DATA : i_flag.
CLEAR i_flag.
CONCATENATE sy-mandt i_vbeln i_posnr '0001' INTO l_tabkey.
i_objid = i_vbeln .
CALL FUNCTION 'CHANGEDOCUMENT_READ'
EXPORTING
objectclass = 'VERKBELEG'
objectid = i_objid
tablekey = l_tabkey
tablename = 'VBEP'
TABLES
editpos = i_editpos
EXCEPTIONS
no_position_found = 1
wrong_access_to_archive = 2
time_zone_conversion_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
SELECT SINGLE bmeng INTO i_original_qty FROM vbep
WHERE vbeln = i_vbeln AND
posnr = i_posnr.
SELECT SINGLE vrkme INTO i_original_unit FROM vbep
WHERE vbeln = i_vbeln AND
posnr = i_posnr.
ENDIF.
SORT i_editpos BY udate utime tabname fname .
LOOP AT i_editpos INTO wa_editpos.
READ TABLE i_editpos INTO wa_editpos1
WITH KEY tabname = 'VBEP'
fname = 'WMENG'
CHNGIND = 'U'.
CLEAR : i_original_qty,i_original_unit.
IF sy-subrc EQ 0.
SHIFT wa_editpos1-f_old LEFT DELETING LEADING space.
SPLIT wa_editpos1-f_old AT delimiter INTO lv_org_qty lv_org_unit .
i_original_qty = lv_org_qty.
i_original_unit = lv_org_unit.
i_flag = 'X'.
EXIT .
ENDIF.
ENDLOOP.
sy-subrc = 4.
IF sy-subrc <> 0 AND i_flag NE 'X'.
SELECT SINGLE bmeng INTO i_original_qty FROM vbep
WHERE vbeln = i_vbeln AND
posnr = i_posnr.
SELECT SINGLE vrkme INTO i_original_unit FROM vbep
WHERE vbeln = i_vbeln AND
posnr = i_posnr.
ENDIF. -
Select query in materialized view with two dblinks
Hi All,
We have oracle 10g On windows.
We are trying to create materialized view. Scenario is we have base table on other database and we are creating mview on different database.
Basa database have two schema's and i am selecting records from that two schema's using two private db links.
But when i am tryin gto create mview its not getting created. After 15 hrs. its still showing creation command and not finished.
Query is :-
Is it good practice to have two db links in select query of materialized view.Billy Verreynne wrote:
Chanchal Wankhade wrote:
Is it good practice to have two db links in select query of materialized view.Same db link being used twice, or two different db links?
If the former, you ideally want the local Oracle db to send the join to the remote database, and for the remote database to drive the join between those 2 tables. There is a hint (<i>driving_site</i>) that can be used - or the join query can be defined on the remote database as a view, and the local materialised view can then use that remote view.
If you have 2 different db links and joining across these - usually a bad idea to perform distributed database joins. There are lots of limitations as to how the tables can be joined. Worse case, full table scans of both remote tables, pulling all the rows from the 2 remote database tables to the local database, and joining these on the local database.
I have seen some severe performance issues in the past as a result of distributed joins. I'll rather use 2 materialised views for pulling both distributed tables's data locally, and then do the join on local data (using indexes, partition pruning, etc)Hi Billy,
My scenario is i have two database database A and database B. Database A is having two schema's SCOTT AND HR. SCOTT schema have select privileges on HR schema.
DB LINK is between Database B to Database A. name is db.link.B.A.oracle.com.
What if i priovide while creating materialized view, the schema name before the table name in database B for this particuler table so it will pick up the table from that schema using same DB LINK(db.link.B.A.oracle.com.) that i am using to fetch records from SCOTT schema.
Above schnario is like two base schema's and one db link using two schema. -
In oracle rac, If user query a select query and in processing data is fetched but in the duration of fetching the particular node is evicted then how failover to another node internally?
The query is re-issued as a flashback query and the client process can continue to fetch from the cursor. This is described in the Net Services Administrators Guide, the section on Transparent Application Failover.
-
Query to find the list of users having access to a particular scenario
Hi,
I am learning Hyperion Planning 9.2 x version. I wanted to know the query to find the list of users having access to Plan Iteration - 1 scenarion.
As I am new to Hyperion Essbase and Hyperion Planning, I am assuming these ideas work out to get the desired result.
1) As Hyperion Planning uses Relational DB to store the User Security information, we can query the list of users who is having access to Plan Iteration - 1 Scenario.
I am not sure if this solution works. Please correct me If I am wrong.
2) We can also query from the essbase editor to find out who all having access to this scenario.
If the above is correct, can you please provide me the query.
I am really need of this and I will be happy if any one provide the solution.
Thanks & Regards,
Upendra. BesthaHi,
If you are looking for some SQL to retrieve the access rights by member then you can use something like (SQL Server code though can easily be modified for Oracle)
SELECT usr.object_name as Username,mem.object_name as Member,
'Access Rights' = CASE acc.access_mode
WHEN -1 THEN 'None'
WHEN 1 THEN 'Read'
WHEN 2 THEN 'Write'
WHEN 3 THEN 'Write'
ELSE 'Unknown' END,
'Relation' = CASE acc.flags
WHEN 0 THEN 'Member'
WHEN 5 THEN 'Children'
WHEN 6 THEN 'Children (inclusive)'
WHEN 8 THEN 'Descendants'
WHEN 9 THEN 'Descendants (inclusive)'
ELSE 'Unknown' END
FROM
hsp_access_control acc, hsp_object mem, hsp_object usr
WHERE acc.object_id = mem.object_id
AND acc.user_id = usr.object_id
AND mem.object_name = 'Plan Iteration - 1'
Cheers
John
http://john-goodwin.blogspot.com/
Maybe you are looking for
-
Firefox will not load to the web, even after 2nd download.
I have used firefox as a web browser because our school page works best with it. I have used firefox for over three months. This weekend firefox will not load. The screen message says unable to load web page, try again button is displayed, all to no
-
Hi All, From bsik table i have to fetch only vendor open items . what are the fields to be considered so that i can eliminate the other items like parked , deleted......etc and get only the open items for that vendor.. Thanks.
-
Wifi of my iphone 4s has grayed out within 3 months of my purchase..I have now got a replacement from Apple but unfortunately it worked for only 1 day and the wifi got grayed out again...I tried resetting all my settings but all in vain. How many tim
-
Which jar file has WFTaskUpdate.class file ?
Hi BPEL Champs; For TaskList application, we have payload-body.jsp file which has the below <form> element :- <form id="PayloadJSPHTML" name="PayloadJSPHTML" action="WFTaskUpdate" method="post" onSubmit="return validateData(this)"> I want to know whi
-
Radio problem (full text)
I got Nokia 6280. And I got a problem, I can't use Radio. When I clik on Radio nothing happens. When flight mode is on and then I clik on radio it says "unabale to use when flight mode is active". It seems that, menu>multimedia>radio option is to do