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
Similar Messages
-
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 -
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. -
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 -
How can I enable FTP on the DMP and How can I FTP to it and then remove the files that were deployed to the DMP flash? My platform of DMS is 5.2.2
Hi Temur, ok. I do the above procedure and it worked fine
Now, I have other question?
How can I reproduce any file (for example: a video, an url page, an image), that is in the flash of DMP?
Índice de ftp://172.17.15.22/tmp/ftproot/tmp/ftproot/tmp/ftproot/usb_1/
Subir al directorio superior.
Nombre Tamaño Última modificación
Sample Videos.lnk
1 KB
17/06/2011
06:25:00 a.m.
deployment
29/06/2010
04:14:00 a.m.
lost+found
25/02/2010
12:00:00 a.m.
video futbol en la playa.mp4
1390 KB
29/06/2010
01:08:00 a.m.
videofutbol.mp4
1390 KB
29/06/2010
01:38:00 a.m.
I like, that el DMP when loss conectivity with DMM, It display at the LCD screen, the video named videofutbol.mp4, this video As I show in the picture above, already in the flash of DMP.
I appreciate your early response.
Thanks -
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 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 -
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 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. -
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. -
How to randomly select links in e-tester and how to get VU# in e-load
1. How to randomly select one from links in a webpage in e-tester?
For example: there is a root-page. On it, there are about 2000 links to its subpages. They all have the following pattern:
<pre>
multiline<TD width="50%"><NOBR>
<img src="/images/tfold.gif" border="0" alt="GXC_.+?" align="texttop">
{a href="(.+?)"}<font class="titleorimageid1siteid0">GXC_.+?</font>{a} </NOBR>
</TD>
</pre>
So how can randomly select one link and then navigate to it?
2.how to get VU# in e-load?
For example: we launch 4000 VU to load-stress our server. But we want to use different user names to login for different VU#. such as VU#1's username is ADF1, VU#2's username is ADF2, VU#100's username is ADF100 and so on. How can we implement the feature?
Thanks a lot.
Edited by: user783927 on Dec 1, 2008 5:57 AM
Edited by: user783927 on Dec 1, 2008 5:59 AMThanks a lot for VU#. Also i got an idea about how to randomly select a link:
Private Sub RSWVBAPage_afterPlay()
Dim objReg As New RegExp
Dim objMatchCol As MatchCollection
Dim objMatch As Match
Dim objSubMatch As SubMatches
Dim doc As String
Dim str As String
Dim rNumb As Integer
RSWApp.GetHtml doc
With objReg
.Global = True
.IgnoreCase = True
'the kind of urls have the following special pattern
.Pattern = "pageid=34,([\d]{5})"
End With
Set objMatchCol = objReg.execute(doc)
Randomize
rNumb = objMatchCol.Count * Rnd
If objMatchCol.Count >= 1 Then
If rNumb = objMatchCol.Count Then
rNumb = objMatchCol.Count - 1
End If
End If
Set objMatch = objMatchCol.Item(rNumb)
Set objSubMatch = objMatch.SubMatches
str = objSubMatch.Item(0)
Call RSWApp.setCustomVariable("var_url", str)
RSWApp.WriteToLog str
Set objMatchCol = Nothing
Set objMatch = Nothing
End Sub -
I look in to show all history and I can see the history of websites but I want to see the time, date, and how many times been in the websites? How can I can get this information?
I look in to show all history and I can see the history of websites but I want to see the time, date, and how many times been in the websites? How can I can get this information?
-
How to include resource files in the application and how to retrieve ?
Hi,
I want to include resource file in my application jar file and retrieve data from the file ......Is there any way for it? How i create these resources files and how i include them?.........Which classes shall i use for retrieving the data from these files?.........Any kind of help would be appreciated........Iam using NetBeans IDE 6.1,CLDC1.0 and MIDP 2.0........Thanx,in advance..........How i create these resources files and how i include them?How you create the files will depend on what resources you need to include.
[How to ask questions the smart way|http://catb.org/~esr/faqs/smart-questions.html]
db -
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
Maybe you are looking for
-
Yet again I find myself on here complaining about abysmal Broadband speeds in Shetland. Currently I'm getting 0.14Megs down and 0.07Megs up with a ping 789ms. Absolutely appalling level of service. I'm paying good money for what exactly? Router stats
-
Hi everyone, I'm interested in working with After Effects CS6 and Premiere CS6 probably creating quite heavily layered files and experimenting with and combining effects. (I also work with Photoshop and Illustrator.) My workplace allows me to use a 2
-
Issue with printing of multiple text elements in main window
Hi experts, I have developed a sales order form in SAP script. I hv got two text elements in the main window. n i m calling these two text elements by using two write form functions in d print program. The first text element is gettin called n d rele
-
Graduated filter and Adjustment brush always use "last used effect"
In my workfow I mostly use opposite effects in the Graduated filter and Adjustment brush. Lightroom maintains "least used effect" even when changing tools. Is it possible that each tool retains its last used effect? In my workflow I mostly use opposi
-
Hi all, To our customers we sometimes wants to give a discount in the form of an amount instead of a %. We can use the field down at the right after Total before discount but that's not what we want to use, because.. We use the XL reporter to create