Error while usind Private Method of a global class
HI All..
I created a global class (ZLINE_GLOBAL) which has TOT_DATA private method. I have to call this private method in my report, I know that using Friend class we can do this.
But it is not working and showing the same error " METHOD "TOT_DATA" is unknown or Private or Public..
code i tried is
CLASS c2 DEFINITION DEFERRED.
CLASS ZLINE_GLOBAL DEFINITION FRIENDS c2.
PUBLIC SECTION.
METHODS : m1.
PRIVATE SECTION.
METHODS: m2.
ENDCLASS.
CLASS ZLINE_GLOBAL IMPLEMENTATION .
METHOD m1.
WRITE : 'Public Method C1'.
ENDMETHOD. "M1
METHOD m2.
WRITE : 'Private Method C1'.
ENDMETHOD.
ENDCLASS.
CLASS c2 DEFINITION FRIENDS ZLINE_GLOBAL. "my friends are here, allow them access to my (C2's) private components
PUBLIC SECTION.
METHODS :m3.
ENDCLASS.
CLASS c2 IMPLEMENTATION.
METHOD m3.
DATA : obj TYPE REF TO ZLINE_GLOBAL.
CREATE OBJECT obj.
CALL METHOD obj->TOT_DATA. "here Iam calling Private method of global class
ENDMETHOD. "M3
ENDCLASS.
START-OF-SELECTION.
DATA obj_c2 TYPE REF TO c2.
CREATE OBJECT obj_c2.
obj_c2->m3( ).
can anybody help me on this..
Murthy
Hi Murthy,
Replace TOT_DATA with M2, you do not have any method by name "TOT_DATA" in your code.
CLASS c2 DEFINITION DEFERRED.
CLASS ZLINE_GLOBAL DEFINITION FRIENDS c2.
PUBLIC SECTION.
METHODS : m1.
PRIVATE SECTION.
METHODS: m2.
ENDCLASS.
CLASS ZLINE_GLOBAL IMPLEMENTATION .
METHOD m1.
WRITE : 'Public Method C1'.
ENDMETHOD. "M1
METHOD m2.
WRITE : 'Private Method C1'.
ENDMETHOD.
ENDCLASS.
CLASS c2 DEFINITION FRIENDS ZLINE_GLOBAL. "my friends are here, allow them access to my (C2's) private components
PUBLIC SECTION.
METHODS :m3.
ENDCLASS.
CLASS c2 IMPLEMENTATION.
METHOD m3.
DATA : obj TYPE REF TO ZLINE_GLOBAL.
CREATE OBJECT obj.
CALL METHOD obj->M2. "here Iam calling Private method of global class
ENDMETHOD. "M3
ENDCLASS.
START-OF-SELECTION.
DATA obj_c2 TYPE REF TO c2.
CREATE OBJECT obj_c2.
obj_c2->m3( ).
Regards,
Chen
Similar Messages
-
Error while calling a method on Bean (EJB 3.0)
I am getting an error while calling a method on EJB. I am using EJB3.0 and my bean is getting properly deployed(i am sure b'cos i can see the successfullly deployed message). Can any body help me
Error is -->
Error while destroying resource :An I/O error has occured while flushing the output - Exception: java.io.IOException: An established connection was aborted by the software in your host machine
Stack Trace:
java.io.IOException: An established connection was aborted by the software in your host machine
at sun.nio.ch.SocketDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:33)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104)
at sun.nio.ch.IOUtil.write(IOUtil.java:75)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:302)
at com.sun.enterprise.server.ss.provider.ASOutputStream.write(ASOutputStream.java:138)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at org.postgresql.PG_Stream.flush(PG_Stream.java:352)
at org.postgresql.core.QueryExecutor.sendQuery(QueryExecutor.java:159)
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:70)
at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:482)
at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:461)
at org.postgresql.jdbc1.AbstractJdbc1Connection.rollback(AbstractJdbc1Connection.java:1031)
at org.postgresql.jdbc2.optional.PooledConnectionImpl$ConnectionHandler.invoke(PooledConnectionImpl.java:223)
at $Proxy34.close(Unknown Source)
at com.sun.gjc.spi.ManagedConnection.destroy(ManagedConnection.java:274)
at com.sun.enterprise.resource.LocalTxConnectorAllocator.destroyResource(LocalTxConnectorAllocator.java:103)
at com.sun.enterprise.resource.AbstractResourcePool.destroyResource(AbstractResourcePool.java:603)
at com.sun.enterprise.resource.AbstractResourcePool.resourceErrorOccurred(AbstractResourcePool.java:713)
at com.sun.enterprise.resource.PoolManagerImpl.putbackResourceToPool(PoolManagerImpl.java:424)
at com.sun.enterprise.resource.PoolManagerImpl.resourceClosed(PoolManagerImpl.java:393)
at com.sun.enterprise.resource.LocalTxConnectionEventListener.connectionClosed(LocalTxConnectionEventListener.java:69)
at com.sun.gjc.spi.ManagedConnection.connectionClosed(ManagedConnection.java:618)
at com.sun.gjc.spi.ConnectionHolder.close(ConnectionHolder.java:163)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.closeDatasourceConnection(DatabaseAccessor.java:379)
at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.closeConnection(DatasourceAccessor.java:367)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.closeConnection(DatabaseAccessor.java:402)
at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.afterJTSTransaction(DatasourceAccessor.java:100)
at oracle.toplink.essentials.threetier.ClientSession.afterTransaction(ClientSession.java:104)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.afterTransaction(UnitOfWorkImpl.java:1816)
at oracle.toplink.essentials.transaction.AbstractSynchronizationListener.afterCompletion(AbstractSynchronizationListener.java:161)
at oracle.toplink.essentials.transaction.JTASynchronizationListener.afterCompletion(JTASynchronizationListener.java:87)
at com.sun.ejb.containers.ContainerSynchronization.afterCompletion(ContainerSynchronization.java:174)
at com.sun.enterprise.distributedtx.J2EETransaction.commit(J2EETransaction.java:467)
at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:357)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3653)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3431)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:197)
at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:110)
at $Proxy84.addDepartment(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:121)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:650)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:193)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1705)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1565)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:947)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:178)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:717)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:473)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1270)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:479)
End of Stack Trace
|#]
RAR5035:Unexpected exception while destroying resource. To get exception stack, please change log level to FINE.
EJB5018: An exception was thrown during an ejb invocation on [DepartmentSessionBean]
javax.ejb.EJBException: Unable to complete container-managed transaction.; nested exception is: javax.transaction.SystemException
javax.transaction.SystemException
at com.sun.enterprise.distributedtx.J2EETransaction.commit(J2EETransaction.java:452)
at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:357)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3653)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3431)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:197)
at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:110)
at $Proxy84.addDepartment(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)Means theres an error in XML/ABAP conversion probably due a syntax error...
Regards
Juan -
Operation not found error while calling AM methods from managed bean
Hi,
operation not found error while calling AM methods from managed bean.
written a method with two parameters in AM.
exposed the method in AM client interface
in the page bindings added the method in method action ..left empty in the value fields of the parameters.
calling the method from managed bean like below
String userNameVal = (String)userName.getValue();
String passwordVal = (String)password.getValue();
OperationBinding operationBinding =
ADFUtils.findOperation("verifyLogin");
operationBinding.getParamsMap().put("userName",userNameVal);
operationBinding.getParamsMap().put("password",passwordVal);
operationBinding.execute();
i am getting operation verifyLogin not found error.Please suggest me something to do.
Thanks
SatyaHi vlsn,
Can you try with the below code
// in your backing bean
OperationBinding operation = bindings.getOperationBinding("verifyLogin");
//Put your both parameters here
operation.getParamsMap().put("parameter_name1", parameterValue1);
operation.getParamsMap().put("parameter_name2", parameterValue2);
operation.execute();
if (operation.getResult() != null) {
Boolean result = (Boolean) operation.getResult();
and share the result.
regards,
Rajan -
Error while invoking onHeartBeat() method, exception is "Cannot load header
I have a problem that when I read out an IMAP mailbox I sometimes get the above problem, and sometimes I don't get the problem.
Below I attached the main parts of my environment to get an insight within the code:
bpel.xml of process that is reading out the IMAP mailbox
<activationAgents>
<activationAgent className="com.collaxa.cube.activation.mail.MailActivationAgent"
heartBeatInterval="60">
<property name="accountName">account</property>
</activationAgent>
account.xml
<mailAccount xmlns="http://services.oracle.com/bpel/mail/account">
<userInfo>
<displayName>Eneco Process lAyer</displayName>
<organization>iFactory</organization>
<replyTo>[email protected]</replyTo>
</userInfo>
<outgoingServer>
<protocol>smtp</protocol>
<host>10.126.16.73</host>
<port>25</port>
<authenticationRequired>false</authenticationRequired>
</outgoingServer>
<incomingServer>
<protocol>imap</protocol>
<host>10.126.20.8</host>
<port>143</port>
<email>IFACAORTA</email>
<password>CRYPT{IB3B7SrA3kMYHoBDzWwsEg==}</password>
<folderName>InBox</folderName>
</incomingServer>
</mailAccount>
The domain.log of the appserver
<2006-12-04 15:08:25,546> <ERROR> <default.collaxa.cube.activation> <HeartBeatListenerJob::execute> Error while invoking onHeartBeat() method, exception is "Cannot load header".
<2006-12-04 15:08:25,562> <ERROR> <default.collaxa.cube.activation> <HeartBeatListenerJob::execute> Error while invoking onHeartBeat() method, exception is "No content".This problem is occuring only on BPEL release 10.1.3.
I retested this again on BPEL 10.1.2, but there the problem did not occur. -
Error while invoking onHeartBeat() method, exception is "Username supplied
hi ...
I am trying to invoke bpel process when we get email..
but i am getting the following error..
Error while invoking onHeartBeat() method, exception is "Username supplied in error".
<mailAccount xmlns="http://services.oracle.com/bpel/mail/account">
<userInfo>
<displayName>Oracle BPM</displayName>
<organization>xxx</organization>
<replyTo>bpel@localhost</replyTo>
</userInfo>
<outgoingServer>
<protocol>smtp</protocol>
<host>xxxxx</host>
<authenticationRequired>false</authenticationRequired>
</outgoingServer>
<incomingServer>
<protocol>pop3</protocol>
<host>xxxxx</host>
<port>143</port> -- tried with 110 prot also
<email>xxxx</email>
<password></password>
<folderName>Inbox</folderName>
<authenticationRequired>false</authenticationRequired>
</incomingServer>
</mailAccount>
Can any one help me on this ?
thanks,
bharathThis problem is occuring only on BPEL release 10.1.3.
I retested this again on BPEL 10.1.2, but there the problem did not occur. -
I am getting a error while using CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
The error is class "CL_SSF_XSF_UTILITIES is unknown. How to correct that?? please help I am new to object oriented programming??
Edited by: priya singh on Nov 18, 2008 2:14 PMThis is my code.
REPORT ZSAVE_FUNCTION .
D A T A D E C L A R A T I O N S *
DATA: v_bitmap TYPE xstring, "graphic data
v_file TYPE string, "file name
v_length TYPE i. "length of binary file
DATA: BEGIN OF it_bitmaps OCCURS 0,
object TYPE tdobjectgr, "object
name TYPE tdobname, "name
id TYPE tdidgr, "id
tdbtype TYPE tdbtype, "graphic type
END OF it_bitmaps.
DATA: itab TYPE TABLE OF x.
*class cl_ssf_xsf_utilities definition.
public section.
methods : get_bds_graphic_as_bmp
DATA: L_GRAPHIC_XSTR TYPE XSTRING.
*method cl_ssf_xsf_utilities
S E L E C T I O N - S C R E E N *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: p_object TYPE tdobjectgr, "object
p_btype TYPE tdbtype, "graphic type
p_name TYPE tdobname, "name
p_id TYPE tdidgr. "id
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
PARAMETERS: p_file TYPE rlgrap-filename. "file name
SELECTION-SCREEN END OF BLOCK b2.
*A T S E L E C T I O N - S C R E E N O N V A L U E - R E Q U E S T *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_name.
*-- Creating f4 help for the parameters
PERFORM get_f4_object_name.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
*-- Getting the current value entered
PERFORM get_current_value.
*-- Value Request Functionality For Input File Name
PERFORM f4_value_request.
S T A R T O F - S E L E C T I O N *
START-OF-SELECTION.
*--Getting the graphic as a BMP file
PERFORM get_graphic_bmp.
*--Convert the Xstring format to binary format
PERFORM convert_to_binary.
*--Download the graphic
PERFORM download_graphic.
*& Form get_current_value
Get the current file path entered
FORM get_current_value .
DATA: BEGIN OF li_dynp_value_tab OCCURS 0.
INCLUDE STRUCTURE dynpread.
DATA: END OF li_dynp_value_tab.
DATA: l_program_name LIKE d020s-prog,
l_dynpro_number LIKE d020s-dnum.
l_program_name = sy-cprog.
l_dynpro_number = sy-dynnr.
REFRESH li_dynp_value_tab.
li_dynp_value_tab-fieldname = 'P_FILE'.
APPEND li_dynp_value_tab.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = l_program_name
dynumb = l_dynpro_number
TABLES
dynpfields = li_dynp_value_tab
EXCEPTIONS
invalid_abapworkarea = 04
invalid_dynprofield = 08
invalid_dynproname = 12
invalid_dynpronummer = 16
invalid_request = 20
no_fielddescription = 24
undefind_error = 28.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
READ TABLE li_dynp_value_tab INDEX 1.
p_file = li_dynp_value_tab-fieldvalue.
ENDFORM. " get_current_value
*& Form f4_value_request
Provinding the f4 for the given path
FORM f4_value_request .
*-- if the file is to be downloaded to presentation server
CALL FUNCTION '/SAPDMC/LSM_F4_FRONTEND_FILE'
EXPORTING
pathname = p_file
CHANGING
pathfile = p_file
EXCEPTIONS
canceled_by_user = 1
system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " f4_value_request
*& Form GET_GRAPHIC_BMP
Get the graphic as a BMP file
FORM get_graphic_bmp.
CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
EXPORTING
p_object = p_object
p_name = p_name
p_id = p_id
p_btype = p_btype
RECEIVING
p_bmp = L_GRAPHIC_XSTR
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " GET_GRAPHIC_BMP
*& Form CONVERT_TO_BINARY
Converting the xstring to binary format
FORM convert_to_binary .
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = v_bitmap
IMPORTING
output_length = v_length
TABLES
binary_tab = itab.
ENDFORM. " CONVERT_TO_BINARY
*& Form DOWNLOAD_GRAPHIC
Download the graphic
FORM download_graphic .
v_file = p_file.
CONCATENATE p_file '.BMP' INTO v_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = v_length
filename = v_file
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " DOWNLOAD_GRAPHIC
*& Form GET_F4_OBJECT_NAME
Get F4 values for object names
FORM get_f4_object_name .
DATA: dynpfld_mapping TYPE STANDARD TABLE OF dselc WITH HEADER LINE,
return_tab TYPE STANDARD TABLE OF ddshretval WITH HEADER LINE.
*--Selecting the values to be provided as f4 help
SELECT tdobject
tdname
tdid
tdbtype
FROM stxbitmaps
INTO TABLE it_bitmaps.
*--To update the values in the remaining fields
dynpfld_mapping-fldname = 'F0001'.
dynpfld_mapping-dyfldname = 'P_OBJECT'.
APPEND dynpfld_mapping.
dynpfld_mapping-fldname = 'F0002'.
dynpfld_mapping-dyfldname = 'P_NAME'.
APPEND dynpfld_mapping.
dynpfld_mapping-fldname = 'F0003'.
dynpfld_mapping-dyfldname = 'P_ID'.
APPEND dynpfld_mapping.
dynpfld_mapping-fldname = 'F0004'.
dynpfld_mapping-dyfldname = 'P_BTYPE'.
APPEND dynpfld_mapping.
*--Providing f4 help with the selected values
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'TDOBNAME'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'P_NAME'
value_org = 'S'
TABLES
value_tab = it_bitmaps
dynpfld_mapping = dynpfld_mapping
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " GET_F4_OBJECT_NAME -
Passing internal table to a method of a Global Class
Hi All,
I have to pass a Select option (SO_RANGE) as a IMPORT parameter to a method of a global Class (while calling that method from a executable program).
what Reference type should I give, while defining the IMPORT parameter for that method of class.
SO_RANGE have structure of type (SIGN, OPTION, LOW and HIGH)
Regards,
Pankaj.You first need to define a type for range.
for that goto->public section of your class and put following under TYPES
TYPES : tr_matnr type range of mara-matnr .
now you can use this tr_matnr in global class to define input parameter and in your program to define a variable .
In your program define variable as
DATA data_mat TYPE Classname=>tr_matnr
To define workarea type use following.
TYPES : t_matnr TYPE LINE OF tr_matnr . -
How to access private method of an inner class using reflection.
Can somebody tell me that how can i access private method of an inner class using reflection.
There is a scenario like
class A
class B
private fun() {
now i want to use method fun() of an inner class inside third class i.e "class c".
Can i use reflection in someway to access this private method fun() in class c.I suppose for unit tests, there could be cases when you need to access private methods that you don't want your real code to access.
Reflection with inner classes can be tricky. I tried getting the constructor, but it kept failing until I saw that even though the default constructor is a no-arg, for inner classes that aren't static, apparently the constructor for the inner class itself takes an instance of the outer class as a param.
So here's what it looks like:
//list of inner classes, if any
Class[] classlist = A.class.getDeclaredClasses();
A outer = new A();
try {
for (int i =0; i < classlist.length; i++){
if (! classlist.getSimpleName().equals("B")){
//skip other classes
continue;
//this is what I mention above.
Constructor constr = classlist[i].getDeclaredConstructor(A.class);
constr.setAccessible(true);
Object inner = constr.newInstance(outer);
Method meth = classlist[i].getDeclaredMethod("testMethod");
meth.setAccessible(true);
//the actual method call
meth.invoke(inner);
} catch (Exception e) {
throw new RuntimeException(e);
Good luck, and if you find yourself relying on this too much, it might mean a code redesign. -
Getting error while using TRIM method in collections
Hi Experts,
While using TRIM method I am getting below error. Am I doing any mistake here ?
DB : Oracle 11g
SQL> declare
2
3 type emp_tab is table of employees%rowtype index by binary_integer;
4 l_emp_tab emp_tab;
5
6 begin
7
8 select * bulk collect into l_emp_tab from employees;
9 l_emp_tab.trim(5);
10 dbms_output.put_line(l_emp_tab.count);
11
12 end;
13 /
l_emp_tab.trim(5);
ERROR at line 9:
ORA-06550: line 9, column 2:
PLS-00306: wrong number or types of arguments in call to 'TRIM'
ORA-06550: line 9, column 2:
PL/SQL: Statement ignored
Thanks in advance for all your help.
Cheers,
SuriGerard, and to Unkonwn epxpert ;-)
Thanks for the reply. I am aware about extend method. But not sure about TRIM. Once again thanks for your help.
Cheers,
Suri -
Error while calling Proxy Method
Hi All,
I am trying to call aproxy method to send some information.
However it raises an exception...The details of the exception are as follows:
CX_SXML_PARSE_ERROR:Exception CX_SOAP_ROOT occurred (program: CL_SOAP_RUNTIME_ROOT==========CP, include: CL_SOAP_RUNTIME_ROOT==========CM004, line: 110)..Exception CX_SOAP_ROOT occurred (program: CL_SOAP_MESSAGE_NEW===========CP,include: CL_SOAP_MESSAGE_NEW===========CM00R, line: 39)..Error while parsing an XML stream: 'BOM / charset detection failed'.
Any idea of what could be the problem...
NOTE: I had generated the Proxy using the WSDL file...Hi Hanife,
My report using the client proxy failed with the error 'BOM / charset detection failed' while trying to pass string value to the generated variable.
I solved this issue by converting the string to an xstring either by function module SCMS_STRING_TO_XSTRING or xslt function call transformation ID
After that the proxy call was successful. Test if the webservice could deal with the result created by the proxy runtime have not been done yet.
Hope this helps.
Kind regards,
Jochen -
Hi,
I am facing an error which says "Invalid Key predicate"while running http method get via tcode /IWFND/MAINT_SERVICE.
The same works fine for sdata .The SICF nodes are active.But when the url has odata it does not seem to work as expected .This is the url I am trying to execute.
/sap/opu/odata/sap/QMLSINSPECTIONLOT/MATERIALDETAIL(MaterialNumber='1706',FROMDATE='20120303',TODATE='20120708')?$format=xml
(does not work -error invalid predicate)
/sap/opu/sdata/sap/QMLSINSPECTIONLOT/MATERIALDETAIL(MaterialNumber='1706',FROMDATE='20120303',TODATE='20120708')?$format=xml(works fine)
Could you help me with this error?
Regards,
AnnAnn,
FROMDATE is a date field? Then you need to specify while providing value.
Example: Check it here.
How to use OData Date filter query to filter data from OData NetWeaver Gateway Service?
Thanks
Krishna -
Compilation error while calling static method from another class
Hi,
I am new to Java Programming. I have written two class files Dummy1 and Dummy2.java in the same package Test.
In Dummy1.java I have declared a static final variable and a static method as you can see it below.
package Test;
import java.io.*;
public class Dummy1
public static final int var1= 10;
public static int varDisp(int var2)
return(var1+var2);
This is program is compiling fine.
I have called the static method varDisp from the class Dummy2 and it is as follows
package Test;
import java.io.*;
public class Dummy2
public int var3=15;
public int test=0;
test+=Dummy1.varDisp(var3);
and when i compile Dummy2.java, there is a compilation error <identifier > expected.
Please help me in this program.public class Dummy2
public int var3=15;
public int test=0;
test+=Dummy1.varDisp(var3);
}test+=Dummy1.varDisplay(var3);
must be in a method, it cannot just be out somewhere in the class! -
Getting error while creating abstract method
hi folks,
i facing issue for ABSTRACT Class.
I am trying to create abstarct method, (refered example from saptechnical site),
I created one attribute i-num, created one method AREA, in implementation area , i made it as Abstract, then i did syntax check, then it is giving below error.
*Class ZTEST_CLASS01_AB,Method AREA
The abstract method "AREA" can only be implemented after its
redefinition (METHODS AREA REDEFINITION).*
i tried all the ways..
created subclass for this, i writted some code in AREA of Sub-class, there it is giving dump, because first one is not activated properly..
could you please somebody help me on this.
SriHello Arshad,
Create a class(ZABSTRACT) and make its type as Abstract( Which means atleast one of its methods is abstract)
We can have abstract classes with all it's methods as non-abstract or concrete. A small example is given below:
CLASS gcl_abstract DEFINITION ABSTRACT.
PUBLIC SECTION.
METHODS concrete. "Concrete
ENDCLASS. "gcl_abstract DEFINITION
* CLASS gcl_abstract IMPLEMENTATION
CLASS gcl_abstract IMPLEMENTATION.
METHOD concrete.
WRITE: / `I'm a concrete method`.
ENDMETHOD. "concrete
ENDCLASS. "gcl_abstract IMPLEMENTATION
* CLASS gcl_abstract_sub DEFINITION
CLASS gcl_abstract_sub DEFINITION INHERITING FROM gcl_abstract.
PUBLIC SECTION.
METHODS concrete REDEFINITION.
ENDCLASS. "gcl_abstract_sub DEFINITION
* CLASS gcl_abstract_sub IMPLEMENTATION
CLASS gcl_abstract_sub IMPLEMENTATION.
METHOD concrete.
super->concrete( ).
WRITE: / 'Abstract class might not have abstract methods at all!'.
ENDMETHOD. "concrete
ENDCLASS. "gcl_abstract_sub IMPLEMENTATION
START-OF-SELECTION.
DATA: go_abstract TYPE REF TO gcl_abstract_sub.
CREATE OBJECT go_abstract.
go_abstract->concrete( ).
Although i will agree there is no point in making a class as abstract & having no abstract method
@Sri: Looks like you're trying to implement the abstract method "AREA" in the abstract class hence the error. For abstract method you cannot define their implementation in the corres. abstract class.
BR,
Suhas
Edited by: Suhas Saha on Mar 30, 2011 12:04 PM -
Calling Instance Method in a Global Class
Hi All,
Please can you tell me how to call a instance method created in a global class in different program.
This is the code which I have written,
data: g_cl type ref to <global class>.
call method g_cl -> <method name>
I am not able to create Create object <object>.
It is throwing the error message " Instance class cannot be called outside...."
Please can anybody help me..
*Text deleted by moderator*
Thanks
SushmithaHi susmitha,
1.
data: g_cl type ref to <global class>.
2.
Create object <object>.
3.
call method g_cl -> <method name>.
if still you are getting error.
then first check that method level and visibility in se24.
1.if level is static you can not call it threw object.
2. if visibility is protected or private then you can not call it directly.
If still you are facing same problem please paste the in this thread so that i can help you better.
Regards.
Punit
Edited by: Punit Singh on Nov 3, 2008 11:54 AM -
Getting error while Creating a JDBC connection from Java Class
Hi,
I am getting the exception pasted below:
Exception in thread "main" java.lang.AbstractMethodError
at JvMakeVTable(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
at JvPrepareClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
at JvWaitForState(java.lang.Class, int) (/usr/lib/libgcj.so.5.0.0)
at java.lang.VMClassLoader.linkClass0(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.5.0.0)
at oracle.jdbc.driver.OracleStatement.executeQuery(java.lang.String) (Unknown Source)
at oracle.jdbc.dbaccess.DBAccess.setNlsParamsClient(oracle.jdbc.driver.OracleConnection) (Unknown Source)
at oracle.jdbc.ttc7.TTC7Protocol.initNls(oracle.jdbc.driver.OracleConnection) (Unknown Source)
at oracle.jdbc.driver.OracleConnection.OracleConnection(oracle.jdbc.dbaccess.DBAccess, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.util.Properties) (Unknown Source)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.util.Properties) (Unknown Source)
at oracle.jdbc.driver.OracleDriver.connect(java.lang.String, java.util.Properties) (Unknown Source)
at java.sql.DriverManager.getConnection(java.lang.String, java.util.Properties) (/usr/lib/libgcj.so.5.0.0)
at java.sql.DriverManager.getConnection(java.lang.String, java.lang.String, java.lang.String) (/usr/lib/libgcj.so.5.0.0)
The code raising this error is :
try
Class.forName("oracle.jdbc.driver.OracleDriver");
catch (Exception Exp)
System.out.println("Error while getting the class : "+Exp);
try
String url = "jdbc:oracle:thin:@hostname:port:SID";
String user = "apps";
String password = "password";
con = DriverManager.getConnection(url,user,password);
catch (Exception ex)
System.err.println("SQLException: " + ex.getMessage());
Any help in this is appreciated.
Regards
JujaarWhy do you have the Class.forName() in a separate try-catch block than the DriverManager.getConnection()?
Try placing everything in the same try-catch block to see if that resolves your problem.
You may also want to try using an OracleDataSource.
OracleDataSource ods = new OracleDataSource();
String url = "jdbc:oracle:thin:@//hostname:port/SID",
ods.setURL(url);
ods.setUser("apps");
ods.setPassword("password");
Connection conn = ods.getConnection();
Refer to http://st-doc.us.oracle.com/11/111/java.111/b31224/getsta.htm#i1008334 for details on how to connect to the database using a Data Source.
Maybe you are looking for
-
Email at the time of PO creation
Hi , I have a requirement in Purchase order where if net value (at header level) exceeds the certain amount, an email should trigger to the specified email address. Can any one tell me UE/BADI or enhancement point .The only concern I have is , if any
-
Ipad 2 Wont Be Recognized On Itunes
I just won an Ipad 2. After a couple of days I open it, already had Itunes. So I plug in after I set it up and it didn't get spotted by itunes. The pop up for opening the folder to pictures was there. I tryed rebooting the Ipad and the Machine, I als
-
"Macintosh HD could not be repaired"... Do I need a new hard drive?
So my macbook pro when I turn it on goes straight to the apple screen like normal, then it just sits there and loads forever. I then booted it with the Disk Utility and tried Verifying and Repairing the disk (I selected my hard drive). The repair cou
-
Here are list of steps which result in my problem, which occurs programatically as well as in the vc++ resource editor. 1) Create a top gauge meter with a range of 0 to 10. 2) Add a pointer that is invisible, set the fill colour to blue and fill va
-
Guys I found all metrics upload for my targets have stopped upload for no obvious reason, then've been working fine for quite a long time. In the "All metrics" page, it always appears to be like this: Metrics Thresholds Collection Schedule Up