Catch assertion_failed on create object
Hi,
I create an object based on user input. When the user makes a typo, I get an assertion_failed dump, although I've encapsulated it wit a try catch on cx_root.
How can I catch an assertion_failed in order to prevent a dump?
Eddy
@Eddy
You can do a simple check before creating instance of this class
DATA: gr_typedescr TYPE REF TO cl_abap_typedescr,
gr_obj TYPE REF TO object.
DATA: gt_params TYPE abap_parmbind_tab.
CALL METHOD cl_abap_typedescr=>describe_by_name(
EXPORTING
p_name = 'CL_GUI_ALV_GRID2'
RECEIVING
p_descr_ref = gr_typedescr
EXCEPTIONS
type_not_found = 1
OTHERS = 2 ).
IF sy-subrc = 0.
CREATE OBJECT gr_obj TYPE ('CL_GUI_ALV_GRID2')
PARAMETER-TABLE gt_params.
ENDIF.
@Tomek
If the result of log_exp is false, for an always active assertion (without the addition ID) an untreatable exception is triggered and the program terminates with the runtime error ASSERTION_FAILED.
Actually this depends on configuration made in SAAB . The processing might still go on if other config option is set.
Regards
Marcin
Similar Messages
-
Creating object type conflict dump
Hi All,
I have an interface zintf_1. I getting the list of classes that implemented the zintf_1.
There are some cases where the class wont have implemented the interface.
ZDEMO_AA class has not implemented the interface zintf_1.
data: lr_intf_1 type ref to zintf_1,
lv_clsname type SEOCLSNAME.
lv_clsname = 'ZDEMO_AAA'.
try.
create object lr_intf_1 type (lv_clsname).
catch cx_sy_create_object_error.
endtry.
In that case i m getting the dump "Type conflict with allocation of References".
Please help me to resolve the issue.
thanks
VimalrajI'm assuming that you're trying to trap the case the class lv_clsname doesn't actually implement the interface.
Well, the interface not being there is NOT a catchable error. So you have to find out whether the interface is implemented first.
DATA: lr_intf_1 TYPE REF TO zintf_1,
lv_clsname TYPE seoclsname,
lr_object TYPE REF TO cl_oo_class,
lt_intf TYPE seo_relkeys.
lv_clsname = 'ZDEMO_AAA'.
lr_object ?= cl_oo_object=>get_instance( lv_clsname ).
lt_intf = lr_object->get_implemented_interfaces( ).
READ TABLE lt_intf TRANSPORTING NO FIELDS WITH KEY refclsname = 'ZINTF_1'.
IF sy-subrc IS INITIAL.
CREATE OBJECT lr_intf_1
TYPE
(lv_clsname).
WRITE: 'it worked'.
ELSE.
WRITE / 'it failed'.
ENDIF.
matt -
ClassNotFoundException when creating objects
Hi, am am pretty new to using java reflection and all that stuff - so this could be a fairly obvious question.
I am using reflection to create objects whose names are only known at runtime. The method is as follows:
public static IGene getRandomGene(Vector genes){
int size = genes.size();
int rndOp = (int)Math.floor(Math.random() * size);
String newClassName = (String)genes.get(rndOp);
IGene newGene = null;
try {
Class geneDefinition = Class.forName(newClassName);
Constructor cons = geneDefinition.getConstructor(new Class[0]);
newGene = (IGene)GeneUtils.createObject(cons, new Object[0]);
} catch (ClassNotFoundException e) {
System.out.println(e); //And the ClassNotFoundException is encountered
} catch (NoSuchMethodException e) {
System.out.println(e);
return (OperatorGene)newGene;
}The name of the class to be created (newClassName) is found fine.
My includes are:
package simplegp;
import java.util.Vector;
import java.lang.reflect.*;
import simplegp.operandGenes.*;
import simplegp.operatorGenes.*;
import simplegp.operatorGenes.doubleOps.*;
import simplegp.operatorGenes.singleOps.*;These includes definatly cover the classes to be included.
Am i maknig a silly mistake? I cannot fingure it out.
Many thanks for any help
Adam
PS. The code is for some evolutionay programming, hence havnig GenesI seem to have solved the problem - sorry for not searching the forums first.
I had to specify the class names as:
simplegp.operandGenes.IntOperandGene
Rather than just: IntOperandGene
adam -
Proxying alreade created objects.
With reflection Proxies can be created for defined interfaces. (using:
Foo f = (Foo) Proxy.newProxyInstance(Foo.class.getClassLoader(),
new Class[] { Foo.class },
handler);
Is it possible to create a proxy for already created objects?.
With that i mean for example: I have a instance of class Foo. Foo has one method bar(). When bar() is invoked on this particular instance of Foo I want the same behavior as with a Proxy/InvocationHandler with an invocation on the invoke() method on the InvocationHandler.AFAIKS all you need to do is to create the a Invokation handler that passes all calls to your concrete class instance.
You might do something like
public Foo wrapFoo(final Foo concreteFoo) {
return proxy.newProxyInstance(Foo.class.getClassLoader, new Class[]{Foo.class}, new InvocationHandler() {
public Object invoke(Object proxy, Method method, Object[]args) throws Exception {
try {
// insert tracing code etc. here
return method.invoke(concreteFoo, args);
} catch (InvocationTargetExcepion e) {
throw e.getCause();
}Of course, Foo must be an interface. -
Error creating Objects with Reflection
This is the code:
try{
System.out.println("Restart - test 1 - sub == " + sub);
c = Class.forName(sub);
con = c.getDeclaredConstructor();
catch(NoSuchMethodException e){
System.out.println("Unknown event type\t" + e);
}Output:
Restart - test 1 - sub == Mouse
Unknown event type java.lang.NoSuchMethodException: Mouse.<init>()I have a Mouse class with a declared Constructor. Why can't it find the Constructor?SquareBox wrote:
almightywiz wrote:
Your code is trying to find the default constructor for your Mouse class. If you don't have a default constructor specified, it will throw the exception you encountered. What does your constructor signature look like?
public Mouse(int weight){
this.weight = weight;
}How do I get the Constructor if it contains parameters?This is answered in your other thread: Creating objects with relfections And you even marked it correct!
Please don't post the same question multiple times. It leads to people wasting their time duplicating each others' answers, and makes for a fractured discussion.
Edited by: jverd on Apr 26, 2011 3:59 PM -
Getting an Exception Unable to create Object
I have the following methos I am getting the unable to create the file exception
I believe the problem is when is trying to read the object I try the following
record.setMessage(input.readObject().toString());
/// record = (Message)input.readObject();1) convert the object to a string
record.setMessage(input.readObject().toString()); 2) I also try this
record = (Message)input.readObject()Notice that I put the put the file into the cryptpText area and then I get into a String
cipherTextString = record.toString();
//put string in JTextArea
cipherTextArea.setLineWrap(true);
cipherTextArea.setText(cipherTextString); Here is the setMessage Method in the Message class
set
public void setMessage(String eMessage)
myMessage = eMessage;
public void performStartTask()
//choose the file to open
int returnVal;
String inputFileName = "";
//open a JFileChoose
JFileChooser chooser = new JFileChooser(new File (
"C:\\Java_code\\java_files"));
chooser.setDialogTitle("Please select an encoded file");
returnVal = chooser.showOpenDialog(null);
if(returnVal == JFileChooser.APPROVE_OPTION)
inputFileName = chooser.getSelectedFile().getName();
//Open the file
ObjectInputStream input = null;
//exception handlig here
try
input = new ObjectInputStream( new FileInputStream("C:\\Java_code\\java_files\\" + inputFileName));
catch (IOException e)
System.err.println("error opening the file");
//read from the file
record = null;
record = new Message();
try
record.setMessage(input.readObject().toString());
/// record = (Message)input.readObject();
catch(EOFException eofe)
return;
catch(ClassNotFoundException cnfe)
System.err.println("Unable to create Object");
catch(IOException ioe)
System.err.println("Error reading from file ");
} // end try catch
System.out.println("Just read in" + record + "." + record.getShift());
//put the file into the cryptpText area
//first - get into a string
cipherTextString = record.toString();
//put string in JTextArea
cipherTextArea.setLineWrap(true);
cipherTextArea.setText(cipherTextString);
closeFile(input);
startBoolean = true;
} // End of performedStartMethodOk I added this piece of code, hope is right
catch (Exception e) {
StackTraceElement[] stack = e.getStackTrace();
String exception = "";
for (StackTraceElement s : stack) {
exception = exception + s.toString() + "\n\t\t";
System.out.println(exception); anf it shows that the error is here
record.setMessage(input.readObject().toString());
java.net.URLClassLoader$1.run(URLClassLoader.java:366)
java.net.URLClassLoader$1.run(URLClassLoader.java:355)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:354)
java.lang.ClassLoader.loadClass(ClassLoader.java:423)
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
java.lang.ClassLoader.loadClass(ClassLoader.java:356)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:264)
java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:622)
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1593)
java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1514)
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750)
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
lab01recheverri.Lab01recheverri.performStartTask(Lab01recheverri.java:172)
lab01recheverri.Lab01recheverri.actionPerformed(Lab01recheverri.java:103)
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
java.awt.Component.processMouseEvent(Component.java:6505)
javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
java.awt.Component.processEvent(Component.java:6270)
java.awt.Container.processEvent(Container.java:2229)
java.awt.Component.dispatchEventImpl(Component.java:4861)
java.awt.Container.dispatchEventImpl(Container.java:2287)
java.awt.Component.dispatchEvent(Component.java:4687)
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
java.awt.Container.dispatchEventImpl(Container.java:2273)
java.awt.Window.dispatchEventImpl(Window.java:2719)
java.awt.Component.dispatchEvent(Component.java:4687)
java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703)
java.awt.EventQueue.access$000(EventQueue.java:102)
java.awt.EventQueue$3.run(EventQueue.java:662)
java.awt.EventQueue$3.run(EventQueue.java:660)
java.security.AccessController.doPrivileged(Native Method)
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
java.awt.EventQueue$4.run(EventQueue.java:676)
java.awt.EventQueue$4.run(EventQueue.java:674)
java.security.AccessController.doPrivileged(Native Method)
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
java.awt.EventQueue.dispatchEvent(EventQueue.java:673)
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
Just read innull.0 -
Creating object type u0093no objectu0094
We have created No objcet table SBO will create only code and name fields but create document table SBO will create DocEntry and also the Extra fields that will help to link to other documents.
Above things that we have clear idea
Could u tell me creating object type no object can we insert the data ..??
Or its compulsory to using UDO?using .srf is it possible ??? i have sending u code
error form bad datasource.. form Unique id 'MPPeriod',item unique id ' cmbppt'
but we check all unique id that is correct
Public Class payperiod
Private WithEvents SBO_Application As SAPbouiCOM.Application
Dim AddStarted As Boolean
Dim RedFlag As Boolean
Private oform As SAPbouiCOM.Form
Private oCodetext As SAPbouiCOM.EditText
Private noteedittext As SAPbouiCOM.EditText
Private daystext As SAPbouiCOM.EditText
Private worktext As SAPbouiCOM.EditText
Private starD As SAPbouiCOM.EditText
Private endD As SAPbouiCOM.EditText
Private Sub SetApplication()
AddStarted = False
RedFlag = False
'// Use an SboGuiApi object to establish connection
'// with the SAP Business One application and return an
'// initialized application object
Dim SboGuiApi As SAPbouiCOM.SboGuiApi
Dim sConnectionString As String
SboGuiApi = New SAPbouiCOM.SboGuiApi
'// by following the steps specified above, the following
'// statement should be sufficient for either development or run mode
sConnectionString = Environment.GetCommandLineArgs.GetValue(1)
'// connect to a running SBO Application
SboGuiApi.Connect(sConnectionString)
'// get an initialized application object
SBO_Application = SboGuiApi.GetApplication()
End Sub
Public Sub New()
MyBase.New()
SetApplication()
addmenuitems()
End Sub
Private Sub DrawForm()
Dim oitem As SAPbouiCOM.Item
Dim oCombopptype As SAPbouiCOM.ComboBox
Try
LoadFromXML("PayPeriodMaster.srf")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
oform = SBO_Application.Forms.Item("MPPeriod")
'''''''''combo for pay type
oitem = oform.Items.Item("cmbppt")
oCombopptype = oitem.Specific
oCombopptype.ValidValues.Add(CStr(3), "Employee")
' oCombopptype.ValidValues.Add(CStr(SAPbouiCOM.BoStatusBarMessageType.smt_Success), "Labour")
oCombopptype.ValidValues.Add(CStr(4), "Labour")
''''''' combo for code
oitem = oform.Items.Item("txtcode")
oCodetext = oitem.Specific
'''''''' startdate
oitem = oform.Items.Item("txtSDate")
starD = oitem.Specific
''''''''''end date
oitem = oform.Items.Item("txtEDate")
endD = oitem.Specific
''''''''''days in period
oitem = oform.Items.Item("txtDPrd")
daystext = oitem.Specific
'''''''''''' working days
oitem = oform.Items.Item("txtWDays")
worktext = oitem.Specific
''''''' notes''''''''''''
oitem = oform.Items.Item("txtNotes")
noteedittext = oitem.Specific
End Sub
Private Sub addmenuitems()
Dim oMenus As SAPbouiCOM.Menus ' the menus collection
Dim oMenuitem As SAPbouiCOM.MenuItem ' the new item
'get the menus collection from the application
oMenus = SBO_Application.Menus
Dim ocreationPackage As SAPbouiCOM.MenuCreationParams
ocreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
oMenuitem = SBO_Application.Menus.Item("2048") 'sales menu id
oMenus = oMenuitem.SubMenus
ocreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
ocreationPackage.UniqueID = "mnu1"
ocreationPackage.String = "Payperiod"
ocreationPackage.Enabled = True
ocreationPackage.Position = 15
Try
' if the menu already exist thus code will fail
oMenus.AddEx(ocreationPackage)
Catch ex As Exception ' menu already exist
MessageBox.Show("menu already exist")
End Try
End Sub
Private Sub SBO_Application_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.MenuEvent
If (pVal.MenuUID = "mnu1") And (pVal.BeforeAction = False) Then
Try
Dim f As SAPbouiCOM.Form
f = SBO_Application.Forms.Item("MPPeriod")
f.Select()
Catch ex As Exception
DrawForm()
End Try
End If
End Sub
Private Sub SBO_Application_StatusBarEvent(ByVal Text As String, ByVal MessageType As SAPbouiCOM.BoStatusBarMessageType) Handles SBO_Application.StatusBarEvent
If MessageType = SAPbouiCOM.BoStatusBarMessageType.smt_Error And AddStarted = True Then
RedFlag = True
End If
End Sub
Private Sub LoadFromXML(ByRef FileName As String)
Dim oXmlDoc As Xml.XmlDocument
oXmlDoc = New Xml.XmlDocument
'// load the content of the XML File
Dim sPath As String
sPath = IO.Directory.GetParent(Application.StartupPath).ToString
oXmlDoc.Load(sPath & "\" & FileName)
'// load the form to the SBO application in one batch
SBO_Application.LoadBatchActions(oXmlDoc.InnerXml)
End Sub
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
Dim oDocRec As SAPbobsCOM.Recordset
Dim f As SAPbouiCOM.Form
Dim s As String
' Events of the Blanket Agreement form
If (FormUID = "MPPeriod") Then
If (pVal.Before_Action = True) Then
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.ItemUID = "1" Then
Dim objRecser As SAPbobsCOM.Recordset
objRecser = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
' SBO_Application.MessageBox("hi")
' objRecser.DoQuery("INSERT INTO [@MastPayPeriod]( Code,Name,U_PayPeriodTypeCode, U_PayPeriodCode, U_StartDate, U_EndDate, U_DaysInPeriod, U_WorkingDays, U_Notes) VALUES (1,1,'" & oform.Items.Item("cmbppt").Specific.Value & "','" & oform.Items.Item("txtCode").Specific.Value & "',& '"oform.Items.Item("cmbSDate").Specific.Value & "','"& oform.Items.Item("cmbEDate").Specific.Value & "','" & oform.Items.Item("txtDPrd").Specific.Value & "','" & oform.Items.Item("txtWDays").Specific.Value & "','" & oform.Items.Item("txtNotes").Specific.Value & "')")
objRecser.DoQuery("INSERT INTO [@MastPayPeriod](Code,Name,U_PayPeriodTypeCode, U_PayPeriodCode, U_StartDate, U_EndDate, U_DaysInPeriod, U_WorkingDays, U_Notes) VALUES (1,1,'" & oform.Items.Item("cmbppt").Specific.Value & "','" & oform.Items.Item("cmbCode").Specific.Value & "','" & oform.Items.Item("txtSDate").Specific.Value & "','" & oform.Items.Item("txtEDate").Specific.Value & "','" & oform.Items.Item("txtDPrd").Specific.Value & "','" & oform.Items.Item("txtWDays").Specific.Value & "','" & oform.Items.Item("txtNotes").Specific.Value & "')")
End If
End If
If (pVal.Before_Action = False) Then
If (pVal.ItemUID = "2") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Then
End If
End If
End If
End Sub
'Private Sub SaveAsXML(ByRef Form As SAPbouiCOM.Form)
' Dim oXmlDoc As Xml.XmlDocument
' Dim sXmlString As String
' oXmlDoc = New Xml.XmlDocument
' // get the form as an XML string
' sXmlString = Form.GetAsXML
' // load the form's XML string to the XML document object
' oXmlDoc.LoadXml(sXmlString)
' Dim sPath As String
' sPath = IO.Directory.GetParent(Application.StartupPath).ToString
' // save the XML Document
' oXmlDoc.Save((sPath & "\PayPeriodMaster.xml"))
'End Sub
End Class -
Hello:
I was install oracle 8.0.5 under linux, the documentation talk
about you must
create objects in one session different of the initial oracle
installation.
I installed oracle successfully, but now when i try to create
objects in other
orainst session appear one error:
oraview... file_not_found.
What can i do?
nullJohn Sanabria (guest) wrote:
: Hello:
: I was install oracle 8.0.5 under linux, the documentation talk
: about you must
: create objects in one session different of the initial oracle
: installation.
: I installed oracle successfully, but now when i try to create
: objects in other
: orainst session appear one error:
: oraview... file_not_found.
: What can i do?
Don't quite get your point but the usual way to create data
objects is: log into the oracle as an ordinary user and then
create object using the usual commands such as :CREATE TABLE
.....blah blah. If I didn't quite catch your meaning can you
specify your question a bit concrete.
John
null -
Crystal Report Addon Error : ActiveX Component Can't Create Object
Hello Experts,
We are facing an problem when we start the Crystal Report Addon .The error message getting
displayed is "CR_Crypto ActiveX Component Can't Create Object".This issue is happening only on the
server its working fine on the client. We had even unistalled and re-installed the addon in the server but
still it throws the error when we start the addon.
Please help us to resolve this issue
Thanks,
VishwanathDear Friend,
I had described the problem to our technical support team, and they replied as follows u2013
They solved the Script related error by several stages.
They checked the machine for any mal-ware existence by the tool provided by Microsoft (MS Mal-ware remover).
Then they tried by installing the following patches from Microsoft u2013
http://support.microsoft.com/kb/949140
Windows Script 5.7 for Windows XP
http://www.microsoft.com/downloads/details.aspx?familyid=887fce82-e3f5-4289-a5e3-6cbb818623aa&displaylang=en
Windows Script 5.6 for Windows Server 2003
http://www.microsoft.com/downloads/details.aspx?FamilyId=C717D943-7E4B-4622-86EB-95A22B832CAA&displaylang=en
Windows Script 5.6 for Windows XP and Windows 2000
The internal matter to this problem was about the following DLL and its version u2013
C:\WINDOWS\system32
vbscript.dll
5.5.0.8820
Desired
5.6.0.8820
Check, if the information helps you. -
How can I importing when create object?
Hi Gurus,
Im beginner with OO Abap. Please give me a hand with this.
Im using the programming interface REPORT Z_TEST_ST_TEXT_EDITOR for text editor found on /people/igor.barbaric/blog/2005/06/06/the-standard-text-editor-oo-abap-cfw-class which is good and useful for me (highly recommended) but I need to import the text created (t_text) in method constructor in order to send it via e.mail.
Could anybody tell me how to get/import the text created?
Thank you in advance.
Below is the coding. (program which uses the developed class and method consisting the created text)
DATA: o_txe TYPE REF TO <b>zcl_standard_text_editor</b>,
v_caption TYPE char100,
s_thead TYPE thead.
call screen
CALL SCREEN 0100.
MODULE s0100_start
MODULE s0100_start OUTPUT.
SET PF-STATUS 'BASIC'.
s_thead-tdname = 'VENDOR0000000011'.
s_thead-tdid = 'ST'.
s_thead-tdobject = 'TEXT'.
s_thead-tdspras = sy-langu.
CONCATENATE 'Standard text:' s_thead-tdname
INTO v_caption SEPARATED BY space.
IF o_txe IS INITIAL.
<b> CREATE OBJECT o_txe</b>
EXPORTING i_thead = s_thead
i_caption = v_caption.
<b>IMPORTING????</b>
ENDIF.
ENDMODULE.
<b>method CONSTRUCTOR</b>.
DATA: o_dialogbox TYPE REF TO cl_gui_dialogbox_container,
t_text TYPE STANDARD TABLE OF tdline,
s_event TYPE cntl_simple_event,
t_events TYPE cntl_simple_events,
t_lines TYPE STANDARD TABLE OF tline,
v_text TYPE tdline,
v_text_temp TYPE tdline,
v_line_temp TYPE tdline,
v_line_len TYPE i,
v_index TYPE i.
FIELD-SYMBOLS: <line> TYPE tline.
me->thead = i_thead.
me->caption = i_caption.
*------ containers
IF i_container IS INITIAL.
CREATE OBJECT o_dialogbox
EXPORTING top = 50
left = 200
height = 150
width = 500
caption = i_caption.
me->main_container = o_dialogbox.
SET HANDLER me->on_container_close FOR o_dialogbox.
ELSE.
me->main_container = i_container.
ENDIF.
IF me->splitter IS INITIAL.
CREATE OBJECT me->splitter
EXPORTING
parent = me->main_container
orientation = me->splitter->orientation_vertical
sash_position = 10. "percentage of containers
------ toolbar
CREATE OBJECT me->toolbar
EXPORTING parent = me->splitter->top_left_container.
CALL METHOD me->toolbar->add_button
EXPORTING fcode = me->c_save
is_disabled = ' '
icon = '@2L@' "icon_system_save
butn_type = cntb_btype_button.
CALL METHOD me->toolbar->add_button
EXPORTING fcode = me->c_close
is_disabled = ' '
icon = '@3X@' "icon_close
butn_type = cntb_btype_button.
*------ register events
REFRESH t_events.
s_event-eventid = cl_gui_toolbar=>m_id_function_selected.
s_event-appl_event = ' '.
APPEND s_event TO t_events.
CALL METHOD me->toolbar->set_registered_events
EXPORTING events = t_events.
SET HANDLER: me->on_toolbar_func_sel FOR me->toolbar.
*------ create textedit control
CREATE OBJECT me->textedit
EXPORTING parent = me->splitter->bottom_right_container.
ENDIF.
get text
CALL FUNCTION 'READ_TEXT'
EXPORTING ID = me->thead-tdid
LANGUAGE = me->thead-tdspras
NAME = me->thead-tdname
OBJECT = me->thead-tdobject
TABLES LINES = t_lines
EXCEPTIONS ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
*------- convert text to text editor format
LOOP AT t_lines ASSIGNING <line>.
IF <line>-tdformat = space OR <line>-tdformat = '=' OR sy-tabix = 1.
v_line_temp = <line>-tdline.
CONCATENATE v_text v_line_temp INTO v_text_temp.
ELSE.
CONCATENATE: cl_abap_char_utilities=>cr_lf <line>-tdline
INTO v_line_temp.
CONCATENATE v_text v_line_temp INTO v_text_temp.
ENDIF.
IF sy-subrc = 0.
v_text = v_text_temp.
ELSE.
APPEND v_text TO t_text.
v_text = v_line_temp.
ENDIF.
ENDLOOP.
IF sy-subrc = 0.
APPEND v_text TO <b>t_text</b>.
ENDIF.
*------- display text
CALL METHOD me->textedit->set_text_as_stream
EXPORTING text = t_text.
me->t_initial_text = t_text.
endmethod.good book on ABAP objects(OOPS)
http://www.esnips.com/doc/bc475662-82d6-4412-9083-28a7e7f1ce09/Abap-Objects---An-Introduction-To-Programming-Sap-Applications
http://www.sapgenie.com/abap/OO/
http://www.sapgenie.com/abap/OO/index.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
http://www.allsaplinks.com/
http://www.sap-img.com/
http://www.sapgenie.com/
http://help.sap.com
http://www.sapgenie.com/abap/OO/
http://www.sapgenie.com/abap/OO/index.htm
http://www.sapgenie.com/abap/controls/index.htm
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
http://www.sapgenie.com/abap/OO/index.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
http://www.sapgenie.com/abap/OO/
these links
http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
For funtion module to class
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
for classes
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
for methods
http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
for inheritance
http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
for interfaces
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
For Materials:
1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
1) http://www.erpgenie.com/sap/abap/OO/index.htm
2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
Rewards if useful......................
Minal -
runtime error 429, activeX component cant create object while using netbet pro
does anyone know what I could do to fix this problem??? netbet pro was't available for a while then it's back but has yet to runWhat's netbet pro?
I'd recommend asking questions about third party applications in the vendor's forum, not a Microsoft forum meant for admin scripting.
EDIT: Ah, some gambling website...
Don't retire TechNet! -
(Don't give up yet - 12,950+ strong and growing) -
ABAP OO: Duplication of selected data in created objects?
I am new to ABAP OO and I have a conceptual question/concern that I cannot resolve. Can someone explain what I am missing?
I would think that selecting and storing (in internal tables) a large amount of data from many related database tables and, at the same time, creating and storing objects from this same data would unnecessarily consume a huge amount of memory. To avoid this problem, it seems that the selected data and created objects should not be stored in internal tables simultaneously.
Does this concern make sense? If so, how is this problem best handled?
Does it make sense to delete the corresponding data once the objects are created (to free memory)?
Or does it make sense to keep the data and only temporarily create objects as needed?
Thanks.Hello Matt
The approach you describe is to select data first and the feed the object instances with them. <b>Why not let the object instances do the data selection themselves?</b>
I will give you an example what I mean.
(1) Lets assume I want to write an application that allows to deal with cost center hierarchies. On the selection screen you can choose one or many cost center hierarchies.
(2) Using the selection criteria I would select all cost center hierarchies but without any details (just the key values).
(3) Next I would loop over the cost center hierarchies and create a cost center hierarchy instance (a class you have to define yourself) for each key value. The CONSTRUCTOR of this class will have an IMPORTING parameter like <i>id_kostl_hier</i>.
(4) In the CONSTRUCTOR method I first check if the cost center hierarchy exists (if not raise an exception-class based exception) and then do the selection of the hierarchy details (e.g. the cost centers).
(5) The instances are collected in an itab of the "frame" application.
Using this approach you will have little duplication of data within your application. Furthermore, if you really have to deal with huge amounts of data then you could read them only on demand (like in tree controls where the sub-nodes usually are read when the parent node is expanded).
Hope I could give you some fresh insights into this exciting topic.
Regards
Uwe -
ABAP OBJECTS: Dynamic Create object
Hi folks!
I have a problem... I need to create a dynamic type object with:
<b>DATA: my_instance TYPE REF TO class1.
CREATE OBJECT my_instance TYPE (class2).</b>
<i>* where class1 is a superclass of class2.</i>
When I do:
<b>my_instance ?= m_parent.</b>
<i>* where m_parent is an instance of class1</i>
My problem is when I want to access to an attribute of the class2, the compiler says that it cannot find the attribute <i>(this is OK, because the attribute is only in the class2).</i>
My question:
Is there anyway to access to an atribute of second class when is not in the first class? (i don't want to create the attribute as an attribute of the first class).
Thanx!!!!Hi David,
When you do the debugging, you are dealing with run-time - i.e., the program is now running and you are just interrupting it at each statement to examine the program state. You will reach the point where the object is already created. That is why you can see all those attributes. But when you comiple, the program is not yet <i>running</i>, so the attributes will be unknown because of the dynamic type specification.
I think you will have to redesign the program logic. As i had already said in my earlier post, it is not proper to have the attributes specified statically while the class itself is specified dynamically.
Your situation is somewhat similar to -
DATA ITAB TYPE TABLE OF SPFLI.
PERFORM TEST TABLES ITAB.
FORM TEST TABLES ITAB.
LOOP AT ITAB.
WRITE: / ITAB-CARRID.
ENDLOOP.
ENDFORM.
Hope the point is clear.
Regards,
Anand Mandalika. -
Creating objects when count is greater than 1
Hi
I'm trying to create a runbook that checks service manager for incidents that have been created in the last 10 minutes of the same category. When the result of this check brings back more than 5 objects I want a problem to be created with the incidents linked
to the problem.
I know a junction will be required somewhere in order to stop the create object running multiple times but when this occurs I cannot address the scobject guids in the create relationship step. I have attached a screenshot of the runbook below.
ThanksHi,
Flatten the "Get Object Count" Activity so it triggers only once.
Regards,
Stefan
www.sc-orchestrator.eu ,
Blog sc-orchestrator.eu -
Yes, I want to create object-relational schema from DTD.
Thank you for reply~~
I want to create object-relational schema from DTD using object type or collections as mentioned.
In reply, it is impossible.
But, I read Oracle supports storing an XML document with object-relation. I executed storing sample, but I had to create schema manually.
Is it really impossible to create OR schema from DTD automatically?Yes. You need to create your database schema before insert XML data to it.
Maybe you are looking for
-
Error while creating instance of Document
Hi I am creating a java file , in which i m creating an instance of type Document. But it is givign the error "The type Document cannot be instantiated". anybody can please help? Regadrs, Anupreet
-
How can I include Java objects in a 'Database Export'?
I am running a 'Database Export' to produce a DDL script for all objects in the schema. I have some objects of type JAVA SOURCE and JAVA CLASS in my schema, but they are not included in the DDL script. Is there a way to get them included? Version is
-
my e-reader keeps formating on start up and I have to re-install all apps. When I put in overdrive, it asks for adobe sign in and now won't accept it. Does anyone know how to help me?
-
Python equivalent of Java 'setchar'
so a user can enter something from standard in and echo back *'s or nothing at all instead of printing to the screen their actuall input. Like entering your password when you login.
-
Stock transfer without billing using delivery
Hii. I have a requirement for transfer the materail from one plant to another withen the same plant using the sd route. i need to incorporate the cost of transportation in the materail cost, do i need to configure mm pricing procedure and assign it t