Syntax error using try statement in WLST
Hi All,
I have a WLST script to create some JMS resources.
I want to implement exception handling in such a way that if the script fails at any point, all the changes done should be reverted back.
However, whenever I am trying to put a try block, the script is throwing syntax error on the first line after the try statement.
Please find below the script I am using. Please suggest
import sys
from java.lang import System
*# Putting a try statement here results in a syntax error at the below line*
print "Starting the script ..."
connect('weblogic',password,'t3://osbdev:7001')
edit()
startEdit()
servermb=getMBean("Servers/osb_server")
if servermb is None:
print 'Value is Null'
else:
+# Creating the JMS Server+
jmsserver1mb = create('WLSTJMSServer','JMSServer')
jmsserver1mb.addTarget(servermb)
+# Creating the JMS Module+
jmsMySystemResource = create("WLSTJmsSystemResource","JMSSystemResource")
jmsMySystemResource.addTarget(servermb)
subDep1mb = jmsMySystemResource .createSubDeployment('WLSTJMSSubDeployment')
subDep1mb.addTarget(jmsserver1mb)
theJMSResource = jmsMySystemResource.getJMSResource()
connfact1 = theJMSResource.createConnectionFactory('WLSTConnFact1')
connfact1.setJNDIName('jms.WLSTConnFact1')
connfact1.setSubDeploymentName('WLSTJMSSubDeployment')
print "Creating WLSTQueue1..."
jmsqueue1 = theJMSResource.createQueue('WLSTJMSQueue1')
jmsqueue1.setJNDIName('jms.WLSTJMSQueue1')
jmsqueue1.setSubDeploymentName('WLSTJMSSubDeployment')
print "Creating WLSTQueue2..."
jmsqueue2 = theJMSResource.createQueue('WLSTJMSQueue2')
jmsqueue2.setJNDIName('jms.WLSTJMSQueue2')
jmsqueue2.setSubDeploymentName('WLSTJMSSubDeployment')
*# try statement is working at only this point of the program*
try:
save()
activate(block="true")
print "script returns SUCCESS"
except:
save()
cancelEdit(defaultAnswer="y")
print "Error while trying to connect to server !!!"
print "Unexpected error: ", sys.exc_info()[0]
dumpStack()
raise
Edited by: Chintan Parekh on Mar 16, 2011 7:06 AM
Hi Chintan,
Try doing copy pasting the below code, you have to hit the tab or space after try or except to create its block and keep an eye on the alinement's of it.
try:
save()
activate(block="true")
print "script returns SUCCESS"
except:
save()
cancelEdit(defaultAnswer="y")
print "Error while trying to connect to server !!!"
print "Unexpected error: ", sys.exc_info()[0]
dumpStack()Also I made the alinement's properly and the script is running properly with out any error.
print "Starting the script ..."
connect('weblogic','weblogic','t3://localhost:7001')
edit()
startEdit()
servermb=getMBean("Servers/AdminServer")
if servermb is None:
print 'Value is Null'
else:
# Creating the JMS Server
jmsserver1mb = create('WLSTJMSServer','JMSServer')
jmsserver1mb.addTarget(servermb)
# Creating the JMS Module
jmsMySystemResource = create("WLSTJmsSystemResource","JMSSystemResource")
jmsMySystemResource.addTarget(servermb)
subDep1mb = jmsMySystemResource .createSubDeployment('WLSTJMSSubDeployment')
subDep1mb.addTarget(jmsserver1mb)
theJMSResource = jmsMySystemResource.getJMSResource()
connfact1 = theJMSResource.createConnectionFactory('WLSTConnFact1')
connfact1.setJNDIName('jms.WLSTConnFact1')
connfact1.setSubDeploymentName('WLSTJMSSubDeployment')
print "Creating WLSTQueue1..."
jmsqueue1 = theJMSResource.createQueue('WLSTJMSQueue1')
jmsqueue1.setJNDIName('jms.WLSTJMSQueue1')
jmsqueue1.setSubDeploymentName('WLSTJMSSubDeployment')
print "Creating WLSTQueue2..."
jmsqueue2 = theJMSResource.createQueue('WLSTJMSQueue2')
jmsqueue2.setJNDIName('jms.WLSTJMSQueue2')
jmsqueue2.setSubDeploymentName('WLSTJMSSubDeployment')
# try statement is working at only this point of the program
try:
save()
activate(block="true")
print "script returns SUCCESS"
except:
save()
cancelEdit(defaultAnswer="y")
print "Error while trying to connect to server !!!"
print "Unexpected error: ", sys.exc_info()[0]
dumpStack()Below is the output
java weblogic.WLST test.py
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Starting the script ...
Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'Domain_7001'.
Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.
Location changed to edit tree. This is a writable tree with
DomainMBean as the root. To make changes you will need to start
an edit session via startEdit().
For more help, use help(edit)
You already have an edit session in progress and hence WLST will
continue with your edit session.
Starting an edit session ...
Started edit session, please be sure to save and activate your
changes once you are done.
MBean type JMSServer with name WLSTJMSServer has been created successfully.
MBean type JMSSystemResource with name WLSTJmsSystemResource has been created successfully.
Creating WLSTQueue1...
Creating WLSTQueue2...
Saving all your changes ...
Saved all your changes successfully.
Activating all your changes, this may take a while ...
The edit lock associated with this edit session is released
once the activation is completed.
Activation completed
script returns SUCCESSRegards,
Ravish Mody
http://middlewaremagic.com/weblogic
Come, Join Us and Experience The Magic…
Edited by: Ravish Mody-MiddewareMagic on Mar 16, 2011 8:33 PM
Similar Messages
-
Hi,
I am getting following error message ,
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
When run this code.
<%@ page import= "java.sql.*"%>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb");
Statement st = con.createStatement();
st.executeUpdate("update tscipshift set 11-Aug-08='M' where TechN='Elamparuthi'");
%>
tscipshift=table ,column=11-Aug-08 are all exist.
I dont know why I am getting error mesage.
Any idea why?Shahbaz2008 wrote:
you haven't set your user name and password hereI don't believe that's necessary with Access. Then again, it's not an enterprise database.
Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb");
change it to this
Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb","+username+","+password+");
here pass your username and password...
In Oracle default user name and password is
username = scott
password = tigerSo who uses that? Only an eejit would leave that account open.
So the statement would be
Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb","scott","tiger");
or In Mirosoft Access there is no user name and password so the statement will be Like I said - unnecessary, and not the reason the OP is having problems.
Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb","","");>
Besides this change your table name 11-Aug-08 to anything that is not start with number or any special symbols.
for example aug112008 is good or aug is too good.No, it's still not good if you understand ANYTHING about relational databases and normalization.
I think it would work.I think you're just as stup!d as the OP.
% -
JDBC: Syntax error in UPDATE statement???
Hi,
I have been trying to solve this seemingly simple problem for the past 4 hours, and I had no success. I am working on a jdbc:odbc connection which utilizes MS Access. I have been constantly getting "Syntax error in UPDATE statement", and this is the statement
(name of the table is CDs, columns are number, artist, album, label and date - all strings):
query = "UPDATE CDs SET artist = '" + fields.artist.getText() +"', album = '" +
fields.album.getText() + "', label = '" +
fields.label.getText() + "', date = '" +
fields.date.getText() + "' WHERE number = '" + fields.number.getText() + "'";
Can anybody recognize an error? Thank you,
mirkokrugA couple of possibilities.
If the column NUMBER is numeric then it wouldn't need quotes around the data value. Also if the column DATE is a date or date/time type then the format from the textbox may not be correct.
Col -
Syntax error in INSERT STATEMENT
A problem on the date part of the query but why I don´t
know, Thanks for any pointers,
TIA
<cfquery name="update1" datasource="trevor_SecurityDB">
INSERT INTO imagesproducts
(title, info, date)
VALUES ( '#form.title#', '#form.info#', '#DateFormat(Now())#'
</cfquery>
Error Occurred While Processing Request
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC
Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in
INSERT INTO statement.
The error occurred in uploadmember.cfm: line 28
26 : INSERT INTO imagesproducts
27 : (title, info, date)
28 : VALUES ( '#form.title#', '#form.info#',
'#DateFormat(Now())#' )
29 : </cfquery>
30 :
SQL INSERT INTO imagesproducts (title, info, date) VALUES (
'News test', 'Testing news info', '12-Jul-07' )
DATASOURCE trevor_SecurityDB
VENDORERRORCODE -3502
SQLSTATE 42000Perhaps it is a reserved word issue with the date column,
since
date is an ODBC Reserved Keyword. You might try enclosing it
within brackets [ ].
<cfquery name="update1" datasource="trevor_SecurityDB">
INSERT INTO imagesproducts
(title, info, [date])
VALUES ( '#form.title#', '#form.info#', '#DateFormat(Now())#'
</cfquery>
Or, if that doesn't help, you might try using a cfqueryparam
tag for the '#DateFormat(Now())#' value using a cfsqltype =
"CF_SQL_TIMESTAMP" (assuming a date/time datatype on the column).
Also, you might look into using one of the CreateODBCDateTime() or
CreateODBCDate() functions.
Phil -
Syntax Error in Update Statement
Would a smart and kind CF pro mind putting a fresh pair of
eyes on this code and tell me where the syntax error is? All the
fields in the statement are numeric except the last one (comments).
I have enclosed them in val() to ensure they are numeric when
inserted into the DB. The fields they're being inserted into are
numeric. I need to be numeric because I will be doing calculations
on them. Also, I have triple-checked to ensure the datasource,
table, and field names all match.
Thanks,
GwenHTry using <cfqueryparam>
<cfquery datasource="reviews">
UPDATE evals
SET focus = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.focus#">
, strengths = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.strengths#">
, tailored = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.tailored#">
, badinfo = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.badinfo#">
, format = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.format#">
, visual = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.visual#">
, grammar = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.grammar#">
, pronouns = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.pronouns#">
, written = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.written#">
, achieve = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.achieve#">
, sell = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.sell#">
, negative = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.negative#">
, top = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.top#">
, general = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.general#">
, intro = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.intro#">
, orientation = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.orientation#">
, paragraphs = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.paragraphs#">
, two = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.two#">
, length = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.length#">
, none = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.none#">
, comments = <cfqueryparam cfsqltype="cf_sql_clob"
value="#form.comments#">
WHERE resumeID = <cfqueryparam cfsqltype="cf_sql_numeric"
value="#form.resumeID#">
</cfquery>
Ken Ford
Adobe Community Expert Dreamweaver/ColdFusion
Adobe Certified Expert - Dreamweaver CS3
Adobe Certified Expert - ColdFusion 8
Fordwebs, LLC
http://www.fordwebs.com
"GwenH" <[email protected]> wrote in message
news:[email protected]...
> Would a smart and kind CF pro mind putting a fresh pair
of eyes on this
> code
> and tell me where the syntax error is? All the fields in
the statement are
> numeric except the last one (comments). I have enclosed
them in val() to
> ensure
> they are numeric when inserted into the DB. The fields
they're being
> inserted
> into are numeric. I need to be numeric because I will be
doing
> calculations on
> them. Also, I have triple-checked to ensure the
datasource, table, and
> field
> names all match.
>
> Thanks,
> GwenH
>
> <cfquery datasource="reviews">
> UPDATE evals
> SET
> focus = val(#form.focus#)
> , strengths = val(#form.strengths#)
> , tailored = val(#form.tailored#)
> , badinfo = val(#form.badinfo#)
> , format = val(#form.format#)
> , visual = val(#form.visual#)
> , grammar = val(#form.grammar#)
> , pronouns = val(#form.pronouns#)
> , written = val(#form.written#)
> , achieve = val(#form.achieve#)
> , sell = val(#form.sell#)
> , negative = val(#form.negative#)
> , top = val(#form.top#)
> , general = val(#form.general#)
> , intro = val(#form.intro#)
> , orientation = val(#form.orientation#)
> , paragraphs = val(#form.paragraphs#)
> , two = val(#form.two#)
> , length = val(#form.length#)
> , none = val(#form.none#)
> , comments = '#form.comments#'
> WHERE resumeID = #form.resumeID#
> </cfquery>
> -
Help! Syntax Error in SQL statement
Hello. I'm getting an error message and I'm just not seeing
where I went wrong. The SQL statement is:
updateSQL = "UPDATE TrainingHistory SET Status='" &
fFormat(Request.Form(cStatus)) & "', StatusComments='" &
fFormat(Request.Form(cStatusComments)) & " WHERE Training_ID="
& fFormat(Request.Form(cTrainingID))
The error message is:
[Microsoft][ODBC Microsoft Access Driver] Syntax error in
string in query expression '' WHERE Training_ID=9054'.
I've been looking at it for a while. Not sure where I went
wrong. Here is a more complete version of the code:
<%
Function fFormat(vText)
fFormat = Replace(vText, "'", "''")
End Function
Sub sRunSQL(vSQL)
set cExecute = Server.CreateObject("ADODB.Command")
With cExecute
.ActiveConnection = MM_coldsuncrea_lms_STRING
.CommandText = vSQL
.CommandType = 1
.CommandTimeout = 0
.Prepared = true
.Execute()
End With
End Sub
If Request.Form("action")="update" Then
'Set variables for update
Dim updateSQL, i
Dim cTrainingID, cStatus, cStatusComments
'Loop through records on screen and update
For i = 1 To fFormat(Request.Form("counter"))
'Create the proper field names to reference on the form
cTrainingID = "Training_ID" & CStr(i)
cStatus = "Status" & CStr(i)
cStatusComments = "StatusComments" & CStr(i)
'Create the update sql statement
updateSQL = "UPDATE TrainingHistory SET Status='" &
fFormat(Request.Form(cStatus)) & "', StatusComments='" &
fFormat(Request.Form(cStatusComments)) & " WHERE Training_ID="
& fFormat(Request.Form(cTrainingID))
'Run the sql statement
Call sRunSQL(updateSQL)
Next
'Refresh page
Response.Redirect("ClassUpdateRoster.asp?Training_ID=") &
(rsClassDetails.Fields.Item("event_ID").Value)
End If
%>You need another single quote after the double quote before
the WHERE clause. You are not closing the single quote you used to
delimit the value for StatusComments. -
Syntax errors using sql and java
Could somebody inform of the correct syntax for using UPDATE and INSERT SQL commands in a java program? Any information I can find demonstrates this with:
INSERT INTO table_name(column_name, ..., column_name)
VALUES(value, ..., value)
However - this isn't working? any suggestions - and I know its very basic, but I'm just learning.
String query = " INSERT INTO SESSIONS (" +
"id,module_name, module_number, level, session " +
"term, class_list, location, lecturer" + ")
VALUES('"+
fields.id.getText() + "', '"+
fields.module_name.getText() + "', '" + fields.module_number.getText() + "', '" +
fields.level.getText() + "', '" fields.session.getText() "', '" +
fields.term.getText() + "', '" fields.class_list.getText() "', '" +
fields.location.getText() + "', '" fields.lecturer.getText() "')";
output.append( " \nSending query: " + connection.nativeSQL(query)+ "\n");
output.append( "query sent");
thanks
int result = statement.executeUpdate(query);With all those quotes and apostrophes and string concatenations, I'd be surprised if you got it right by the fourth try. (By the way, you appear to have missed a comma between "session" and "term".) Are you planning to insert more than one record in your program? If so, you should consider using a PreparedStatement. This will likely run faster, and your program will definitely be easier to read. Also, you won't have to come back here later to ask how you deal with data that includes apostrophes (the notorious "O'Brien" problem). Here's how you do that... you define the PreparedStatement only once:
String query =
"INSERT INTO SESSIONS (id,module_name, module_number, level, session, term, class_list, location, lecturer) " +
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)";
PreparedStatement insert = connection.prepareStatement(query);and then every time you want to insert a record you do this:
insert.setString(1, fields.id.getText());
insert.setString(2, fields.module_name.getText());
// and so on...
insert.executeQuery(); -
Syntax Error with EXPORT statement in ECC 6
Hi All,
I have one issue with EXPORT statement syntax.
I have declared data like below:
DATA: BEGIN OF mem_id,
mandt LIKE sy-mandt,
uname LIKE sy-uname,
modno LIKE sy-modno,
END OF mem_id.
export the memory id
EXPORT E_VBKOK XANZPK TEXTTAB XBOLNR TO MEMORY ID MEM_ID.
When I am checking the syntax error i am getting like "MEM_ID" must be a character-type field (data type C, N, D or T). by "INTERFACE". by "INTERFACE". "INTERFACE". by "INTERFACE". by "INTERFACE".
I know this statement would be like IMPORT ITAB TO JTAB FROM MEMORY ID 'table'. So I have written like below
EXPORT E_VBKOK XANZPK TEXTTAB XBOLNR TO MEMORY ID 'MEM_ID'. But still it is throwing an error.
Can you please let me know how can I resolve this?
Regards,
Jyothi CH.Hi Jyothi,
data: l_var type string.
concatenate '6' '8' into l_var separated by space.
export l_var to memory id 'BB'.
Here we have to declare the type(structure) for l_var not for BB
and in another program
data:l_var type string.
import l_var from memory id 'BB'.
write : l_var. -
SYntax error - on Perform Statement
Hello friends,
I have a syntax error in the following code.
the error is The field "P_I_PA0000" is unknown, but there are the following fields
in the function module.
Any suggestions.
Thanks,
Raju.
PARAMETERS: ps_file1like rlgrap-filename " Incoming file 1
DEFAULT 'c:\HR\ZCNV0008.txt' LOWER CASE,
DATA: BEGIN OF i_pa0000 OCCURS 100.
INCLUDE STRUCTURE pa0000.
DATA: END OF i_pa0000.
PERFORM upload_local_file USING ps_file1
CHANGING i_pa0000[].
*& Form upload_local_file
text
-->P_PS_FILE1 text
<--P_I_PA0000 text
FORM upload_local_file USING p_ps_file1
CHANGING p_i_pa0000[].
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_ps_file1
filetype = 'ASC'
TABLES
data_tab = p_i_pa0000[]
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
ENDFORM. " upload_local_fileIf it doesn't work, why did you mark it as "solved"?
I think this is what you are trying to do:
PARAMETERS: ps_file1 LIKE rlgrap-filename " Incoming file 1
DEFAULT 'c:\HR\ZCNV0008.txt' LOWER CASE.
DATA: BEGIN OF i_pa0000 OCCURS 100.
INCLUDE STRUCTURE pa0000.
DATA: END OF i_pa0000.
PERFORM upload_local_file
TABLES i_pa0000
USING ps_file1.
*& Form upload_local_file
* text
FORM upload_local_file
TABLES p_i_pa0000
USING p_ps_file1.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_ps_file1
filetype = 'ASC'
TABLES
data_tab = p_i_pa0000
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
ENDFORM. " upload_local_file
Rob -
I keep getting a syntax error when I type this in...
=(B1/50)+(C1/12)-(MIN(D1, [4])+/5)
it is a formula to calculate weight watches points. here it is as seen on a website.
p=(c/50)+(f/12)-(min{r,4}/5)
p=points
c=calories
f=fat grams
r=dietary fiber
I have the cells so that b1 = calories, c1 = fat grams, and d1 = dietary fiber.
Can anyone point me in the right direction? I'm thinking its just a simple mistake that I am making. Thanks.Have you looked at the replies to your other thread? You have several syntax errors for spreadsheets. What language is being used in the equation?
Regards, -
Syntax error in modify statement
Hi Friends,
There is an Internal table IT_STATUS which is the Parameter in BADI Method IF_EX_WORKORDER_UPDATE~BEFORE_UPDATE.
Below is the code i have written
Data: wa_status type cobai_s_status,
stat TYPE TABLE OF jstat,
wa_stat type jstat.
CALL FUNCTION 'STATUS_READ'
EXPORTING
client = sy-mandt
objnr = gv_objnr
* ONLY_ACTIVE = ' '
* IMPORTING
* OBTYP =
* STSMA =
* STONR =
TABLES
status = stat
EXCEPTIONS
object_not_found = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
loop at it_status into wa_status.
read table stat into wa_stat with key STAT = wa_status-stat.
if sy-subrc = 0.
wa_status-stat = wa_stat-stat.
wa_status-INACT = wa_stat-INACT.
modify it_status from wa_status transporting stat inact.
endif.
endloop.
ENDIF.
At Modify statement it is giving a syntax error 'The <b>field "IT_STATUS" cannot be changed.-</b>'. what could be the reason?
Please provide me the solution.
Thanks & Regards,
SatishHi Rob,
This is the whole code which i had written in method
METHOD if_ex_workorder_update~before_update.
DATA: gv_aufnr TYPE afih-aufnr,
gv_objnr TYPE jest-objnr,
stat TYPE TABLE OF jstat,
wa_stat TYPE jstat,
wa_header TYPE cobai_s_header,
wa_status TYPE cobai_s_status,
it_status_new TYPE cobai_t_status.
DATA: status_index TYPE sy-tabix.
BREAK-POINT.
LOOP AT it_header INTO wa_header.
SELECT SINGLE aufnr FROM afih INTO gv_aufnr WHERE warpl = wa_header-warpl AND abnum = 1.
IF sy-subrc = 0.
CONCATENATE 'OR' gv_aufnr INTO gv_objnr.
CALL FUNCTION 'STATUS_READ'
EXPORTING
client = sy-mandt
objnr = gv_objnr
* ONLY_ACTIVE = ' '
* IMPORTING
* OBTYP =
* STSMA =
* STONR =
TABLES
status = stat
EXCEPTIONS
object_not_found = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
LOOP AT it_status INTO wa_status.
status_index = sy-tabix.
READ TABLE stat INTO wa_stat WITH KEY stat = wa_status-stat.
IF sy-subrc = 0.
wa_status-stat = wa_stat-stat.
wa_status-inact = wa_stat-inact.
MODIFY it_status INDEX status_index FROM wa_status TRANSPORTING stat inact.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDLOOP.
ENDMETHOD.
Hope it will get resolved
Regards,
Satish -
I receive a message 'Illegal start of type' on the first Try statement when compiling the following code. I'd appreciate any ideas on why this error occurs.
import java.util.*;
import java.sql.*;
import java.io.*;
import java.lang.*;
public class VPAsql {
String fieldValue;
Connection connection = null;
VPAsql() {
//public static void main(String args[]) {
try {
String driverName = "COM.ibm.db2.jdbc.app.DB2Driver";
Class.forName(driverName);
String url = "jdbc:db2:SAMPLE";
String username = "db2admin";
String password = "password";
connection = DriverManager.getConnection(url, username,
password);
} catch (ClassNotFoundException e) {
System.err.println("Driver not found");
} catch (SQLException e) {
System.err.println("Could not connect");
System.err.println(connection);
insertSampleTable(String passedFieldValue){
this.fieldValue = passedFieldvalue;
try {
Statement stmt = connection.createStatement();
String sql = "INSERT INTO SAMPLE.PNVPA(PONUMBER) VALUES
(passedFieldvalue)";
stmt.executeUpdate(sql);
} catch (SQLException e) {
}Uncomment the main method (or put another method with right signature there)
-
Syntax Error in SELECT statement
Hi,
My ABAP statement is:
select b1~fa a1~fb
INTO CORRESPONDING FIELDS OF TABLE it_1
from (table_nm) as a1 inner join db_tab2 as b1
on a1~fb = b1~fb.
For this statement it gives me following error in syntax check:
*Wrong expression "INNER" in FROM clause. WHERE condition. *
Thanks,
CDHi
Try something like this:
DATA: BEGIN OF ITAB OCCURS 0,
A,
B,
END OF ITAB.
DATA: TABLENAME(30).
DATA: WA_FTAB(72) TYPE C,
FTAB LIKE TABLE OF WA_FTAB.
WA_FTAB = 'A'. APPEND WA_FTAB TO FTAB.
SELECT (FTAB) FROM (TABLENAME) INTO TABLE ITAB.
LOOP AT ITAB.
SELECT SINGLE A FRO <TABLE 2>
INTO ITAB-B
WHERE A = ITAB-A.
MODIFY ITAB.
ENDLOOP.
See this sample:
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
VKORG LIKE VBAK-VKORG,
END OF ITAB.
DATA: TABLENAME(30) VALUE 'VBAP'.
DATA: WA_FTAB(72) TYPE C,
FTAB LIKE TABLE OF WA_FTAB.
WA_FTAB = 'VBELN'. APPEND WA_FTAB TO FTAB.
WA_FTAB = 'POSNR'. APPEND WA_FTAB TO FTAB.
SELECT (FTAB) UP TO 10 ROWS FROM (TABLENAME) INTO TABLE ITAB.
LOOP AT ITAB.
SELECT SINGLE VKORG FROM VBAK INTO ITAB-VKORG
WHERE VBELN = ITAB-VBELN.
MODIFY ITAB.
ENDLOOP. -
Error using SHIFT statement when migrating program from R/3 4.7 to ECC6.0
Hello Experts,
The SHIFT statement is giving following error in ECC6.0 but the same is warning in R/3 4.7.
"Floating point variable can not be used with SHIFT statement.".
Statement is - SHIFT itab-f1 by 5 places where f1 is a floting point field.
We passed the value in string variable and used in the SHIFT statement. It is removing the error but not giving the result same as in R/3 4.7.
Please let me know how to solve this.
Thanks and Regards,
RahulHello,
Thanks for the reply.
We don't know why was this code written. We are just moving the object from R/3 4.7 to ECC 6.0 and fixing the errors.
Could you please let me know "What it means to SHIFT a floating point variable by some spaces"? .
This i am asking because SHIFT RIGHT generally means to shif the value to the right by some spaces i.e. inserting space at the starting.
But in case of floating point it change the value itself. If you can tell me then i can find an alternative solution to get the same result.
Thanks and Regards,
Rahul -
Syntax Error - Using "Group By" with "Union All"
Dear SAP community, I am a newb in need of help.
Just spent the past 2 days searching for answers on how to build this query.
Basically, I just want to group the Item Names (U_ItemName) together and have their respective quantities (U_Cart) added together so the same items display as one total quantity, no duplicates.
I have tried so many combinations of GroupBy and Sum/Count....etc. Nothing is working.
The query:
SELECT T1.[U_ItemName] AS 'Item Name', T1.[U_Cart] AS 'Cartons Available', T0.[Country] AS 'Country', T1.[U_ShlfLife] AS 'Shelf Life' FROM [dbo].[OWHS] T0 inner join [dbo].[@SICAS_EXT_WHS] T1 on T0.WhsCode=T1.U_WhseCode WHERE T0.[Country] = (N'JP' ) and DateDiff(Month, GetDate(),T1.[U_ShlfLife]) <= 6 union all
SELECT T0.[U_ItemName], Sum(T0.[U_Cart]) as Cartons, T1.[Country], null FROM [dbo].[@SICAS_EXT_WHS] T0, OWHS T1 WHERE T1.[Country] = (N'JP' ) and DateDiff(Month, GetDate(),T0.[U_ShlfLife]) >= 6
GROUP BY T0.[U_ItemName], T0.[U_Cart], T1.[Country]
Can anybody advise how to get this working?
Thank you,
Justice Nerenberghi justice,
I checked your code and it seems correct. but I don't have same table in database so i can't check it correctly.
but I tried your problem with same situation and I am getting actual result.
Example :-
select itemcode,dscription,quantity from inv1
where docdate>'2011-02-18 00:00:00.000'
union all
select itemcode,dscription,Sum(quantity) from inv1
where docdate<'2011-02-18 00:00:00.000'
group by itemcode,dscription
Please do one thing rum both select queries separately whether running properly. Using above example you can check your code
Thanks
Annu
Maybe you are looking for
-
Duplicate invoice, partial payment, residual payment
Hi every body I am facing some problems in AP 1. I post a invoice in AP I see that there are two document number 190000006 Please tell me why? 2. I pay a invoice with amount of 200000 in two times firstly, I post a partial payment with amount 100000
-
I have got the "Applet TestApplet notinited" error in the status bar when I try to open an applet in IE, but within in JBuilder, it works fine. Who can help me with this? Thanks in advance! Senlin
-
IPad air syncing problem of video
When sync the photo and video from PC to iPad air, the video only shows just a photo in the iPad air, can't play. But iPad 2 is no problem. iPad air was sync under ios7.0.4, the iPad 2 was sync under ios6.
-
Requirements for VLAN select feature in 5508 WLC
Hello, We implemented WLC 5508 software version 7.3, with 8 Aironet devices, most of them are AIR-LAP1131AG-E-K9, and two AIR-LAP1242AG-E-K9. I could really have benefits of VLAN select feature, but I noticed that it's not working like it should. Two
-
downloaded 10.9 all well 'til I get desktop and can't enter my password, message of error, and it shuts down: reboot and error reappears"your computer restarted because of a problem. touch any key.....etc' 75-yr-old needs guidance.........than