Select statement info needed
Hello all,
My req. with select statement is as below.
Need to select all materials from MARA where the product hierarchy (PRDHA) contains u20180050000501u2019 as the first ten characters, and insert them into an internal table .
awaiting for earlier response.
Thanking you.
Bharat.
Hi,
Check this code..
data: t_mara type standard table of mara.
* Make sure to remove * and check whether there is an index on the field PRDHA.
SELECT * FROM MARA INTO TABLE t_mara
where PRDHA LIKE '0050000501%'.
Thanks
Naren
Similar Messages
-
How to use SELECT statement to extract KNA1-NAME1 and KNB1-ZSABE
In building table I_KNA1 in form f_extract_data, an additional select statement is needed to select and append datafrom (KNA1 and KNB1) to existing I_KNA1
In form f_extract_data table i_kna1 is populated with data from zd_kna101.(where ZD_KNA101 is a view of KNA1, KNB1 and KNBK. It's a joint of these three tables.) This will take care of all customers with KNBK-BANKL and KNBK-BANLN populated. But this does not include new customers created in SAP CRM (no KNBK records). Therefore a separate SELECT statement is needed to extract KNA1-NAME1 and KNB1-ZSABE for customers created in SAP CRM(the customers who do do not have BANKL and BANKN). These selected records are then need to be appended to I_KNA1. It's possible that new selection statement might extract records that are already in existing I_KNA1 table. IF this is the case, right after the append, sort I_KNA1 and remove duplicate records.
form f_extract_data.
select kunnr " Customer Number
name1 " Name
zsabe " Business Unit
bankl " Legacy Bank Key
bankn " Legacy Bank Account
from zd_kna101 " View of KNA1, KNB1, and KNBK
into table i_kna1
for all entries in i_doc_by_ref
where kunnr = i_doc_by_ref-kunnr
and zsabe in s_zsabe.
if sy-subrc <> 0.
message a116 with 'customer'. " Customer Table is empty. HALT!!!
else.
sort i_kna1 by kunnr.
endif.
will I have to use the join statement(for KNA1-NAME1 and KNB1-ZSABE using the key as KUNNR) here or give two seperate select statements for extracting data from KNA1 and KNB1 using the key as KUNNR.
THANKS FOR THE HELP.I would suggest using the join on KUNNR. Maybe something like this.
data: begin of itab occurs 0,
kunnr type kna1-kunnr,
name1 type kna1-name1,
ZSABE type knb1-ZSABE,
end of itab.
select kna1~kunnr kna1~name1 knb1~zsabe
into table itab
from kna1
inner join knb1
on kna1~kunnr = knb1~kunnr
where ........
Regards,
Rich Heilman -
Need help : cannot anymore select local info in site definition only remote
Hi
I made the mistake choosing in site deffintion for remote info and not local info
Now it seems impossible to reverse it cannot anymore select local info in site definition only remote
So now I can not make the site normally.
I've closed dreamweaver a couple times and tried it again and even my pc but it seems to be something irreparable?
Does anyone know a better idea than reinstall?
thank you
PaulYou are on the Basic Tab of the Site definition dialog in DW CS3. Unfortunately, that's also the more confusing way to define a site. Nevertheless, you'll note that there are 3 selections across the top of the dialog:
1. Editing Files
2. Testing Files
3. Sharing Files
Have you already filled out the first two?
A site definition in DW *could* only have the first of those three filled out - you really only need the local site defined until you are ready to upload your files (assuming you are only creating static pages - that is, pages without server scripting).
To define most remote sites, all you need to do is to select that you connect to your remote server using FTP, and then to state the folder within which your website files are stored on the remote server (often this is a folder called 'www' or 'wwwroot' or 'public_html').
In my mind, the better way to define a site is to go right to the Advanced tab - it's less confusing because you just fill in all of the fields without going through this 'wizard-type' interface....
So - does that help at all? -
Function in select statement need to be called only for the last record.
Select state,
local,
fun_state_loc_other_details(19) details
from state_local
where pm_key=19
resuts:_
State Local Details
AP APlocal details1
UP UPLocal details1
MP MPLocal details1
i) The above query returns 100 records
ii) fun_state_loc_other_details is also getting called 100 times. But I want this function to be called only for the last record that is 100th record.
is there any way to do that?Thanks amatu.
One more small query. Can I do it on condition based.
Select state,
local,
fun_state_loc_other_details(19) details
from state_local
where pm_key=19
Like if one state it need to be called once.
AP -- 50 records
UP - 20 records
MP -- 10 records.
fyi: this record no. varies
I want the function to be called for AP once, UP once, MP once. -
Need help in how to combine select statement
Hi,
Table1 (VIEWREST2005)
- ip
- msg
- fulldata
- ID
Table2 (L200505)
- ip
- msg
- fulldata
I want to create one sql that can select from table 2 to table number 1. This is my select statement, but it cannot running. The different between this 2 table is only column ID.
insert into VIEWREST2005(ip,msg,fulldata) values(select ip, msg,fulldata from L200505)
Can anyone modified my sql statement.Why do you not refer to the Oracle® Database SQL Reference manual? Or do you think your SQL Kung Fu is good enough that no RTFM'ing is needed?
On-line copies of all Oracle documentation is available via http://tahiti.oracle.com/
BTW, the correct syntax for this flavoured INSERT is:
INSERT INTO table SELECT .. FROM table
Drop the VALUES clause as no literal values are supplied. -
Need to create a transaction for multiple select statements?
Hello,
I am a newbie and have a question about database transaction, e.g. whether/not to enclose multiple select statements (and select statements only) into a transaction.
My database is set to transaction isolation level 2: REPEATABLE READ, where dirty read & non-repeatable read are not allowed, only phantom read is allowed.
Now, in my code I have a number of methods that only contain select statements only. Since they are merely select statements, which don't do any modifications to the data, I am not sure if I am supposed to enclose them into a transaction.
However, if I don't put them into a transaction will the transaction isolation level takes into effect automatically when another user is modifying the data that I am reading? In other words, I need to make sure the select statements will never do either dirty read or non-repeatable read. But I am not sure if it is necessary to enclose multiple select statements in a transaction, since I believe putting the select statements into a transaction will put some locks to the data being read which may reduce the concurrency of my application.
Any help/advice would be very much appreciated.
DuaneYou might want to try asking this on a forum that specific to your database. I suspect the answer can vary depending on the database and probably requires in depth knowledge of what the database does.
-
Need help on select statement...
Hi,
I need to fetch from vbfa table those records where vbeln starts with '0800'.
my select statement given below gives a syntax error..pl help.
SELECT * FROM vbfa WHERE vbeln(4) = '0800'.
vbeln(4) is not accepted and i get the message ' field vbeln(4) is unknown' ...what to do?
thksUse LIKE. Please see F1 on this.
Rob
(changed CP to LIKE)
Edited by: Rob Burbank on Sep 15, 2008 11:18 AM -
Need to wite pl sql procedure for dynamic select statement
Need pl sql procedure for a Dynamic select statement which will drop tables older than 45 days
select 'Drop table'||' ' ||STG_TBL_NAME||'_DTL_STG;' from IG_SESSION_LOG where substr(DTTM_STAMP, 1, 9) < current_date - 45 and INTF_STATUS=0 order by DTTM_STAMP desc;I used this to subtract any data older than 2 years, adjustments can be made so that it fits for forty five days, you can see how I changed it from the originaln dd-mon-yyyy to a "monyy", this way it doesn't become confused with the Static data in the in Oracle, and call back to the previous year when unnecessary:
TO_NUMBER(TO_CHAR(A.MV_DATE,'YYMM')) >= TO_NUMBER(TO_CHAR(SYSDATE - 365, 'YYMM')) -
Need help with select statement or query
Not familiar with what to call it, but here is what i need...
To give our analyst a better idea of warranty on some of our
equipment, i
would like to add to the page a column that displays if the
device is still
under warranty
I currently capture the date the equipment was returned from
repair, so what
could i use within my select statement or query to display a
warranty
expiration date or display on the page...
example :
Returned from repair 10/20/2006 warranty expires on
11/20/2006
each equipment has different warranties, so i need a formula
or something to
say... device #1 has 60 day warranty ( so 10/20/2006 + 60days
=
12/19/2006 )
I would imagine this to be a query
Table 1 would contain the equipment type and warranty time
Table 2 would contain the current status of the equipment
Query would take the back from repair date + warranty =
expiration dateSimple. Join the two tables and create a derived column for
the expiration date. The exact syntax is dependant on your DBMS, so
check the manual for whichever you are using and look at the date
functions. There will be a function that will allow you to add a
number of date units (day, month, year, etc) to a date
field. -
Need suggestions on my select statement.
Hello experts,
I am having with my select statement since it is running very slow. Normally, the itab it_vendor has records exceeding 7,000. So it loops 7, 000 times and I have 2 select statements which adds to the performance slowdown. Here it is guys:
*Select records records from BSIK and BSAK based on itab it_vendor
LOOP AT it_vendor.
*Select records from BSIK
SELECT belnr lifnr budat buzei gjahr sgtxt dmbtr
shkzg saknr hkont zlspr FROM bsik
INTO TABLE it_bsak
FOR ALL ENTRIES IN it_vendor
WHERE bukrs EQ p_bukrs
AND budat LE p_keydt
AND hkont IN so_saknr
AND lifnr EQ it_vendor-lifnr
AND umsks EQ space
AND umskz EQ space.
*Select records from BSAK
SELECT belnr lifnr budat buzei gjahr sgtxt dmbtr
shkzg saknr hkont zlspr FROM bsak
APPENDING TABLE it_bsak
FOR ALL ENTRIES IN it_vendor
WHERE bukrs EQ p_bukrs
AND augdt GT p_keydt
AND budat LE p_keydt
AND hkont IN so_saknr
AND lifnr EQ it_vendor-lifnr
AND umsks EQ space
AND umskz EQ space.
ENDLOOP.Since you are using the FOR ALL ENTRIES extension of the select statement, you should not have these inside the loop. What it is correctly doing is getting all the records for all the vendors every time thru the loop. The FOR ALL ENTRIES will get all the records for all of the vendors in one shot, no need to LOOP at the internal table. Make sure that you change your where clauses to how I have them below.
* Get the IT_VENDOR itab here
<b> check not it_vendor[] is initial.
sort it_vendor ascending by lifnr .</b>
*Select records from BSIK
SELECT belnr lifnr budat buzei gjahr sgtxt dmbtr
shkzg saknr hkont zlspr FROM bsik
INTO TABLE it_bsak
FOR ALL ENTRIES IN it_vendor
WHERE<b> lifnr EQ it_vendor-lifnr</b>
and bukrs EQ p_bukrs
AND budat LE p_keydt
AND hkont IN so_saknr
AND umsks EQ space
AND umskz EQ space.
*Select records from BSAK
SELECT belnr lifnr budat buzei gjahr sgtxt dmbtr
shkzg saknr hkont zlspr FROM bsak
APPENDING TABLE it_bsak
FOR ALL ENTRIES IN it_vendor
WHERE <b>lifnr EQ it_vendor-lifnr</b>
and bukrs EQ p_bukrs
AND augdt GT p_keydt
AND budat LE p_keydt
AND hkont IN so_saknr
AND umsks EQ space
AND umskz EQ space.
Regards,
Rich Heilman -
Need a select statement to trim a single value out of a column
I have a column which can and does contain single and multiple values. For instance, there could be a single value, value, or it could look like this value, value, with there being a comma and a space between the two values. I need a select statement that will only and always return the value to the left or in the case of a single value with no comma, just that value. TIA
If your single value has no comma, just the value, then you need an extra DECODE to resolve that case.
SELECT DECODE(INSTR(text,','),0,text,SUBSTR(text,1,INSTR(text,',')-1))
FROM (SELECT 'value1' text
FROM dual
UNION
SELECT 'value2, value3'
TEXT from dual)TTFN
John -
Need Select statement for fetch the details
Hi
i want to fetch particular customer wise sales orderds and that sales order No and date of sales order was created.. and that sales order related PO No and Materials ..
for this.. how can i write an executable programm.. is it needed to define seperate internal tables or single internal table is enough ?
what is the select statement for fetching all these details..
any help will be appriciated
Thanks
Bbaucustmer master table is KNA1 knb1 knbk
sales data tables r VBAK VBAP VBEP
Material data MARA, MARAC, MARD
PO RELATED ekko ekpo eket
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 13, 2008 3:04 PM -
Help need in select statement?
Hi experts...
I have an internal table with 2 records...i_mara with fields matnr and ersda
matnr ersda
2345 01/26/2007
3445 02/05/2007
i need to write a select statement to collect all MBLNR from MKPF table where BUDAT is in between 01/26/2007 and 02/05/2007..
Thanx
GiriHI vasanth and rich...
thanks for replies...
vasanth i am getting error with the statement.. so i assigned 6 points to u..
DATA: RA_BUDAT RANGE OF BUDAT WITH HEADER LINE.
Unable to interpret range.... Possible error with spelling or comma
Rich: ur solution worked good....
is there any possible simplest way... or this is the best way includes performance?
Regards
Giri -
Need help in logic change to avoid select statement inside loop .
Hello all ,
Please see the below code . Here i got the shipment number in internal table IT_VTTK . So For this shipment number i want to get the details from Vekp table in to internal table IT_VEKP . There is no need for me to use For all entries . I have passed the value of it_vekp into work area wa_vekp and getting the details in to IT_vekp using loop.
But since we should not use the select statement inside the loop , Can anybody please tell me how to achieve this functionality .
Instead of passing into work area wa_vttk if i directly use the internal table I'm getting the following error .
"IT_VTTK" is a table without a header line and therefore has no component called "TKNUM".
Hence i have used select statement inside a loop . Please tell me is there any other way to avoid this ?
types:begin of ty_likp,
vbeln type likp-vbeln,
end of ty_likp,
begin of ty_vttk,
tknum type vttk-tknum,
end of ty_vttk.
DATA: IT_VEKP TYPE STANDARD TABLE OF TY_VEKP,
WA_VEKP TYPE TY_VEKP.
data:it_likp type standard table of ty_likp,
wa_likp type ty_likp,
it_likp1 type standard table of ty_likp,
it_vttk type standard table of ty_vttk,
wa_vttk type ty_vttk.
data:w_tknum type vttk-tknum.
if not it_likp is initial .
select vbeln
from
vbfa
into table it_vttk
for all entries in it_likp where vbelv = it_likp-vbeln and vbtyp_n = '8'.
endif .
IF IT_VTTK[] IS NOT INiTIAL.
loop at it_vttk into wa_vttk.
SELECT venum
EXIDV
EXIDV2
BRGEW
NTGEW
GEWEI
TARAG
GEWEI
VHART
INHALT
FROM VEKP INTO TABLE IT_VEKP where VPOBJKEY = wa_vttk-tknum and vpobj = '4'.
endloop.
endif.Hello,
Why would you not like to use FOR ALL ENTRIES in the second select? Is it becasue of the length or type mismatch error between the fields VPOBJKEY and wa_vttk-tknum ?
Vikranth -
Dear Friends
I need select statement correction I want to do get mblnr from my itab. After than from vbfa, I want to get
1.vbpa-vbeln = itab-mblnr and vbfa-matnr = itab-matnr
2.vbfa-vbtyp_v must be 'T'.
3.After than get vbfa-vbelv according to this conditions.
4.And than vbfa-vbelv = lips-vbeln, vbfa-matnr = lips-matnr
5 By the way I want to get lips-lfimg
Please find below select statement but I couldn't succeed.
LOOP AT itab.
SELECT bvbeln bmatnr bvbtyp_v bvbelv cvbeln cmatnr c~lfimg
APPENDING CORRESPONDING FIELDS OF TABLE itab4
FROM vbfa AS b
INNER JOIN lips AS c ON bvbelv EQ cvbeln
WHERE bmatnr EQ cmatnr
AND b~vbeln EQ itab-mblnr
AND vbtyp_v = 'T'.
modify itab.
ENDLOOP.
Your helps will be highly appreciated.
Message was edited by: yusuf tunay çilesizMaybe this can help you.
if not itab[] is initial.
select a~vbeln a~matnr a~vbtyp_n b~lfimg
into corresponding fields of table itab4
for all entries in itab
from vbfa as a inner join lips as b
on a~vbeln = b~vbeln
and a~posnr = b~posnr
where a~vbeln = itab-mblnr
and a~matnr = itab-matnr
and a~vbtyp_n = 'T'.
endif.
With the above code the problem i foresee is when the same material exists more than once in the delivery.
Kind Regards
Eswar
Maybe you are looking for
-
How to make a http request from a pl/sql procedure(URGENT)
I need to make a http request from a pl/sql procedure, can any one tell me which built-in package and which procedure/function we serve my need? Thanks in advance. Ram Prasad.
-
Pl/sql to run different sql based on version
Hello all, I am trying to figure out a maybe a simple problem for a lot of you guys, i want to write a small PL/SQL to get output. If i am running version 10 of the DB then run certain select, if i am running version 11 then run certain select...how
-
I need to update Adobe To have the Flash Player
I need to have Flash Player to be able to have a program for my grand kids
-
A STORED PROCEDURE PERFORMES SLOWER WHEN EXECUTED IN HMTLDB THE IN SQLPLUS
We executed a stored procedure in HTMLDB. At the beginning and the end of this stored procedure a timestamp inserted in a logtable. First we executed the procedure in HTMLDB's SQL workshop (version 2.0.0.00.49 for MacOSX) under the owners schema . Ex
-
Illustrator - Erase a straight line (Mac not windows).
Illustrator - I am trying to tweak a logo so it has smooth edges, I am familiar with using the SHIFT key from a starting point and end point of a eraser segment within Photoshop, however is there anything easy like this in Illustrator with using a m