How to call OBJECTS
Hi all,
i am using SAP 4.7 version. I am unable to call the following objects .
CREATE OBJECT LOGO_CONTAINER
CREATE OBJECT LOGO.
CALL METHOD LOGO->LOAD_PICTURE_FROM_URL
How to call these objects ?
Thanks in advance
krupali
Hi,
This is the sample program helpful to u.
CLASS counter DEFINITION.
PUBLIC SECTION.
METHODS: set IMPORTING value(set_value) TYPE i,
increment,
get EXPORTING value(get_value) TYPE i.
PRIVATE SECTION.
DATA count TYPE i.
ENDCLASS.
CLASS counter IMPLEMENTATION.
METHOD set.
count = set_value.
ENDMETHOD.
METHOD increment.
ADD 1 TO count.
ENDMETHOD.
METHOD get.
get_value = count.
ENDMETHOD.
ENDCLASS.
DATA: cnt_1 TYPE REF TO counter,
cnt_2 TYPE REF TO counter,
cnt_3 TYPE REF TO counter,
cnt_tab TYPE TABLE OF REF TO counter.
DATA number TYPE i.
START-OF-SELECTION.
CREATE OBJECT: cnt_1,
cnt_2.
MOVE cnt_2 TO cnt_3.
CLEAR cnt_2.
cnt_3 = cnt_1.
CLEAR cnt_3.
APPEND cnt_1 TO cnt_tab.
CREATE OBJECT: cnt_2,
cnt_3.
APPEND: cnt_2 TO cnt_tab,
cnt_3 TO cnt_tab.
CALL METHOD cnt_1->set EXPORTING set_value = 1.
CALL METHOD cnt_2->set EXPORTING set_value = 10.
CALL METHOD cnt_3->set EXPORTING set_value = 100.
DO 3 TIMES.
CALL METHOD: cnt_1->increment,
cnt_2->increment,
cnt_3->increment.
ENDDO.
LOOP AT cnt_tab INTO cnt_1.
CALL METHOD cnt_1->get IMPORTING get_value = number.
WRITE / number.
ENDLOOP.
Regards,
Narasimha
Similar Messages
-
How to call object method (eg, CallIntMethod)in C?
I aslo get problem when I use "CallIntMehtod", the following is my program
test.java
public class test {
public int getvalue(int n)
System.out.println("cjf, welcome");
return n*n;
invoke.c
#include <jni.h>
int main() {
int res;
JavaVM *jvm;
JNIEnv *env;
JavaVMInitArgs vm_args;
JavaVMOption options[3];
jclass cls;
jmethodID mid;
vm_args.version = JNI_VERSION_1_2;
vm_args.nOptions = 3;
// vm_args.options = options;
vm_args.ignoreUnrecognized = JNI_TRUE;
res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args); /* create VM */
if (res < 0) {
fprintf(stderr, "Can't create Java VM\n");
exit(1);
printf("success create java VM \n");
cls = (*env)->FindClass(env, "test");/* find class */
if ( cls != (jclass)0 ) {
mid = (*env)->GetMethodID( env, cls, "getvalue", "(I)I" );/* get method ID */
if( mid != 0 ){
printf("First call to Java returns:%d\n", (*env)->CallIntMethod(env, cls, mid,2) );/* execute
method */
(*jvm)->DestroyJavaVM(jvm);/* destroy java VM */
fprintf(stdout, "Java VM destory.\n");
return 0;
when I compiled them and run it, I cann't get the expected result. the result is:
nspws1@/home/bss>./invoke
success create java VM
First call to Java returns:0
Java VM destory.
so ,what' wrong?Your method "getvalue" is not static.
You have to create an object of your class "test" and call the method with this object (not with the class) as parameter: CallIntMethod(env, obj, mid,2). -
How to call a COM object from an Oracle Form?
Hi All,
Pls advice. How to call a COM object from an Oracle Form?
Thanks.try asking the "Form" forum
-
How to call a CORBA Object in a 3rd Party ORB from a EJB
Hello
I found a few articles on the web how to call EJBs for example from C++.
However, I want to do the inverse. I want to resolve an Object (implemented in C++, using OmniORB) via COS-Naming and invoke it from a EJB. I can write a simple Java Client which does this without a problem. But as soon as I try to do the same in EJB I get the following:
[#|2004-11-09T10:48:16.848+0100|WARNING|sun-appserver-pe8.0.0_01|javax.enterprise.resource.corba._DEFAULT_.rpc.transport|_ThreadID=12;|"IOP00710209: (INTERNAL) Unable to create listener thread on the specific port"
org.omg.CORBA.INTERNAL: vmcid: SUN minor code: 209 completed: No
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.createListenerFailed(ORBUtilSystemException.java:3142)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.createListenerFailed(ORBUtilSystemException.java:3160)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryAcceptorImpl.initialize(SocketFactoryAcceptorImpl.java:60)
at com.sun.corba.ee.impl.transport.CorbaTransportManagerImpl.getAcceptors(CorbaTransportManagerImpl.java:190)
at com.sun.corba.ee.impl.transport.CorbaTransportManagerImpl.addToIORTemplate(CorbaTransportManagerImpl.java:207)
at com.sun.corba.ee.spi.oa.ObjectAdapterBase.initializeTemplate(ObjectAdapterBase.java:104)
I think there is somehow a conflict because the SUN Appserver also uses CORBA. My Code looks like this:
String[] a = null;
Properties props = new Properties();
final String CORBA_HOST = "arcos";
final String ORB_INITIAL_PORT = "2809";
props.put("org.omg.CORBA.ORBInitialPort", ORB_INITIAL_PORT);
props.put("org.omg.CORBA.ORBInitialHost", CORBA_HOST);
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(a, props);
So I thought this might be because there is already a ORB initialised. So I replaced the last line with
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
Which should give me an ORB instance. However I get the following exception:
[#|2004-11-09T11:51:59.206+0100|WARNING|sun-appserver-pe8.0.0_01|javax.enterprise.system.stream.err|_ThreadID=15;|
org.omg.CORBA.NO_IMPLEMENT: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.genericNoImpl(ORBUtilSystemException.java:7085)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.genericNoImpl(ORBUtilSystemException.java:7107)
at com.sun.corba.ee.impl.orb.ORBSingleton.resolve_initial_references(ORBSingleton.java:311)
at com.ascom.util.CorbaNaming.resolve(CorbaNaming.java:26)
at com.ascom.fxm.FileManager.<init>(FileManager.java:46)
at com.ascom.srv.file.web.FileImporterImpl.importFile(FileImporterImpl.java:146)
Any ideas? Thank you very much in advance.
Oliver JaunPerhaps you could take a look at the following document and see if it meets your needs:
http://java.sun.com/j2se/1.4.2/docs/guide/rmi-iiop/interop.html -
How to call GOS(Generic Object service) attachment ( BMP file ) into SAP
How to call GOS(Generic Object service) attachment ( BMP file ) into SAP script
Example: MM02 Service object there attaching the bmp file the same file i need to call script based on the material number
Please provide the procedure and coding.
Thanks in advance
RajuHi,
The following link may be useful to u.
help.sap.com/printdocu/.../BCSRVOBS.pdf -
How to call a Oracle Proc,which contains Object Type as in Param, from java
Hi
Would like to know how to call a Oracle Procedure which contains the Object Type Parameter from java.
Here is my code will look like...
1. CREATE OR REPLACE TYPE emp AS OBJECT
Empno NUMBER,
Ename VARCHAR2(50)
[COLOR=royalblue]In step1 I have created object type.[COLOR]
2.CREATE OR REPLACE PACKAGE ref_pkg IS
TYPE tab_emp IS TABLE OF emp;
END ref_pkg;
[COLOR=royalblue]In step2,I have created a table type which is of type emp;[COLOR]
3. CREATE OR REPLACE PROCEDURE p_emp(p_emptab IN ref_pkg.tab_emp) as
BEGIN
FOR I IN 1..p_emptab.COUNT
LOOP
Some code written here
END LOOP;
END;
[COLOR=royalblue]In step3 I have passed tabletype which is of type emp as argument.[COLOR]
Now I need to invoke this procedure from JAVA.
Calling a procedure doesn�t matter.
But how I can map objecttype ? how will java recognize oracle object ?
How can I implement this ?
Any Help/Clues is Appreciated.
Thanks
KrishnaHi Bob
You can call a stored proc from a database control with the jc:sql annotation itself.
Assume a stored proc taking one In parameter
* @jc:sql statement="call sp_updateData({id})"
void call_sp_updateCust(int id);
You can even call stored proc with OUT parameters using
* @jc:sql statement="{call sp_MyProc(?, ?)}"
void call_sp_MyProc(SQLParameter[] params)
You can also call stored functions via db control.
More info and diff ways to call at
http://e-docs.bea.com/workshop/docs81/doc/en/workshop/guide/controls/database/conStoredProcedures.html
Thanks
Vimala -
How to get caller object reference from a method
Hi,
I am working a already existing Java Swing project, now I got a problem, in a method I need to get the caller object reference otherwise, I can't succeed this operation. So please tell me a way how to get the caller object reference from a method. that method would be static or regular method anything will do for me.
Edited by: navaneeth.j on Jan 29, 2010 11:20 PMnavaneeth.j wrote:
Actually my doubt is, I have a method "addition" method, which is using by many classes so my requirement is in the addition method I want to write a code snippet which will identify and get the the caller object. Actually I tried Reflection.getcallerclass but there I am getting "CLASS" object not the actual object reference, but I want object reference.
Actually we have a huge project which is writen plain JAVA, so in this project the authors written the Database connection package for single database transaction. so now we are using this project source code for JSF application in this web application the DB package has serve based on the dynamic db connection parameters, so if we want to change this package fully means need to solve the dependency problem in hundreds of classes, so my point is if I can access the caller object in the DB package when ever it gets called by any class from any where of the project. So actually I liked Reflection.getcallerclass, the way of implementation perfectly works for me but it is not giving caller object reference, if something gives the caller object then I can get the DB connection parameters then there is no need to pass the parameters in the hierarchy.You can add a parameter (of type Object) to your addition() method
and everywhere you call the addition() method also pass this (which from the POW of the addition() method will be a reference to the calling class instance).
There may be alternative solutions
but none that require less effort. -
How to call a function having OBJECT type as Return type
Hi,
I've the following function returning OBJECT type.
Pease advice me how to call this function
CREATE OR REPLACE TYPE GET_EMP_OBJ is object
( emp_name varchar2(50) ,
mgr_id number,
dept_id number
CREATE OR REPLACE FUNCTION get_emp(P_emp_no NUMBER )
RETURN GET_EMP_OBJ IS
t_emp_info GET_EMP_OBJ ;
v_ename EMP.ename%TYPE;
v_mgr EMP.mgr%TYPE ;
v_deptno EMP.deptno%TYPE;
v_ename1 EMP.ename%TYPE;
v_mgr1 EMP.mgr%TYPE ;
v_deptno1 EMP.deptno%TYPE;
BEGIN
FOR rec IN ( SELECT ename , mgr , deptno
FROM emp )
LOOP
v_ename := rec.ename ;
v_ename1 := v_ename1||'|'||v_ename ;
v_mgr := rec.mgr ;
v_mgr1 := v_mgr1||'|'||v_mgr ;
v_deptno:= rec.deptno;
v_deptno1 := v_deptno1||'|'||v_deptno ;
END LOOP ;
t_emp_info := GET_EMP_OBJ (v_ename,v_mgr,v_deptno ) ;
RETURN t_emp_info ;
EXCEPTION WHEN OTHERS THEN
DBMS_OUTPUT.put_line ('Error'||SQLCODE||','||SQLERRM ) ;
END;The above function got created successfully.
And i'm confused how to call this functions. I tried like below but didn't work
DECLARE
t_emp_info_1 GET_EMP_OBJ ;
BEGIN
t_emp_info_1 := get_emp(7566) ;
for i in 1..t_emp_info_1.COUNT
LOOP
DBMS_OUTPUT.put_line ('Values are'||i.emp_name ) ;
END LOOP;
END;SQL> CREATE OR REPLACE TYPE GET_EMP_OBJ is object
2 ( emp_name varchar2(50) ,
3 mgr_id number,
4 dept_id number
5 );
6 /
Type created.
SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE FUNCTION get_emp(empno NUMBER )
2 RETURN GET_EMP_OBJ IS
3 t_emp_info GET_EMP_OBJ ;
4 BEGIN
5 begin
6 select get_emp_obj(ename, mgr, deptno) into t_emp_info
7 from emp
8 where empno = get_emp.empno;
9 exception
10 when no_data_found then
11 t_emp_info := new get_emp_obj(null,null,null);
12 end;
13 return t_emp_info;
14* END;
SQL> /
Function created.
SQL> set serverout on
SQL>
SQL> declare
2 t_emp_info GET_EMP_OBJ ;
3 BEGIN
4 t_emp_info := get_emp(7566);
5 DBMS_OUTPUT.put_line ('Values are: '||t_emp_info.emp_name||', '||t_emp_info.mgr_id||', '||t_emp_info.dept_id);
6 END;
7 /
Values are: JONES, 7839, 20
PL/SQL procedure successfully completed.
SQL> -
How to call the method of a Business Object?
Hi,
Can someone guide me how to call the method of a business object?
For example, I want to use the method SalesDocument.Copy of the Business Object VBAK. How can I do that? If you are familiar with any similar scenario please help.
Regards,
Renjith Michael.Hi
double click on the copy and
go to abap tab
there u can get functionmodule name
u can call that
Rewards if helpful -
How to call a Derived call fucntion with a base class object ?
Hi all
i am working on a JNI interface to Java, and in the process of simulating a C++ behaviour in java
so i need some help form you people, in this regard.
here is a c++ code, i need a equivalent fucntionality in java , to put it one word, the question is
how to implement the dynamic_cast functionality in java, as java also has virtual fucntions, i think
this should be possible, if it is not, what is the alternative
class Base
public:
Base()
~Base()
virtual void F1()
cout<<"The BASE::F1() is called"<<endl;
virtual void F2()
cout<<"The BASE::F2() is called"<<endl;
class Derived : public Base
public:
Derived()
~Derived()
virtual void F3()
cout<<"The Derived::F3() is called"<<endl;
virtual void F4()
cout<<"The Derived::F4() is called"<<endl;
Base * GetDerived()
return new Derived();
int _tmain(int argc, _TCHAR* argv[])
Base *ptr = NULL;
ptr = GetDerived();
Derived *dPtr = dynamic_cast<Derived *>(ptr);
dPtr->F3();
}regards
pradishJust to clarify a point that I consider important--the distinction between references and objects:
Your subject is: How to call a Derived call fucntion with a base class object ? The answer to that is: You cannot. It is completely impossible in Java. If you have a base class object, the derivced class' methods are not present. On the other hand, if you have a compile-time reference of the parent type, but at runtime it happens to point to an instance of the derived class, then, as pointed out, you can cast the reference. (Note that casting does not apply to objects.) -
How can i get caller object by MethodEntryEvent
Hi ,
I have problem that I want to get the caller object when the program call any method. I use com.sun.jdi.MethodEntryEvent to catch the calling event but I don't know how to get the caller.
thanks for any answers.I use
com.sun.jdi.MethodEntryEvent to catch the calling
event but I don't know how to get the caller. You have to go from the MethodEntryEvent to the Thread
and from the Thread to the active stack frame on that
thread. Then you can query the stack frame for 'this',
or for other information.
Given:
com.sun.jdi.event.MethodEntryEvent mee;
then the following will return the ObjectReference
of 'this' for the current frame:
mee.thread().frame(0).thisObject();
References:
MethodEntryEvent:
http://java.sun.com/j2se/1.4.2/docs/guide/jpda/jdi/com/sun/jdi/event/MethodEntryEvent.html
LocatableEvent
http://java.sun.com/j2se/1.4.2/docs/guide/jpda/jdi/com/sun/jdi/event/LocatableEvent.html
ThreadReference:
http://java.sun.com/j2se/1.4.2/docs/guide/jpda/jdi/com/sun/jdi/ThreadReference.html
StackFrame:
http://java.sun.com/j2se/1.4.2/docs/guide/jpda/jdi/com/sun/jdi/StackFrame.html -
How to call a method in one JSP from another JSP?
say that I have 2 JSPs.
JSP one has a button.
JSP two has some method that, say, find the square root of the number passed from JPS one.
How to - when click - the button on page one call the method on page two?
Please note that I can not use object binding, but I want passing the actual parameter and call the method on page two.
Please note that this is an update of a previous post on the same topic called "Object scope".
Thank you all very much.No, i dont know how to call other than main methods from other classes
And one more doubt i have i.e. Like in C can we see the execution of the program like how the code is being compiled step by step and how the value of the variable changes from step to step like(Add Watch)......... -
How to call a WD4A Application of another system
Hi,
I have the need to call a WebDynpro Application of another system via a URL call, thet the application should be opend in the CRM WebUI Window (statefull ) .
Calling the application via a button event & transaction launcher works fine, but i need to call it from a BSP page. So my idea was to create an iframe, but this obviously opens a new window:
<html>
<head>
<title>IFrames - Webdynpro Test</title>
</head>
<body>
<iframe src=<%= lv_url_route %>"
width="100%" height="500" scrolling="auto" frameborder="1" transparency>
</iframe>
</body>
<html>
Can anybody help?!?!
Thanx & best regards,
Oliver
Edited by: Oliver Pregler on Jul 28, 2008 3:26 PMHi Oliver,
unfortunately I know nothing about BSP-Applications, but this is how I call my WD4A-Application using a FM from CRM:
data: lr_empty_parent type ref to cl_gui_container,
lr_viewer type ref to cl_gui_html_viewer.
data: lv_url(200) type c.
lv_url = 'http://www.xyz.com'.
create object lr_viewer
exporting
parent = lr_empty_parent
exceptions
cntl_error = 1
cntl_install_error = 2
dp_install_error = 3
dp_error = 4
others = 5.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
lr_viewer->detach_url_in_browser(
exporting
url = lv_url
exceptions
cntl_error = 1
dp_error_general = 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.
cl_gui_cfw=>flush( ).
If it helps you - fine. If not - forget it
Best regards
Jörg Racz -
How to call LSMW from a Report program
Hi,
I have a requirment of extending vendor master data (Companycode data and Purchasing Organization data ) through Tcode XK02 using LSMW.Also I need to generate an error log file for validating the data from flat file and must have an export option of the error log file.
Can you help me how to proceed on this in steps.
Also pls let me know how to call LSMW transaction through a Report.
Based on the selection criteria I need to maintain two source structues,one for companycode data and the other for Purchasing Orgnization data for uploading data thru LSMW.How to do this?
pls respond ASAP,
Thanks,
NagendraHi,
create 2 LSMW object (under same project and subproject)..
one for extended vendor master data for company code data and other for extended purchase organization data for company code data.
Now check the radio buttons and based on that populate ur LSMW object.
Store project
project = < >.
Store subproject
subproj = < >.
Store object
object = '6GSC022_TS3'.
if r_ccode = 'X'.
Store object
object = < >.
else.
Store object
object = < >.
endif.
Call the function module to display object (LSMW) maintenance screen
CALL FUNCTION '/SAPDMC/LSM_OBJ_STARTER'
EXPORTING
project = project
subproj = subproj
object = object
EXCEPTIONS
no_such_object = 1
OTHERS = 2.
Generating error log:
After the checking the field if u think for this u need to generate error message then In the Maintain Field Mapping and Conversion Rules option under the required field write the following code:
data: v_msgtxt(100) type c.
message <msg ID> <message type> <message no>
with <var1> <var2>
into v_msgtxt.
write v_msgtxt.
Follow the next step in LSMW object till you reach the option Convert Data.
After you execute this option you will get the desired message here.
Regards,
Joy. -
How to call a labview dll from excel-VBA?
How to call a simple Labview DLL from Excel VBA?
I have seen examples of DLL calls from VB but does it work the same way for VBA? I have 2000 excel and Labview 8.5. I created the DLL and tried to call it from VBA using the same type of code as in NI's website example(ofcourse its a bit diff with 8.5)
http://zone.ni.com/devzone/cda/tut/p/id/...
BUT it errors out when called from excel
ERROR: The object invoked has disconnected from its clientYou would need to provide more details about the LabVIEW DLL, such as the prototypes of the functions (VIs) that you're trying to call, and your actual VBA code. Specifically, what object you're trying to create. You should also make sure the Run-Time Enginer is installed, as well as any required libraries such as the VISA Run-Time if you're using VISA. Have you made sure to enable the ActiveX server for the DLL?
A search yielded the following items that you may wish to peruse:
http://forums.ni.com/ni/board/message?board.id=170&message.id=261345&requireLogin=False
http://forums.ni.com/ni/board/message?board.id=170&message.id=45099&requireLogin=False
http://forums.ni.com/ni/board/message?board.id=170&message.id=299209&requireLogin=False
http://forums.ni.com/ni/board/message?board.id=170&message.id=195846&requireLogin=False
Maybe you are looking for
-
Crystal Reports Job Server - Default destinations not available
Greetings, Currently I'm installing Crystal Reports XI onto a new server. When scheduling reports they are stuck in a 'pending' status which records the following error in the windows event log: Transport System exception for backend plugin DLL type
-
Adobe flex 3 training from the source, code download
I've got this book here adobe flex 3 training from the source but we've lost the cd's, can I download the code?
-
PS CS6 - Left Click Mouse Button Way Too Touchy
I'm looking for a solution to an annoying problem with Photoshop CS6. Here's the problem: When holding down the left mouse button in the scroll bar area for just a fraction of a second too long, the scroll bar moves several positions. In the past, it
-
Missing Render files, won't play, General Error message
I have Final Cut Pro 5.0.4 on my Mac 1.8 Ghz Power PC G5, using Mac OS 10.4.10. I just opened a Final Cut Pro project and got a message that several render files were offline. No idea how that happened, and I couldn't find them to reconnect. Now, whe
-
I get this error 4280 when burning
then it cancels my disc and i dont know whats wrong. help please! cd diagnostics Microsoft Windows XP Home Edition Service Pack 2 (Build 2600) INTEL_ D945GNT_ iTunes 7.0.1.8 CD Driver 2.0.6.0 CD Driver DLL 2.0.6.0 UpperFilters: NTIDrvr (1.0.0.5), GEA