Syntax error on a for loop
I am getting an error on the first line of the for statement. It says I need a semicolon but I can't seem to correct it and I know the error might not necessarily be on that line. I'm not sure how this even is going to print at the end of the switch statement but i can't compile it to find out. I can show you in another post what i am trying to achieve if it will help. Thanks.
import javax.swing.*;
import java.text.*;
public class printNum
public static void main (String [] args) {
String startNumStr, endNumStr;
int startNum, endNum;
startNumStr= JOptionPane.showInputDialog(null, "Enter a starting number:");
startNum = Integer.parseInt(startNumStr);
endNumStr = JOptionPane.showInputDialog(null, "Enter an ending number:");
endNum = Integer.parseInt(endNumStr);
for(int startNum < endNum) {
switch(startNum) {
case startNum + 10:
case startNum + 10:
case startNum + 10: System.out.println(" " + startNum); break;
default: System.out.println(" " + startNum);
}
I am getting an error on the first line of the for
statement. It says I need a semicolon but I can't
seem to correct it and I know the error might not
necessarily be on that line. I'm not sure how this
even is going to print at the end of the switch
statement but i can't compile it to find out. I can
show you in another post what i am trying to achieve
if it will help. Thanks.
import javax.swing.*;
import java.text.*;
public class printNum
public static void main (String [] args) {
String startNumStr, endNumStr;
int startNum, endNum;
startNumStr=
tNumStr= JOptionPane.showInputDialog(null, "Enter a
starting number:");
startNum = Integer.parseInt(startNumStr);
endNumStr = JOptionPane.showInputDialog(null,
og(null, "Enter an ending number:");
endNum = Integer.parseInt(endNumStr);
for(int startNum < endNum) {
switch(startNum) {
case startNum + 10:
case startNum + 10:
case startNum + 10:
e startNum + 10: System.out.println(" " + startNum);
break;
default: System.out.println(" " +
ut.println(" " + startNum);
}Why do you have the same case 3 times in the switch? Also, I don't think you can have variable expressions in the switch statement cases. I think these need to be constants.
RD-R
� {�
Similar Messages
-
Getting the syntax error, and having limited technical experience, I do not know how to fix the problem. This is in regard to a web site asset, an mp3 file. I am having problems getting such files to play within Chrome (though they play in Internet Explorer, for instance), so I am trying to troubleshoot from within Dreamweaver, as well as from the Chrome extensions side.
Here is the line including the syntax error, with additional lines
getInterfaces: function(countRef) {
var interfaces = [Ci.nsIDOMGeoPositionCoords, Ci.nsIClassInfo, Ci.nsISupports];
countRef.value = interfaces.length;
return interfaces;
getHelperForLanguage: function(language) null,
contractID: "",
Thanks for help.Use HTML5 <audio>.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5 Audio Demo</title>
<!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>
<body>
<audio controls>
<source src="path/yourSong.ogg" type="audio/ogg">
<source src="path/yourSong.mp3" type="audio/mp3">
<p>Ooooops. Looks like your browser is out of date and doesn't support the audio tag. Please upgrade to a modern browser.</p>
</audio>
</body>
</html>
Nancy O. -
Error CreateImage in for loop array
Hi,
I would like to dynamically create images inside a for loop. It dependent on the array_size that the sevlets will send. Snapshots of code:
for (int i = 0; i < ARRAY_SIZE; i++)
img[i] = Image.createImage("\"/nike" + (i+1) + ".png\"");
}Error:
java.io.IOException
at javax.microedition.lcdui.ImmutableImage.getImageFromStream(+15)
at javax.microedition.lcdui.ImmutableImage.<init>(+20)
at javax.microedition.lcdui.Image.createImage(+8)
at SlidesCanvas.createImages(+138)
at SlidesCanvas.<init>(+146)
at ListSlides.commandAction(+113)
at javax.microedition.lcdui.Display$DisplayAccessor.commandAction(+282)
at javax.microedition.lcdui.Display$DisplayManagerImpl.commandAction(+10)
at com.sun.midp.lcdui.DefaultEventHandler.commandEvent(+68)
at com.sun.midp.lcdui.AutomatedEventHandler.commandEvent(+47)
at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+250)
Is this a known bug in CreateImage? Or am i doing it in a wrong way?Herlena
I tried this, it works.
for (int i = 0; i < ARRAY_SIZE; i++) {
img[i] = img.createImage("nike" + (i+1) + ".png");
Hope your problem is solved, Darryl -
Syntax errors in examples for UTL_LMS
The examples for UTL_LMS in
Oracle® Database PL/SQL Packages and Types Reference
10g Release 2 (10.2)
Part Number B14258-01
http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_lms.htm
contain syntax errors
Correct would be
DECLARE
s varchar2(200);
i pls_integer;
BEGIN
i:= utl_lms.get_message(26052, 'rdbms', 'ora', 'french', s);
dbms_output.put_line('before format, message is: '||s);
dbms_output.put_line('formatted message is: '||utl_lms.format_message(s, 9, 'my_column_name'));
END;
/and
DECLARE
s varchar2(200);
i pls_integer;
BEGIN
i:=utl_lms.get_message(601, 'rdbms', 'oci', 'french', s);
dbms_output.put_line('OCI--00601 is: '||s);
END;
/Hello Martin,
This is a known problem with wlst-jython. One cannot catch syntax errors
programmatically. The only way is to avoid loading properties file
that may cause syntax errors.
I am curious though how can a user enter invalid properties via a script?
thanks,
-satya
Martin Gustavsson wrote:
Hi,
When there are syntax errors in WLST-script, the calling program will get no information about this.
In our case the calling program is ANT. If the user enters invalid properties it could cause syntax errors in the WLST script. But the ANT task always receive a successfull code back and doesn't know that it went wrong.
What is the workaround for this? How can I from WLST return a fail code so that ANT does not continue?
Regards,
Martin -
Having errors in basic for loop
Folks
I am tring to write SQL script that implements a block that contains a for-loop which increments a counter from 1 to 10 and inserts the counter value into the results field of the LOOPING table that i have created. i want to insert a null val in place of the counter if the counter value is equal to either 6 or 8.
Below are my work
Table creation
CREATE TABLE LOOPING (Result VARCHAR2(60));
I am expecting a output like this
Result
1
2
3
4
5
NULL
7
Null
9
10
My SCRIPT
BEGIN
FOR COUNTER IN 1..10
IF ((COUNTER = 6 ) AND (COUNTER = 8 ))
THEN
INSERT INTO MESSAGES
VALUES(NULL);
ELSE
INSERT INTO MESSAGES
VALUES(COUNTER);
END LOOP;
END;
I am getting errors. I am a beginner . Please help me out .
can you point out my errors and explain
And finaly please tell me how to correct it .
Thanks
Guna1) When you get an error, it's always helpful to post the details of that error (the error number and the line number). That makes it far easier for us to help you.
2) Thank you for posting your code and table definition. That definitely helps! In the future, you'll want to use the \ tag (6 characters, all lower case) before and after any code fragments to preserve the white space & indentation. That makes your code far easier to read.
3) Your code fails to compile because
- you are missing the LOOP keyword between lines 2 and 3
- you are missing the END IF at the end of your IF statement
- you are referring to a table named MESSAGES while your CREATE TABLE statement refers to a table named LOOPING
If you correct those three errors, your code will compile
[code]
SQL> ed
Wrote file afiedt.buf
1 BEGIN
2 FOR COUNTER IN 1..10
3 LOOP -- Added
4 IF ((COUNTER = 6 ) AND (COUNTER = 8 ))
5 THEN
6 INSERT INTO looping -- Changed table name
7 VALUES(NULL);
8 ELSE
9 INSERT INTO looping -- Changed table name
10 VALUES(COUNTER);
11 END IF; -- Added
12 END LOOP;
13* END;
SQL> /
PL/SQL procedure successfully completed.
[/code]
4) However, now that the code compiles, you'll have a problem that it does not meet the requirements. It will never insert a NULL value because your IF condition is incorrect. Since this looks like a homework problem, however, I don't want to completely give it away-- I've probably done more than I should have already.
Justin -
I get the following compiler error when using the Java 5 SE enhanced for loop with a generic collection.
Code:
public static void main(String[] args)
List<Integer> l = new ArrayList<Integer>();
l.add(new Integer(1));
printCollection(l);
private static void printCollection(Collection<?> c)
for (Object e : c)
System.out.println(e);
Error on attempting to build:
"Error: Internal compilation error, terminated with a fatal exception"
And the following from ojcInternalError.log:
java.lang.NullPointerException
at oracle.ojc.compiler.EnhancedForStatement.resolveAndCheck(Statement.java:2204)
at oracle.ojc.compiler.StatementList.resolveAndCheck(Statement.java:4476)
at oracle.ojc.compiler.MethodSymbol.resolveMethod(Symbol.java:10822)
at oracle.ojc.compiler.RawClassSymbol.resolveMethodBodies(Symbol.java:6648)
at oracle.ojc.compiler.Parser.resolveMethodBodies(Parser.java:8316)
at oracle.ojc.compiler.Parser.parse(Parser.java:7823)
at oracle.ojc.compiler.Compiler.main_internal(Compiler.java:978)
at oracle.ojc.compiler.Compiler.main(Compiler.java:745)
at oracle.jdeveloper.compiler.Ojc.translate(Ojc.java:1486)
at oracle.jdeveloper.compiler.UnifiedBuildSystem$CompileThread.buildGraph(UnifiedBuildSystem.java:300)
at oracle.jdeveloper.compiler.UnifiedBuildSystem$CompileThread.buildProjectFiles(UnifiedBuildSystem.java:515)
at oracle.jdeveloper.compiler.UnifiedBuildSystem$CompileThread.buildAll(UnifiedBuildSystem.java:715)
at oracle.jdeveloper.compiler.UnifiedBuildSystem$CompileThread.run(UnifiedBuildSystem.java:893)Install the Service Update 1 patch for JDeveloper (using the help->check for updates), and let us know if this didn't solve the problem.
-
Declaration syntax error in 9iLite for Palm.
Hi all..
I have one problem with my application in C/C++ Codewarrior with odbc for Palm.
When i compile the application any declaration of the type: class <any class> give me one declaration syntax error, this happen in odbc.h and aboutform.h of msql project.
The problem is that when i compile msql_r8.mcp no error is generated, but when i treat compile my application with the same include files the error is generated.
What is wrong?
Thanks in advance.
CCRD.Be sure to use double-quotes when doing an include statement. For example:
#include "..\Languages\Borland C\Decl-32.h"
It may help to start by compiling the examples in C:\program files\national instruments\ni-488.2\languages\borland c
It may also help to do a search on the web about compiling and linking in Borland C.
Randy Solomonson
Applications Engineer
National Instruments -
Incompatible types error on a for loop
Hi. I am in the middle of making a program and a decided to make a print statment to check to make sure everything was organized as it should be and I got an incompatible types error for the line where I start my for loop - for (index = 0 ...) etc. Since everything is an int, I'm not sure how they're not compatible with each other.. thoughts? here's my code so far, thanks
import java.io.*; // needed for stream readers
import java.lang.*;
public class testScores extends Object
public static void main(String args[] ) throws Exception
// declare variables for input
String records;
String room_nbr_input;
String test_score_input;
String student_id;
int room_nbr_nbr;
int test_score_nbr;
int index;
String[] record = new String[3];
int[] room_nbr = new int[30];
int[] test_score = new int[30];
int[] kount = new int[30];
// created file reader and buffered reader
FileReader frM;
BufferedReader brM;
// open file
frM = new FileReader("einstein_testscores_2009.txt");
brM = new BufferedReader(frM);
// print headings
startUp();
// get one record from file
records = brM.readLine();
while(records !=null)
//split the record into three fields = the array record[], then assign those values to variables
record = records.split(", ");
student_id = record[0];
room_nbr_input = record[1];
test_score_input = record[2];
//change the data into integers
room_nbr_nbr = Integer.parseInt(room_nbr_input);
test_score_nbr = Integer.parseInt(test_score_input);
//put the variables into arrays
room_nbr[room_nbr_nbr -1] = room_nbr_nbr;
test_score[room_nbr_nbr -1] = test_score[room_nbr_nbr -1] + test_score_nbr;
//get new record
records = brM.readLine();
for (index = 0; index = room_nbr.length; index++)
System.out.print(room_nbr[index] + "\t\t" + test_score[index]);
public static void startUp()
System.out.print("Einstein Elementary Test Scores\n\n");
System.out.print("Room Number\t\tTest Score Average\n\n");
} // end of class declarationthank you. here's the code.
import java.io.*; // needed for stream readers
import java.lang.*;
public class testScores extends Object
public static void main(String args[] ) throws Exception
// declare variables for input
String records;
String room_nbr_input;
String test_score_input;
String student_id;
int room_nbr_nbr;
int test_score_nbr;
int index;
String[] record = new String[3];
int[] room_nbr = new int[30];
int[] test_score = new int[30];
int[] kount = new int[30];
// created file reader and buffered reader
FileReader frM;
BufferedReader brM;
// open file
frM = new FileReader("einstein_testscores_2009.txt");
brM = new BufferedReader(frM);
// print headings
startUp();
// get one record from file
records = brM.readLine();
while(records !=null)
//split the record into three fields = the array record[], then assign those values to variables
record = records.split(", ");
student_id = record[0];
room_nbr_input = record[1];
test_score_input = record[2];
//change the data into integers
room_nbr_nbr = Integer.parseInt(room_nbr_input);
test_score_nbr = Integer.parseInt(test_score_input);
//put the variables into arrays
room_nbr[room_nbr_nbr -1] = room_nbr_nbr;
test_score[room_nbr_nbr -1] = test_score[room_nbr_nbr -1] + test_score_nbr;
//get new record
records = brM.readLine();
for (index = 0; index = room_nbr.length; index++)
System.out.print(room_nbr[index] + "\t\t" + test_score[index]);
public static void startUp()
System.out.print("Einstein Elementary Test Scores\n\n");
System.out.print("Room Number\t\tTest Score Average\n\n");
} // end of class declaration -
Illegal start of type error when adding for loop to applet
I have typed the following applet to print a horizontal row of stars with the length entered by the user (i.e. user enters 4 and applet prints out 4 stars in a row). Here is my code:
import java.awt.Graphics;
import javax.swing.*;
public class Histograms extends JApplet
String input = "";
int number;
public void init()
input = JOptionPane.showInputDialog ( null,
"Enter a number\nbetween 1 and 30:" );
number = Integer.parseInt( input );
public void paint ( Graphics g )
for ( int counter = 1; counter <= number; counter++ )
System.out.print( "*" );
System.out.println();
};Now I am trying to make it do this 5 times, so it seems like just surrounding the init and paint methods in a for loop (i.e. for ( int i=1; i <= 5; i++ ) ) would do the trick but when I do that I get an illegal start of type error when trying to compile. Does anyone know why this error would show up. The most common reply to questions of this sort seems to be to check the closing braces but I have checked very carefully after adding the for loop and don't see any problems with mismatched braces. Could you please help me get on the right track as to how I can make this applet print a horizontal row of stars five times? All help is appreciated.Hello JTMOBOP:
You were correct in figuring that I was trying to get the applet to print five rows of stars of different length according to five different inputs from the user. I tried your suggestions, and the code now does compile and run, but it still does not run properly (i.e. only asks user once for input and displays row of stars but does not show an input dialog again). Here is the code I have retyped:
import java.awt.Graphics;
import javax.swing.*;
public class Histograms extends JApplet
String input = "";
int[] number = new int[5];
public void init()
for ( int i = 0; i < 5; i++ )
input = JOptionPane.showInputDialog ( null,
"Enter a number\nbetween 1 and 30:" );
number[i] = Integer.parseInt( input );
public void paint ( Graphics g )
for ( int i = 0; i < 5; i++ )
for ( int myNumber = 0; myNumber <= number; myNumber++ )
System.out.print( "*" );
System.out.println();
Any ideas what's going on here?
Also, your comments about not being able to loop a method make sense. Thank you for the input so far. -
Compile Error in Enhanced For Loop
I'm learning generic collections and for practice wrote a simple class that uses a HashMap to store data. However, I'm getting a compile error for the code that accesses the HashMap. The error and code for my class follow.
Can anyone help?
Thanks...
=====================
The compile error:
=====================
MapDict.java:37: package Map does not exist for( Map.Entry entry : glossary.entrySet() ) ^1 error=======================
The code for my class:
=======================
import java.util.Scanner;
import java.util.HashMap;
public class MapDict
HashMap<String, String> glossary = new HashMap<String, String>();
public void getEntries()
Scanner sc = new Scanner( System.in ).useDelimiter("\n");
String moreEntries = "y";
String word = "";
String definition = "";
while ( moreEntries.toUpperCase().equals( "Y") )
System.out.print("Enter word: ");
word = sc.next();
System.out.print("Enter definition: ");
definition = sc.next();
glossary.put( word, definition);
System.out.print("Another glossary item? (y/n) ");
moreEntries = sc.next();
public void displayEntries()
System.out.println( glossary.size() );
// Here is where the compile error occurs:
for( Map.Entry entry : glossary.entrySet() )
System.out.println( "\nWord: " + entry.getKey() + " Definition: " + entry.getValue() );
}import java.util.Scanner;
import java.util.HashMap;I don't see java.util.Map or java.util.Map.Entry listed here.... -
Hi Guys ,
I am getting the below error in the following piece of code.I am using 11g.
L_SQL_TXT:='begin'||CHR(32)||
'for i in ( select '||l_col_list_1||', :in_tst_nm, :l_current_schema from '||in_src_table||') LOOP
insert into '||get_test_schema||'.'||in_src_table||' values('||l_col_list_2||',TEST_NM , TEST_CREATED_BY);
end LOOP;
end;';
dbms_output.put_line (l_sql_txt);
EXECUTE IMMEDIATE l_sql_txt USING in_sav_nm,l_current_schema;
dbms_output.put_line (SQL%ROWCOUNT || ' test records added');
I am getting the below error
Error report:
ORA-06550: line 3, column 95:
PL/SQL: ORA-00984: column not allowed here
ORA-06550: line 3, column 7:
PL/SQL: SQL Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
What am i doing wrong? Please suggestRaunaq wrote:
insert into '||get_test_schema||'.'||in_src_table||' values('||l_col_list_2||',TEST_NM , TEST_CREATED_BY);
This insert statement doesn't look good! As you just passed TEST_NM and TEST_CREATED_BY as in a string. Those must have some values associated with!
Like:- If those 2 are variables then it should be like :-
-- For testing purpose with output !!!
--- Added static values for references for the dynamic block
Declare
l_sql_txt varchar2(32767);
get_test_schema varchar2(20) := 'scott';
in_src_table varchar2(20) := 'src_tbl';
l_col_list_1 varchar2(20) := 'col_name_1';
l_col_list_2 varchar2(20) := 'col_name_2';
test_nm varchar2(20) := 'Testing';
test_created_by date :=sysdate ;
begin
l_sql_txt:='begin'||chr(32)||
'for i in ( select '||l_col_list_1||', :in_tst_nm, :l_current_schema from '||in_src_table||')
loop
insert into '||get_test_schema||'.'||in_src_table||' values('||l_col_list_2||','''||test_nm||''','''||test_created_by||''');
end loop;
end;';
dbms_output.put_line ('sql text- '||l_sql_txt);
--execute immediate l_sql_txt using in_sav_nm,l_current_schema;
dbms_output.put_line (sql%rowcount || ' test records added');
end;
My OutPut looks like:-
sql text- begin for i in ( select col_name_1, :in_tst_nm, :l_current_schema
from src_tbl)
loop
insert into scott.src_tbl
values(col_name_2,'Testing','04-JUL-13');
end loop;
end;
test records added
PL/SQL procedure successfully completed. -
How to handle error within a FOR loop
Hi all,
For the code:
begin
for vc1 in (select *
from xx_primavera_invoices_detail
where transfered_to_ar = 0
and cust_trx_type_id not in (1000, 1003, 1016, 1023, 1040)
and act_end_date is not null) loop
insert_into_ar_interface(vc1.amount, vc1.uom_code, vc1.quantity, vc1.unit_standard_price, vc1.cust_trx_type_id
,vc1.description, vc1.interface_line_attribute1, vc1.interface_line_attribute2, vc1.interface_line_attribute3, vc1.service_code
,vc1.gl_date, vc1.orig_system_bill_address_id, vc1.orig_system_bill_customer_id, vc1.segment2, vc1.segment3,vc1.customer_name,vc1.payment_type,vc1.currency_code)
end loop;
update xx_primavera_invoices_detail
set transfered_to_ar = 1
where transfered_to_ar = 0
and cust_trx_type_id not in (1000, 1003, 1016, 1023, 1040)
end;I want to add an exception statement if there is no value returned in VC1. I guess i'll never go into the loop statement because no data found in VC1 but the UPDATE will be executed...
Any ideas?
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
PL/SQL Release 11.1.0.7.0 - Production
"CORE 11.1.0.7.0 Production"
TNS for Linux: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - ProductionThanks in advance,
Bahchevanov.Hi,
declare
v_i_was_in_loop boolean;
begin
v_i_was_in_loop ;= false;
for cur in (select ..)
loop
null;
v_i_was_in_loop := true;
end loop;
if v_i_was_in_loop = true
then
update...
end if;
end; -
ECC syntax error for ADDFIELD.
Dear Friends,
I am getting a syntax error in ECC, for ADDFIELD.
My original code is :
data: XI_SELTAB LIKE RSPARAMS OCCURS 0 WITH HEADER LINE.
ADDFIELD XI_SELTAB 'ARBPL' V_GEWRK.
Changed code is :
*data: XI_SELTAB LIKE RSPARAMS OCCURS 0 WITH HEADER LINE.
TYPES: ty_XI_SELTAB TYPE RSPARAMS.
Data: XI_SELTAB TYPE standard table of ty_XI_SELTAB.
Data: wa_XI_SELTAB type ty_XI_SELTAB.
ADDFIELD WA_XI_SELTAB 'ARBPL' V_GEWRK.
What is the exact syntax at here?? it not taking from work area.
Thanks,
SridharSorry to all,
Yes Its Micro and defined a like this :
Macros
DEFINE addfield.
&1-sign = 'I'.
&1-kind = 'S'.
use operation cp if the value contains wildcards
if &3 ca '*'.
&1-option = 'CP'.
else.
&1-option = 'EQ'.
endif.
append the field name/value to the selection table
if not &3 is initial.
&1-selname = &2.
&1-low = &3.
append &1.
endif.
clear &1. -
Syntax error on INCLUDE STRUCTURE.
Hi Experts,
It is abit hard to explain what I need here.
But I try to explain as much as I can.
I am writing this code in order to update the customer material numbers into internal table tvbdpa. As you can see in my code, getting the customer material numbers require mapping the position number.
I am stuck at the LOOP below with ***.
Also getting the syntax error
_The declaration for the key field "KDMAT" is imcomplete.
However "KDMAT" is is contained in the key of table "TVBDPA" and must be filled._
TABLES: vbco3.
DATA: da_mess LIKE vbfs OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF tvbdpa OCCURS 0, "Internal table for items
kdmat LIKE LIPS-KDMAT.
INCLUDE STRUCTURE vbdpa.
DATA: END OF tvbdpa.
DATA: itab_vbak TYPE SORTED TABLE OF vbak
WITH UNIQUE KEY vbeln,
wa_vbak LIKE LINE OF itab_vbak,
itab_lips TYPE SORTED TABLE OF lips
WITH UNIQUE KEY vbeln,
wa_lips LIKE LINE OF itab_lips,
wa_tvbdpa LIKE LINE OF tvbdpa,
lv_zuonr TYPE vbak-zuonr.
vbco3-mandt = sy-mandt.
vbco3-spras = nast-spras.
vbco3-vbeln = nast-objky.
vbco3-kunde = nast-parnr.
vbco3-parvw = nast-parvw.
CALL FUNCTION 'RV_DOCUMENT_PRINT_VIEW'
EXPORTING
comwa = vbco3
IMPORTING
kopf = vbdka
TABLES
pos = tvbdpa
mess = da_mess
EXCEPTIONS
fehler_bei_datenbeschaffung = 1.
IF NOT tvbdpa[] IS INITIAL.
SELECT SINGLE zuonr FROM vbak
INTO lv_zuonr
WHERE vbeln = vbdka-vbeln.
IF sy-subrc = 0 AND lv_zuonr <> ''.
SELECT vbeln posnr kdmat FROM lips
INTO CORRESPONDING FIELDS OF TABLE itab_lips
WHERE vbeln = lv_zuonr.
***I am stuck at here.
LOOP AT itab_lips INTO wa_lips.
READ TABLE tvbdpa INTO wa_tvbdpa
WITH TABLE KEY posnr = wa_lips-posnr.
wa_tvbdpa-kdmat = wa_lips-kdmat.
MODIFY TABLE tvbdpa FROM wa_tvbdpa
TRANSPORTING kdmat.
ENDLOOP.
***end I am stuck at here.
ENDIF.
ENDIF.
All advise are welcome and greatly appreciated.
Thanks in advance.Hi Subramanian,
Does this more make sense for you?
Can I read the table like :-
READ TABLE itab_lips INTO wa_lips
WITH TABLE KEY VBELN = wa_tvbdpa-matnr." AND POSNR = wa_tvbdpa-posnr.
TABLES: vbco3.
DATA: da_mess LIKE vbfs OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF tvbdpa OCCURS 0, "Internal table for items
kdmat LIKE LIPS-KDMAT.
INCLUDE STRUCTURE vbdpa.
DATA: END OF tvbdpa.
DATA: itab_vbak TYPE SORTED TABLE OF vbak
WITH UNIQUE KEY vbeln,
wa_vbak LIKE LINE OF itab_vbak,
itab_lips TYPE SORTED TABLE OF lips
WITH UNIQUE KEY vbeln,
wa_lips LIKE LINE OF itab_lips,
wa_tvbdpa LIKE LINE OF tvbdpa,
lv_zuonr TYPE vbak-zuonr.
vbco3-mandt = sy-mandt.
vbco3-spras = nast-spras.
vbco3-vbeln = nast-objky.
vbco3-kunde = nast-parnr.
vbco3-parvw = nast-parvw.
CALL FUNCTION 'RV_DOCUMENT_PRINT_VIEW'
EXPORTING
comwa = vbco3
IMPORTING
kopf = vbdka
TABLES
pos = tvbdpa
mess = da_mess
EXCEPTIONS
fehler_bei_datenbeschaffung = 1.
IF NOT tvbdpa[] IS INITIAL.
SELECT SINGLE zuonr FROM vbak
INTO lv_zuonr
WHERE vbeln = vbdka-vbeln.
IF sy-subrc = 0 AND lv_zuonr <> ''.
SELECT vbeln posnr kdmat FROM lips
INTO CORRESPONDING FIELDS OF TABLE itab_lips
WHERE vbeln = lv_zuonr.
LOOP AT tvbdpa INTO wa_tvbdpa.
READ TABLE itab_lips INTO wa_lips
WITH TABLE KEY VBELN = wa_tvbdpa-matnr." AND POSNR = wa_tvbdpa-posnr.
wa_tvbdpa-kdmat = wa_lips-kdmat.
MODIFY TABLE tvbdpa FROM wa_tvbdpa
TRANSPORTING kdmat.
ENDLOOP.
ENDIF.
ENDIF. -
Syntax error in For Loop statement
Hello
Normally my FOR staements have not been a problem as only access one table. I the example below I am accessing three table and therefore I get a Syntax error.
I only wish to select the "Product" recored but need the other table to enable the select the right results.
FOR product_rec IN (SELECT * from PRODUCT, PRODUCT_GROUP,PROD_PROD_GROUP
where PRODUCT_GROUP.PRODUCT_GROUP_KEY = PROD_PROD_GROUP.PRODUCT_GROUP_KEY
and PROD_PROD_GROUP.PRODUCT_KEY = PRODUCT.PRODUCT_KEY
and product.supplier_key = company_no
and PROD_PROD_GROUP.MULTI_WEB_DIS = 1
order by PROD_PROD_GROUP.MULTI_WEB_SEQ)
Can anyone let the correct syntx for this statement.
Thanks
PeteLike Dom said:
FOR product_rec IN (SELECT PRODUCT.* from PRODUCT, PRODUCT_GROUP,PROD_PROD_GROUP
where PRODUCT_GROUP.PRODUCT_GROUP_KEY = PROD_PROD_GROUP.PRODUCT_GROUP_KEY
and PROD_PROD_GROUP.PRODUCT_KEY = PRODUCT.PRODUCT_KEY
and product.supplier_key = company_no
and PROD_PROD_GROUP.MULTI_WEB_DIS = 1
order by PROD_PROD_GROUP.MULTI_WEB_SEQ) Or what he meant by "nice to have", use aliases:
select p.*
from
product p,
product_group pg,
prod_prod_group ppg
where
pg.product_group_key = ppg.product_group_key
and ppg.product_key = p.product_key
and p.supplier_key = company_no
and ppg.multi_web_dis = 1
order by
ppg.multi_web_seqAlso, note that company_no is not aliased in the above query. If this is a column, it should be aliased as well (either with the full table name or the alias if you switch to using them). If it is a PL/SQL variable, it is fine as is.
Edited by: cmartin2 on Feb 2, 2011 1:56 PM
Maybe you are looking for
-
Creating a new FXML File (Eclipse IDE) cannot finish
Following steps on: http://docs.oracle.com/javafx/scenebuilder/1/use_java_ides/sb-with-eclipse.htm#BABBFEBD 5. In the FXML File dialog box, complete the creation of the new FXML document using the following steps:... I get the panel to fill in but no
-
HT4863 emails not showing received in inbox
Emails are not showing in my inbox. I hear the sound or incoming message, and nothing to read.
-
Source as Destination is Not Working
I have several clips in FCP. I select them all and select: Send To - Compressor In Compressor I see that my destination is definitely set as Source (I assume this should be the folder where my original clips exists). Compressor creates the new files,
-
What does these error code signify and how do I get rid of it? #Error -1074001419 occurred at et3500 Utility MODBUS RTU Receive Message.vi->et3500 Utility Write To Register.vi->et3500 Utility Multiple Write To Registers.vi This error code is undefine
-
I have a project that has a 5 question graded quiz at the end with all multiple choice. If a user doesn't pass the quiz, they are forwarded back to the beginning of the quiz for a retake until they pass. In CP4, if the user failed and was forwarded t