How to write SELECT statement using tables ekko,ekpo and eket?
Hi,
I got a problem in performance tuning using below tables?
how to write SELECT statement using tables EKKO,EKPO and EKET and in conditon ( WHERE clause) use only fields
ekko~ebeln IN ebeln
ekko~loekz EQ ' '
ekko~lifnr IN lifnr
ekko~ekorg IN ekorg
ekko~ekgrp IN ekgrp
ekpo~werks IN werks
ekpo~pstyp EQ '3'
ekpo~loekz EQ space
ekpo~elikz EQ space
ekpo~menge NE 0
eket~rsnum NE space.
Thanks in Advance.
bye.
Hi,
ekko~ebeln IN ebeln
ekko~loekz EQ ' '
ekko~lifnr IN lifnr
ekko~ekorg IN ekorg
ekko~ekgrp IN ekgrp
ekpo~werks IN werks
ekpo~pstyp EQ '3'
ekpo~loekz EQ space
ekpo~elikz EQ space
ekpo~menge NE 0 " Remove this from where clause
eket~rsnum NE space. " Remove this from where clause
' instead delete the entries after fetching into the table
DELETE it_itab WHERE menge EQ '0' AND rsnum EQ ' '.
Regards
Bala Krishna
Similar Messages
-
How to write select statement in XSL-FO type XML program
Hi All,
Could you please anyone explain briefly how to write select statement in XSL-FO XML Program.
Requirement:
In the seeded program, OAF page is creating one XML file and through XSL-FO type XML Pulisher loading data and generating PDF output. as per the requirement some of the informations are missing in the XML file and for modifing the OAF page will be taking someting. we are planing to write a select query inside the XSL-FO program to get the required information.
Could you please help me how to write a select statement inside the XSL-FO type programs.
Please give me some example program for this...
Thanks in Advance.
Regards,
SenthilHi ,
Please check the below code and modified plant as select-option
Check the below code :
tables : mara,
mast.
data : begin of i_data occurs 0,
matnr like mara-matnr,
end of i_data.
select-options : s_matnr for mara-matnr,
<b>S_werks for mast-werks.</b>
start-of-selection.
select a~matnr into table i_data
from mara as a inner join mast as b on amatnr = bmatnr
where <b>b~werks in s_werks</b>
and a~matnr in s_matnr
and a~mtart = 'AA'
or a~mtart = 'UT'
and b~stlan = '1'.
loop at i_data.
write:/ i_data-matnr.
endloop.
Hope you got it.
Thanks
Seshu -
How to write Select statement for this codition
I need to check whether SGTXT contains BELNR value.
SGTXT is a text field and It should be matched with BELNR
How to write select statement for this.
Select AUGBL AUGDT into t_BSAD
from BSAD
where SGTXT should have the given BELNR Value.
Plz note : Here I cannot give as SGTXT = BELNR as coz BELNR have only 10 digits.Hi,
data temp(12).
concatenate '%' belnr '%' into temp.
Select AUGBL AUGDT into t_BSAD
from BSAD
where SGTXT like temp.
If belnr is having multiple values,just create a internal table as follows.
types : begin of ty,
belnr....
temp(12),
end of ty.
data itab_ type standard table of ty.
data wa type ty.
loop at itab into wa.
concatenate '%' wa-belnr '%' into wa-temp.
modify itab from wa index sy-tabix transporting temp.
endloop.
Change your select statement accordingly.
Kindly reward poits if it helps. -
Hi,
I want to link tables EKKO, EKPO and KONP. Actually i checked this tables but i could not find link between EKKO and KNOP. Please help me in this regards. Actually we are maintaining the tax codes in the PO. I want to print different taxes in PO out put like BED, EDUCATION CESS, CST, VAT.
NKHello,
You can link the tables by
EKKO- KNUMV = KONP-KNUMH.
And
EKKO-EBELN = EKPO-EBELN.
Hope it helps.
Regards,
Mansi. -
How to write select statement directly in java file instead of using vo
Hi,
I have written the following code in my java file:
if(empvo==null)
empvo=worklistamimpl2.createViewObject("InvoiceVO", "xxetfc.oracle.apps.icx.icatalog.shopping.server.InvoiceVO");
if(empvo!=null){
OAViewObject oaviewobject2 = (OAViewObject)worklistamimpl2.findViewObject("InvoiceVO");
OAViewObjectImpl oaviewobjectimpl = (OAViewObjectImpl)oapagecontext.getApplicationModule(oawebbean).findViewObject("InvoiceVO");
oaviewobject2.setWhereClause("Invoice_num="+" ' " + s + " ' ");
oaviewobjectimpl.executeQuery();
String abc = (String)oaviewobjectimpl.first().getAttribute("Invoice_id");
It is giving me error as
oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM (select invoice_id from ap_invoices_all) QRSLT WHERE (Invoice_num='ERS15022012_3')
1. Why is this error coming.. how to solve this
2. Instead of using vo how can i write select statement directly in the above code
Thanks,
Edited by: user10873676 on Apr 9, 2012 1:18 AM
Edited by: user10873676 on Apr 9, 2012 1:21 AMit says java.sql.SQLSyntaxErrorException: ORA-00904: "INVOICE_NUM": invalid identifier
where as invoice_num column is present in my table -
Extractor for Purchasing Conditions for tables EKKO, EKPO and KONV
Hi Experts,
I want to know if there is an Extractor for Purchasing Conditions with fields in tables of Origin: EKKO, EKPO and KONV.
Or, at least an extractor with the table KONV.
Or, how I can look for it.
Any feedback, will be really apreciated.
Thanks in advanceHi David,
Adding to what said above.
Observe the Fileds in the Datasources and the details.
http://help.sap.com/saphelp_nw2004s/helpdata/en/5c/8ea0e626e442efb109232830faded9/frameset.htm
Regards,
Ram. -
How to write select statement before the loop and how to use read statemnt
Hi,
Recently our system has changed from 4.6 to ECC6.
As its migrated its showing lots of errors like in between loop and endloop there should be no select statemnt........
Can any one please tell how to write that coding in ECC6 , how can i change the code......
In between loop and endloop i am having lots of select statemnts.....ple tell thye coding how can i select before the loop starts and
how to read that internal table in loop.Hi Deepthi,
You can do as per below:
1) Select the required entries from the tables you need (VBAK, VBAP, KNA1, etc)
SELECT VBELN ERDAT KUNNR
into table it_vbak
from VBAK
where VBELN = S_VBELN. "Selection criteria
If sy-subrc = 0.
SELECT VBELN POSNR MATNR
into table it_vbap
from VBAP
for all entries in it_vbak
where VBELN = it_vbak-vbeln
SELECT KUNNR NAME1
into table it_vbak
from VBAK
where VBELN = it_vbak-vbeln.
endif.
2) Loop at the entries, and read internal table it-kna1 for customer info.
Loop at it_vbak into wa_vbak.
read table it_kna1 into wa_kna1 with key kunnr = wa_vbak-kunnr.
if sy-subrc = 0.
endif.
loop at it_vbap into wa_vbap where vbeln = wa_vbak-vbeln.
endloop.
endloop.
This is the basic idea and short example of how to extract entries and read internal table.
Hope this helps.
Regards,
Patrick -
How to write select statement between two tables
hi,
i need to do comparision between two table for each records.ex:
table1:
regid regno ind
1 1001
1 1002
1 1003
1 1004
and table2:
regid regno
1 1002
1 1005
i need to select first row from table and loop for values in second table, if the values found first record , the record must update 'yes' to ind, if not 'No'.
please help with this.
thanks in advance
rajaHi Raja,
Do it like this. loop the first table and read the second table.
Use where condition to satisfy the conditions.
Or
In your select query use joins. Like this.
SELECT mara~matnr
marc~werks
INTO TABLE t_material
FROM mara AS mara INNER JOIN marc AS marc
ON maramatnr = marcmatnr
WHERE mara~mtart = p_mtart.
Instead of MARA and MARC here use your tables.
Much Regards,
Amuktha. -
How to write select statement into SCRIPT editor
hello,
i build a sap script for purchase order printing for exporting.
now after all po order print fine then our client want some more should be print into layout regarding po header.
At the soul my q is can i write select query into script editor itself.
thanks and regards
amit.You cannot write your select statement inside your SAPscript, to overcome this SAP has provided us an option of calling sub-routines.. go through the below example
Go through this example
Ex. SAPSCRIPT
/: PERFORM <Subroutine name> IN PROGRAM <subroutine prog name>
/:USING &<field name>&
/:CHANGING &<field name1& "It will be returned back from sub-routine
/:ENDPERFORM
Then create subroutine pool program(of your own name) and you have to write the code.
FORM ><subroutine name> tables int_cond structure itcsy
outt_cond structure itcsy.
data : value(20), value1(20). "do your own declarations
Read int_cond table index 1.
value = int_cond-value.
value1 = value1 + value.
*****Write your select statement
Read outt_cond table index 1.
outt_cond-value = value1.
Modify outt_cond index 1.
ENDFORM.
Just rough idea given above.
Regards,
SaiRam -
How to write select statement ?
Hi,
i have requirement like below :
In selection screen we have material number as selection options and plant as single entry.
Based on the input.
We have to extract the material number and plant based on MTART = AA or UT in MARA table and STLAN = 1 in MAST table.
how to write a select statment to pick values from selection option and extract those material and plant which fullfill above conditions.
Please let me know..
its urgent
please help..
i have written code like below..
types: begin of x_it_mat,
matnr type mkal-matnr,
werks type mkal-werks,
stlan type mast-stlan,
end of x_it_mat.
types: begin of x_it_mat1,
matnr type mkal-matnr,
werks type mkal-werks,
mtart type mara-mtart,
end of x_it_mat1.
data : it_mat type table of x_it_mat,
wa_mat like line of it_mat.
data : it_mat1 type table of x_it_mat1,
wa_mat1 like line of it_mat1.
TABLES: MKAL , MAST , MARA.
SELECTION-SCREEN BEGIN OF BLOCK matnr
WITH FRAME TITLE TEXT-001.
select-options :
so_matnr for mkal-matnr.
SELECTION-SCREEN END OF BLOCK matnr.
SELECTION-SCREEN BEGIN OF BLOCK plant
WITH FRAME TITLE TEXT-002.
parameter p_werks type mkal-werks.
SELECTION-SCREEN END OF BLOCK plant.
select matnr
werks
stlan
from mkal INTO table it_mat
where matnr in so_matnr
and werks = p_werks.
after this how to write another select statement to extract material by satisfiying above 2 conditions..Hi ,
Please check the below code and modified plant as select-option
Check the below code :
tables : mara,
mast.
data : begin of i_data occurs 0,
matnr like mara-matnr,
end of i_data.
select-options : s_matnr for mara-matnr,
<b>S_werks for mast-werks.</b>
start-of-selection.
select a~matnr into table i_data
from mara as a inner join mast as b on amatnr = bmatnr
where <b>b~werks in s_werks</b>
and a~matnr in s_matnr
and a~mtart = 'AA'
or a~mtart = 'UT'
and b~stlan = '1'.
loop at i_data.
write:/ i_data-matnr.
endloop.
Hope you got it.
Thanks
Seshu -
How can write select statement inside case operator
Hi all,
I like to write a query which get result from other table in case operator.
e.g
select a,b,c from dual
where a=1
and b=case when b is null then "select any value from other table" else null end;
Please help me to write this query.
Thankssorry, but thats funny.
You ask for case with subquery and choosed a solution with decode as correct.
Furthermore, the solution proposed might not be so useful.
First of all many people prefer case over decode, because of understandability and readability of the code (toad has this as a coding rule built in too)
Secondly in this case the decode does nothing. Take a closer look:
select a,b,c from tableA a
where a.a = 1
and a.b =(select decode(a.b,null,( select 1 from tableB b where rownum = 1 ),a.b) from dual)the decode chooses the subselect if a.b is null. But if a.b is null the a.b on the left side is null also, so the predicate will never be true.
aside from this, you can write this shorter as
a.b=nvl(a.b,(select 1 from tableB b where rownum = 1))so what will work in such a case might be
ANEXPRESSION(Literal, scalar subquery, ...) =nvl(a.b,(select 1 from tableB b where rownum = 1))otherwise look for a solution with case ;-)
regards
Edited by: chris227 on 12.05.2012 02:12 -
Hi, how to write select statement to get first 10 maximum salaries
hi,
i need to select first 10 maximum salaries from the emp table which is having say 100 recordsSELECT *
FROM (SELECT * FROM my_table ORDER BY salary
ry DESC)
WHERE ROWNUM < 10;your query will return 9 rows:
SQL> select * from (select * from emp order by sal desc)
2 where rownum < 10;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7839 KING PRESIDENT 17-NOV-81 5000 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7566 JONES MANAGER 7839 02-APR-81 2975 20
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7934 MILLER CLERK 7782 23-JAN-82 1300 10
9 rows selected.
Now if 2 employee has same salary, both should come in the 10 maximum salary list.
try this:
[pre]
SQL> select empno, salary
2 from (select empno, sal salary , rank() over (order by sal desc) rank from emp)
3 where rank <= 10 ;
EMPNO SALARY
7839 5000
7788 3000
7902 3000
7566 2975
7698 2850
7782 2450
7499 1600
7844 1500
7934 1300
7521 1250
7654 1250
11 rows selected.look at the above query, I queried for first 10, but it returned 11 rows because empno 7521 and 7654 both should rank 10. -
Need to Improve pefromance for select statement using MSEG table
Hi all,
We are using a select statement using MSEG table
which takes a very long time to run the program which is scheduled in back ground.
Please see the history below.;
1) Previously this program was using SELECT-ENDSELECT statement inside the loop i.e.
LOOP AT I_MCHB.
To get Material Doc. Details
SELECT MBLNR
MJAHR
ZEILE INTO (MSEG-MBLNR,MSEG-MJAHR,MSEG-ZEILE)
UP TO 1 ROWS
FROM MSEG
WHERE CHARG EQ I_MCHB-CHARG
AND MATNR EQ I_MCHB-MATNR
AND WERKS EQ I_MCHB-WERKS
AND LGORT EQ I_MCHB-LGORT.
ENDSELECT.
Endloop.
The program was taking 1 hr for 20 k data
2)The above statement was replaced by ALL ENTRIES to remove the SELECT-ENDSELECT from the loop.
***GET MATERIAL DOC NUMBER AND FINANCIAL YEAR DETAILS FROM MSEG TABLE
SELECT MBLNR
MJAHR
ZEILE
MATNR
CHARG
WERKS
LGORT
INTO TABLE I_MSEG
FROM MSEG
FOR ALL ENTRIES IN I_MCHB
WHERE CHARG EQ I_MCHB-CHARG
AND MATNR EQ I_MCHB-MATNR
AND WERKS EQ I_MCHB-WERKS
AND LGORT EQ I_MCHB-LGORT.
3)After getting the further technical analysis from BASIS team , And with the suggestion to optimize the program by changing the INDEX RANGE SCAN to
MSEG~M.
SELECT MBLNR
MJAHR
ZEILE
MATNR
CHARG
WERKS
LGORT
INTO TABLE I_MSEG
FROM MSEG
FOR ALL ENTRIES IN I_MCHB
WHERE MATNR EQ I_MCHB-MATNR
AND WERKS EQ I_MCHB-WERKS
AND LGORT EQ I_MCHB-LGORT.
At present the program is taking 3 to 4 hrs in back ground .
The table is complete table scan using index
MSEG~M.
Please suggest to improve the performance of this
many many thanks
deepakThe benchmark should be the join, and I can not see how any of your solutions can be faster than the join
SELECT .....
INTO TABLE ....
UP TO 1 ROWS
FROM mchb as a
INNER JOIN mseg as b
ON amatnr EQ bmatnr
AND awerks EQ bwerks
AND algort EQ blgort
And acharg EQ bcharg
WHERE a~ ....
The WHERE condition must come from the select on MCHB, the field list from the total results
you want.
If you want to compare, must compare your solutions plus the select to fill I_MCHB.
Siegfried
Edited by: Siegfried Boes on Dec 20, 2007 2:28 PM -
Performance tunning for select statements using likp lips and vbrp
Dear all,
I have a report where i am using select statements using first on likp the for all entries of likp i am taking data from lips and then for all entries in lips i am taking data from vbrp by matching VGBEL and VGPOS. Now the problem is that when it fetches data from vbrp it is taking lot of time around 13mins. to fetch data from vbrp. How can i overcome the problem.
regards
AmitHi,
there is also no secondary index for preceding document in VBFA table.
You will also have to create it here.
Regards,
Przemysław -
How to link tables EKKO, EKPO, EIKP and EIPO
What I'm trying to do is create a view based on these four tables. EKPO contains multiple rows with the same values for EBELN. EKKO contains all distinct values for EBELN. I am trying to pick up all rows from both tables where EBELN in EKPO is the same as in EKKO. This is simple enough for a select statement to handle, without creating a view. The tricky part is linking the relevant rows selected from EKKO and EKPO to EIKP and EIPO. I tried using EXNUM to link EKKO, EIKP and EIPO, but I'm not sure that EXNUM contains distinct values for all 3 tables. In the case of EIKP it doesn't matter because the values for the fields I want (VORNU and VORNA) will be the same for the rows selected from EKKO and EKPO. The problem is with linking EIPO to my selections. If I knew that EXNUM was distinct for all rows in EIPO there would be no problem. However, I have seen some cases where multiple rows in EIPO have the same values for EXNUM. If I am using EXNUM in EIPO as a key field I have no way of being sure that the fields I want to pick up from EIPO (NACNU, BEHOE, NACD2, PRUEL and NACN3) contain the correct values I require. An example of what I am trying to do might make this clearer:
Table EKKO:
EBELN BEDAT WAERS
420000001 10.08.2007 USD
Table EKPO:
EBELN WERKS MATNR MENGE NETWR NETPR TXZ01
420000001 3500 m1 q1 nw1 cnf1 mat1
420000001 3500 m2 q2 nw2 cnf2 mat2
420000001 3000 m3 q3 nw3 cnf3 mat3
Table EIKP:
VORNU VORDA
125/45 12.08.2007
Table EIPO: (Corresponding to the above three rows in EKPO)
NACNU BEHOE NACD2 PRUEL NACN3
1234 1001 30.08.2007 28.08.2007 xx
1235 1002 27.08.2007 29.08.2007 yy
1236 1003 18.08.2007 16.08.2007 zz
So basically, given the above table entries, I want that the result of my selection should be:
| ROW1 | ROW2 | ROW3
EBELN: | 420000001 | 420000001 | 420000001
BEDAT: | 10.08.2007 | 10.08.2007 | 10.08.2007
WAERS: | USD | USD | USD
WERKS: | 3500 | 3500 | 3000
MATNR: | m1 | m2 | m3
MENGE: | q1 | q2 | q3
NETWR: | nw1 | nw2 | nw3
NETPR: | cnf1 | cnf2 | cnf3
TXZ01: | mat1 | mat2 | mat3
VORNU: | 125/45 | 125/45 | 125/45
VORDA: | 12.08.2007 | 12.08.2007 | 12.08.2007
NACNU: | 1234 | 1235 | 1236
BEHOE: | 1001 | 1002 | 1003
NACD2: | 30.08.2007 | 27.08.2007 | 18.08.2007
PRUEL: | 28.08.2007 | 29.08.2007 | 16.08.2007
NACN3: | xx | yy | zz
Sorry for the extremely long post. If anyone can shed some light on this I'd really appreciate it. Thanks.
Kalselect req. fields + a~exnum
from ekko as a
inner join ekpo as b
on aebeln = bebeln
into table gt_ekko_ekpo
where.........if u any conditions...
select req.fields from
eikp
into table gt_eikp
for all entries in gt_ekko_ekpo
where exnum = gt_ekko_ekpo-exnum.
select req.fields
from eipo
into table gt_eipo
for all entries in gt_eikp
where exnum = gt_eikp-exnum.
and also ekpo and eipo are line items tables , so for each exnum, will have multiple lines items in eipo table.
imp. the above and check whether, getting the req. result or not.
next in view , maintain rel. among these 4 tables.
ekko -ekpo, ekko-eikp, eikp-eiko.
Maybe you are looking for
-
Zen Vision:M ID3 tags being transered to compu
I always update my artist/titles/albums on the Zen Vision Media Explorer. When i transfer files back to my computer they don't keep there tags that i put in. Is there any way to transfer files to my computer while keeping the players tags?
-
Problem with file meta data in Toast
From a reply to my previous question, I learned that meta data in the file information window cannot be edited. Actually, I really want to get rid of this meta data (not just hide it), because in some cases it disturbs certain operations. Assume the
-
My uncle has a 20" c2d imac with the x1600 video. I have connected a 17" lcd to the other video port and it comes up fine in OS X but, not in bootcamp. It looks like Windows is sending a signal the monitor doesn't like but, I have changed resolution
-
Audio has ecko from sound system how do I lesson to make sound more clear
Hi, Video at an event where person was using a sound system. The venue was an indoor riding ring. There is ecko from the sound system. How do I lessen this using the audio effects? tks sarah
-
How to start weblogic with jdk1.4.0
anybody can tell how to start weblogic with jdk1.4.0 correctly?