Exception class help
Hi,
i create exception class like it write in the sap help and when i want to send the exception with parameters to the ABOVE METHODS i don't susses i just get the message without the parameter ?
there is simple guideline how o transfer the exception with parameters?
br
Ricardo
HI Uwe,
Thanks,
This is my sample code:
This is the first method on the tree:
the method name is create .
INSERT (lt_table_name) FROM <ls_obj>.
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE /cx_db_db_error
EXPORTING
textid = cx_db_error=>create_failed
table_name = lt_table_name.
ENDIF.
this method call to the above method - create .
TRY.
CALL METHOD lo_obj_create->create
CHANGING
is_bound_object = ls_obj_user.
CATCH cx_db_error INTO lo_exc.
"Create user failed. Throw an exception.
RAISE EXCEPTION TYPE cx_db_error
EXPORTING
textid = cx_db_error=>create_user_error
previous = lo_exc.
result = lo_exc->get_text( ).
ENDTRY.
here in result i just get the massage without the table name that i export in the first method ,what i miss here ?
Best Regards
Ricardo
Similar Messages
-
DAC ERROR EXCEPTION CLASS::: java.lang.NullPointerException
hello guru,
when i creating a execution plan in my local envt for testing
I have assemble the subject area
but while building the execution plan i am getting below error:
SHTEST-TEST
EXCEPTION CLASS::: java.lang.NullPointerException
com.siebel.analytics.etl.execution.ExecutionParameterHelper.substituteNodeTables(ExecutionParameterHelper.java:174)
com.siebel.analytics.etl.execution.ExecutionParameterHelper.parameterizeTask(ExecutionParameterHelper.java:141)
com.siebel.analytics.etl.execution.ExecutionPlanDesigner.getExecutionPlanTasks(ExecutionPlanDesigner.java:738)
com.siebel.analytics.etl.execution.ExecutionPlanDesigner.design(ExecutionPlanDesigner.java:1267)
com.siebel.analytics.etl.client.util.tables.DefnBuildHelper.calculate(DefnBuildHelper.java:169)
com.siebel.analytics.etl.client.util.tables.DefnBuildHelper.calculate(DefnBuildHelper.java:119)
com.siebel.analytics.etl.client.view.table.EtlDefnTable.doOperation(EtlDefnTable.java:169)
com.siebel.etl.gui.view.dialogs.WaitDialog.doOperation(WaitDialog.java:53)
com.siebel.etl.gui.view.dialogs.WaitDialog$WorkerThread.run(WaitDialog.java:85)
can anyone help on this.
thanksHello Shiva,
I have tried to generate the paramenter index in going into execute tab.
Acutally I have two database one is SH(for sales fact table) as source and other is SHTST (for target w_sales_F).
when i go into that it try to click on generate button it shows only for SHTST not for SH
more over in SHTST the value is coming as Informatica folder Sales where i created all mapping.
SH and SHTST both are in same database oracle 10g.
please help -
Hi all,
i build exception class with massages ,and i want to know if there is log that
manage this exception ? i,e. where i can see the exception's of the program if they occur .
Best regards
NinaHi Nina,
take a look at the function modules in function group SBAL. They let you add messages to message logs which can be displayed using transaction SLG1.
You can find more information here:
[Online help for application logs|http://help.sap.com/saphelp_erp60_sp/helpdata/EN/2a/fa0216493111d182b70000e829fbfe/content.htm]
Regards,
David -
Hi,
What is exception class .
What is local exception class
what is global exception class.
Thanks,
Medha.Hi,
And also check this doc.
http://help.sap.com/saphelp_nw04/helpdata/en/fb/35c62bc12711d4b2e80050dadfb92b/content.htm
a® -
Exception class & Throwable class
Does the Exception class inherit hashCode from the Throwable class?
thanks in advance for anyones help??No, from Object.
http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Exception.html -
How to use user defined exception class
Hi all
I just need som help with creating a user defined exception class.
Im writing a small/simple text editor.
My exception class looks like this:
public class myExcp extends Throwable
private String message;
public myExcep(String message)
this.message = message;
public void display()
System.out.println(message);
I would like to use it when a user tries to open a exe-file instead of a txt file.
Here is some code from the editor:
if (e.getSource() == open)
saveOld();
if (fc.showOpenDialog(null)== JFileChooser.APPROVE_OPTION)
readFile(fc.getSelectedFile().getAbsolutePath());
saveas.setEnabled(true);
So, should I use exception here or at the readFile method?
readfile:
private void readFile(String fileName)
try
String tmp = fileName.substring(fileName.length() -4, fileName.length());
if (!tmp.equals(".exe"))
FileReader r = new FileReader(fileName);
textarea.read(r, null);
r.close();
currentFile = fileName;
label.setText(currentFile);
changed = false;
catch (IOException e)
JOptionPane.showMessageDialog (this, "Cannot find the file " + fileName);
Where and how do I use my exception class.
Do I need to create an instance? Where?
Should the exception class extend Exception instead?
Thank you in advance /Extend Exception, not Throwable. It's a checked exception that way.
Follow the Sun coding standards and make that exception class name start with a capital letter.
When you extend Exception, override all four ctors.
What's that display method you added? Isn't getMessage() good enough?
You need to create a new instance just before you throw the exception, of course.
Sounds like a terrible design, by the way. Exceptions shouldn't be used like "go to" for app logic. They should signal unrecoverable conditions. You can easily recover from the situation you've described simply by displaying a pop-up that tells the user to open only text-readable file types. I think that's a better solution.
% -
Exceptions classes in 4.6C
Hello SDNers,
as Uwe had already written in the thread Throw statement equivalent in ABAP Objects.
What would be better?
1. Would you try to develop in 4.6C the exception classes
(plenty of work, but keeping myself updated, and I can use them also in the future)
CX_ROOT -> ZCX_ROOT; ZIF_MESSAGE
CX_STATIC_CHECK (I need this slass) -> ZCX_STATIC_CHECK
2. just to solve the problem with traditionally
METHOD get_xxx.
IF sy-subrc = 0.
ELSE.
RAISE wrong_xxxx.
ENDIF.
ENDMETHOD.
With regards,
PeterYou may appreciate that whatever is possible in OO ABAP is still possible in procedural ABAP with difference in the extent of SW reusability, visibility control etc. So its a design decision whether to go for OO ABAP. In case you have a business case for a class ( you feel that the class will be used many times in your project, you need to control visibility, you have chances of enhancing the functionality of the class, you do not want to incur more resources in testing etc. ), you can go for the development of the exception class.
Otherwise traditional development may be helpful. -
About exception class CX_TPDA_SYS_SYMB_FSUNASSIGNED
Can any tell me how to use this exception class.
I try to use this exception class to catch unassign exception when using field symbol. But failed.Is there a way to catch unassign exception of field symbol?
Thanks
DATA: int TYPE I.
FIELD-SYMBOL: <int> TYPE I.
DATA: r_exception TYPE REF TO CX_TPDA_SYS_SYMB_FSUNASSIGNED.
TRY.
<int> = 1.
CATCH CX_TPDA_SYS_SYMB_FSUNASSIGNED INTO r_exception.
ENDTRA.
When execute <int> = 1.ABAP dumps occurs.Hi Chris,
it seems that the exception of using an unassigned field symbol is not catchable. I've tried out your example and replaced the class after CATCH statement with main exception class cx_root. Even cx_root is not able to catch this exception.
I recommend that you avoid this situation by using code like this:
IF <int> IS ASSIGNED.
<int> = some_value.
ELSE.
RAISE EXCEPTION your_exception.
ENDIF.
Hope this helps!
Regards
Mark-André -
BeanUtils.populate exception (Need Help)
Dear All,
Am getting a strange exception when try to do a action in struts, below is my exception, please help me in solving this issue.
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: BeanUtils.populate
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1190)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
java.security.AccessController.doPrivileged(Native Method)
java.security.AccessController.doPrivileged(Native Method)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
root cause
java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
java.security.AccessController.checkPermission(AccessController.java:427)
java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
java.lang.SecurityManager.checkMemberAccess(SecurityManager.java:1662)
java.lang.Class.checkMemberAccess(Class.java:2125)
java.lang.Class.getDeclaredMethods(Class.java:1762)
org.apache.commons.beanutils.MappedPropertyDescriptor$1.run(MappedPropertyDescriptor.java:386)
java.security.AccessController.doPrivileged(Native Method)
org.apache.commons.beanutils.MappedPropertyDescriptor.getPublicDeclaredMethods(MappedPropertyDescriptor.java:383)
org.apache.commons.beanutils.MappedPropertyDescriptor.internalFindMethod(MappedPropertyDescriptor.java:453)
org.apache.commons.beanutils.MappedPropertyDescriptor.findMethod(MappedPropertyDescriptor.java:527)
org.apache.commons.beanutils.MappedPropertyDescriptor.<init>(MappedPropertyDescriptor.java:149)
org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:865)
org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:991)
org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:865)
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:343)
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1188)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
java.security.AccessController.doPrivileged(Native Method)
java.security.AccessController.doPrivileged(Native Method)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.Thanks in advance,
vyrav.Thanks for ur reply Ganesh.
This is my JSP
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html:html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Uploaded File Details</title>
<script>
function logOut()
document.adminForm.action="upload.do?parameter=logout";
document.adminForm.submit();
function download(temp)
document.adminForm.fileId.value = temp;
document.adminForm.action="download.do";
document.adminForm.submit();
</script>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<table align="right">
<tr>
<td>
<a href="javascript:logOut();">Logout</a>
</td>
</tr>
</table>
<%
if(session.getAttribute("name")!=null)
String userName= (String) session.getAttribute("name");
%>
<br /><br /><b>Welcome <%=userName%></b><br />
<%
%>
<center>
<html:form action="/download.do" name="adminForm" type="com.roots.AdminForm">
<br /><br />
<html:hidden property="fileId"/>
<table align="center" border="1">
<tr bgcolor="#FFCC66">
<td align="center">
No
</td>
<td align="center">
Name
</td>
<td align="center">
Uploaded Date
</td>
<td align="center">
File Name
</td>
</tr>
<logic:iterate name="adminForm" property="displayList" id="displayDto">
<tr>
<td align="center">
<bean:write name="displayDto" property="serialNo"/>
</td>
<td align="left">
<bean:write name="displayDto" property="empName"/>
</td>
<td align="left">
<bean:write name="displayDto" property="uploadedDate"/>
</td>
<td align="left">
<a href="javascript:download('<bean:write name="displayDto" property="serialNo"/>');"><bean:write name="displayDto" property="fileName"/></a>
</td>
</tr>
</logic:iterate>
</table>
</html:form>
</center>
</body>
</html:html>This is my struts config
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<data-sources>
</data-sources>
<form-beans>
<form-bean name="loginForm" type="com.roots.LoginForm" />
<form-bean name="uploadForm" type="com.roots.UploadForm" />
<form-bean name="adminForm" type="com.roots.AdminForm" />
</form-beans>
<global-forwards></global-forwards>
<action-mappings>
<action path="/login"
name="loginForm"
scope="request"
validate="true"
input="/login.jsp"
type="com.roots.LoginAction" >
<forward name="SUCCESS" path="/upload.jsp" />
<forward name="FAILURE" path="/login.jsp" />
<forward name="ADMIN" path="/admin.do" />
</action>
<action path="/upload"
name="uploadForm"
scope="request"
parameter="parameter"
input="/upload.jsp"
type="com.roots.UploadAction" >
<forward name="SUCCESS" path="/upload.jsp" />
<forward name="FAILURE" path="/login.jsp" />
</action>
<action path="/download"
type="com.roots.FileDownloadAction">
</action>
<action path="/admin"
name="adminForm"
scope="request"
validate="false"
type="com.roots.AdminAction" >
<forward name="DISPLAY" path="/admin.jsp" />
<forward name="FAILURE" path="/login.jsp" />
</action>
</action-mappings>
<message-resources parameter="application_fr"/>
<message-resources parameter="application_es"/>
<message-resources parameter="application_en"/>
<message-resources parameter="application_de"/>
<message-resources parameter="application" />
</struts-config>this is my form package com.roots;
import java.util.List;
import org.apache.struts.action.ActionForm;
public class AdminForm extends ActionForm {
private List displayList = null;
public String fileId;
public String getFileId() {
return fileId;
public void setFileId(String fileId) {
this.fileId = fileId;
public List getDisplayList() {
return displayList;
public void setDisplayList(List displayList) {
this.displayList = displayList;
}Please let me know wat am doing wrong, this is killing me for the last two days.
Thanks,
vyrav. -
Example of exception class for school
I know this may sound basic to some but, believe me, it's not to me! Does anybody have an example (I'll totally rewrite it to look different) of an exception class having an interface with at least 5 methods and 2 must throw the new exception? It would also have to implement the interface for each method and create a new main program that instantiates objects of the class while executing the methods that can. I'm taking a JAVA class and this problem is giving me big time grief! I'd really appreciate it and will help back if ever possible.
Soon-to-be-JAVA-flunkyRedboss wrote:
I know this may sound basic to some but, believe me, it's not to me! Does anybody have an example (I'll totally rewrite it to look different) of an exception class having an interface with at least 5 methods and 2 must throw the new exception? It would also have to implement the interface for each method and create a new main program that instantiates objects of the class while executing the methods that can. I'm taking a JAVA class and this problem is giving me big time grief! I'd really appreciate it and will help back if ever possible.
As hinted at you need to re-read your assignment. More likely you are to create two classes and an interface. One class will be your exception class. I'll give you the code for that because I'm such a generous guy.
public class MyException extends Exception{
}Then you'll create an interface that has 5 methods, two of which throw MyException. Then write a class that implements that interface.
Best of luck. If you have a specific problem implementing that then come back and ask but make sure to post your code when you do (use the code formatting tags, select the code you are posting in the message box and click the CODE button). No code. No help. -
Own ZCX Exception Class, how to translate
Hi,
i've written my own ZCX_XYZ exception class. On the tabstrip "Texts" i've entered some texts, but how can i translate those texts? When i'm going to Goto/Translations i'm just getting empty object list...Thanks for investigating again. Using SE63_OTR i'm getting the message that this is obsolet and i have to use SE63.
To make things more clearer i made some screenshots.
<a href="http://666kb.com/i/atri3x4ib1uryogzr.png">Class with Attributes</a>
So i have a class ZCX_FTP, the superclass is CX_DYNAMIC_CHECK, and i have an attribut which was generated automatically with the same name of the class.
The texts are as follows:
<a href="http://666kb.com/i/atri6gk1z8qn3ff9j.png">Defined Text</a>
So now i'm going to SE63 (BTW are these texts otr short texts or long ones?), entered the ID and pressed Edit:
<a href="http://666kb.com/i/atri82j1b5x02q7ev.png">SE63 with ID</a>
I'm getting Object does not exists....
Logging on with different language might be a workaround with de/en, but i have some difficulties navigating inswedish, greek, france and half a dozen more languages. On the other hand, i do not want to hand over the source texts to those who translates the texts. I'm really lost in this and cant find online help/documentation dealing with this. -
How to enhance exception class based on CX_ROOT
I have created an exception class based on CX_ROOT (or CX_STATIC_CHECK, CX_DYNAMIC_CHECK). Now, I need to enhance its "constructor" method with my own parameters. How can I do this? Currently system does not allow this. But, I have seen many other exception classes enhanced the way I want? Any idea?
Any pointers will be helpful.
Regards, NeetuHello Neetu
Two steps are required to get additional IMPORTING parameters in the CONSTRUCTOR method of your exception class:
(1) Create exception IDs (tabstrip Texts )
Example: ID=ZCX_SDN_CLASS, text=Invalid data type for field &FIELD& on screen &SCREEN& &REPORT&
(2) Add corresponding instance attributes (read-only) to your exception class
Examples: attributes FIELD, SCREEN, REPORT
Now the CONSTRUCTOR has the additional IMPORTING parameters FIELD, SCREEN and REPORT.
If you raise your exception class using id=ZCX_SDN_CLASS then the wildcards (e.g. &FIELD& in the text) will be replaced by IMPORTING parameter FIELD.
Regards
Uwe -
I am working on JTable.
Vector properties = MainFrame.getPropertyList(Object);
if(properties.size() > 1) {
tm.setDataVector(properties, colNames);
txtProperties.setText(dataModelObject.toString());
else {
if the properties i.e the vector is null I want to throw an exception i.e in the else part of the code. Which says the not valid properties or something like that.
I don't know how to write an exception. Need help with this. Thanks.Create a new Exception Class. All exceptions of class "Exception" or subclasses thereof--except
"RuntimeException"s--must be caught.
RuntimeException:
public class NullDefException extends RuntimeException
String errorMsg;
public void NullDefException(String errorMsg){
this.errorMsg=errorMsg;
public String getErrorMsg()
return errorMsg;
If NullDefException is not a "RuntimeException", the Java compiler would ask you to either "try-catch"
"NullDefException " or declare it in the throws clause of the method.
public class NullDefException extends Exception{
String errorMsg;
public void NullDefException(String errorMsg){
this.errorMsg=errorMsg;
public String getErrorMsg()
return errorMsg;
Method with throws clause:
public void DataVector throws NullDefException(){
Vector properties = MainFrame.getPropertyList(Object);
if(properties==null)
throw NullDefException;
if(properties.size() > 1) {
tm.setDataVector(properties, colNames);
txtProperties.setText(dataModelObject.toString());
else {
Method with try-catch:
public void DataVector (){
try{
Vector properties = MainFrame.getPropertyList(Object);
if(properties.size() > 1) {
tm.setDataVector(properties, colNames);
txtProperties.setText(dataModelObject.toString());
else {
catch(NullDefException e){System.out.println("NullDefException:"+e.getErrorMsg);}
} -
Assertions vs. Exceptions Classes
Hello Everyone,
in the last weeks we were progressing with the use of exception classes in our current project...
I continued reading about ways to improve software quality and such that I reached the the new way of using Assertions thought this paper: http://www.sapnow.cn/upload/7871465e846771cf9.PDF
My Questions is now when do I use what in my code?
As an example:
Select * from vbak where vbeln = lf_vblen
What do I do to "check" that
lf_vblen
is not initial? Or what do I do IF it IS Inital and it shouild not be, should I raise an exception oder use Assert?
I can imagine that there will be no clear statement, but I would like to get a feeling when to us what ...
Thanks for your reply or comment.You may appreciate that whatever is possible in OO ABAP is still possible in procedural ABAP with difference in the extent of SW reusability, visibility control etc. So its a design decision whether to go for OO ABAP. In case you have a business case for a class ( you feel that the class will be used many times in your project, you need to control visibility, you have chances of enhancing the functionality of the class, you do not want to incur more resources in testing etc. ), you can go for the development of the exception class.
Otherwise traditional development may be helpful. -
Get the values from Exception class
Hi all ..
In class i have raised one exception
when i catch this exception in my program i m able to get the
error message but i need to get all the parameters that i pass
when i raise the exception ...
i have raised like this
RAISE EXCEPTION TYPE cx_bapi_error
EXPORTING
textid = cx_bapi_error=>cx_bo_error
class_name = 'ZHS_'
log_no = wa_bapi_return-log_no
log_msg_no = wa_bapi_return-log_msg_no
t100_msgid = wa_bapi_return-id
t100_msgno = wa_bapi_return-number
t100_msgv1 = wa_bapi_return-message_v1
t100_msgv2 = wa_bapi_return-message_v2
t100_msgv3 = wa_bapi_return-message_v3
t100_msgv4 = wa_bapi_return-message_v4
STATUS = lt_status
and caught the exception like this in my program
CATCH cx_bapi_error INTO go_error.
gd_text = go_error->get_text( ).
EXIT.
ENDTRY.
in this i m just getting the class name which i have passed in exception
i need all other parameters that i have passed ..
if u have any idea pls let me know ..
Thanks in advance ...Hello Jayakumar
Usually the attributes of standard exception classes are defines as <b>public</b> and <b>read-only</b>. Thus, you should be able to use the following coding:
DATA:
go_error TYPE REF TO cx_bapi_error. " specific exception class !!!
TRY.
RAISE EXCEPTION TYPE cx_bapi_error
EXPORTING
textid = cx_bapi_error=>cx_bo_error
class_name = 'ZHS_'
log_no = wa_bapi_return-log_no
log_msg_no = wa_bapi_return-log_msg_no
t100_msgid = wa_bapi_return-id
t100_msgno = wa_bapi_return-number
t100_msgv1 = wa_bapi_return-message_v1
t100_msgv2 = wa_bapi_return-message_v2
t100_msgv3 = wa_bapi_return-message_v3
t100_msgv4 = wa_bapi_return-message_v4
STATUS = lt_status.
CATCH cx_bapi_error INTO go_error.
gd_text = go_error->get_text( ).
WRITE: go_error->t100_msgid, " perhaps the attributes have different name
go_error->t100_msgno, " check attribute names in SE24
EXIT.
ENDTRY.
Regards
Uwe
Maybe you are looking for
-
Itunes encountered problem and needs to be closed
i keep trying to open itunes, but before it even opens, it says theres a problem and needs to be closed. is there anyway i can fix this?
-
Restrict selection for Payment Terms on VA01/VA02
In user exit MV45AFZZ I want field VBKD-ZTERM to be changed to certain values. I have other fields disable like this: WHEN 'VBKD-PRSDT'. screen-active = 1. screen-input = 0. And other fields have a condition check prior to disable the
-
Importing .asf files, blurry in source/sequence monitors and output
I have a large amount of material to work with in .asf form, 480x360 resolution. I'll be outputting to 480x360 as well, so no scaling/zooming needed at all. Problem is, when I import one of those asfs it immediately becomes blurry, i.e. in the source
-
Available Reports !?
Is there any way of knowing all the available reports in a particular module including the Z* reports !? For example i would like to know all the available reports MM !! Regards, Ramesh
-
Buffering Porblems from an XP machine in iTunes
Hi All, My XP machine with not play over my airport express (connected to my stereo) without jolting every couple of seconds. The Airport express is a client of another Dlink router. The XP Pc is using iTunes 4.9.0.17 Can anyone suggest any possible