Calling a mething

how to call a method in a program is there any way like pattern to call a function module.

Yes,
Use Pattern button and select ABAP object Pattern....
Then fill in the correponding fields for your needs
ie:
Instance          lo_sender
Class/Interface   IF_PURCHASE_ORDER_ITEM_MM
Method            CREATE_ACCOUNT
Thats all
Dont forget to reward!!!
Gabriel P-

Similar Messages

  • CALL METHOD ABAP run SQL wrong

    Dear All
             I have a problem in ABAP connect SQL,Below is my code snippet sentence.
    CONCATENATE 'Insert Into [timportcortrol]'
                    '(zucode,zstate,zdate,zkind) Values('''
                      VG_PCID ''','''
                      '1'','''
                      SY-DATUM ''','''
                      '1' ''')'
                     INTO SQL.
        CALL METHOD OF REC 'Execute'
         EXPORTING #1 = SQL
         #2 = CON
         #3 = '1'.
    IF NOT SY-SUBRC = 0.
        MESSAGE I000 WITH 'Download  to [timportcortrol] failure,Please Check the SQL Connect!!! '.
        EXIT.
      ENDIF.
    Con:is the connect SQL String ,the connect SQL is Okay.
    I debug this code,when I used u2018Select u2026sentenceu2019,the program can work.if I  use u2018insert intou2019 then canu2019t work,but I copied the SQL of the u2018inset Into sentenceu2026u2019run it into SQL server then it can work also.
    And I found the SY-SUBRC eq u20182u2019.whatu2019s mean about of the sy-subrc eq u20182u2019.
    I think the insert into sentence in abap I have write the wrong ,but I canu2019t assurance.
    The Insert Into Sentence is:u2019 Insert Into [timportcortrol](zucode,zstate,zdate,zkind) Values('20080807094713','1','20080807','1')u2019
    Could you give me some advice for this issue?
    Thanks of all
    Sun.

    Have you checked whether it's a problem with mixed case?  Some SQL dialects are case sensitive.
    The not very helpful meanings of the sy-subrc value can be found in ABAP help.
    0 Successful processing of the method meth.
    1 Communication Error to SAP GUI.
    2 Error when calling method meth.
    3 Error when setting a property.
    4 Error when reading a property
    matt

  • ABAP OOP / Calling Method  ...Help

    Trying out few oop codes....
    While calling class instance methods and passing parameters, when to use the following syntax.
    data: cvar  type ref to class1.
             cvar->method( exporting variable1 = value )
           (or) some time i see sample codes with out key  word 'exporting'
                  cvar->method(  variable1 = value  ) .
           (or)
                  cvar->method(  value  ) .
           (or) some times with key word CALL  METHOD
       CREATE OBJECT cvar
       CALL METHOD cvar->method
       EXPORTING
       variable1 = value. 
    Tried out a uniform way of calling ,but getting errors.Any inputs please..
    Thanks,
    Bvan

    Bhavan,
      First  declare the class.
      Implement the class.
    Declare the Class reference variable
    Create the class object.
    call the method.
      data: cvar type ref to class1.
              CREATE OBJECT cvar
    Calling Methods
    To call a method, use the following statement:
    CALL METHOD <meth> EXPORTING... <ii> =.<f i>...
                       IMPORTING... <ei> =.<g i>...
                       CHANGING ... <ci> =.<f i>...
                       RECEIVING         r = h
                       EXCEPTIONS... <ei> = rc i...
    The way in which you address the method <method> depends on the method itself and from where you are calling it. Within the implementation part of a class, you can call the methods of the same class directly using their name <meth>.
    CALL METHOD <meth>...
    Outside the class, the visibility of the method depends on whether you can call it at all. Visible instance methods can be called from outside the class using
    CALL METHOD <ref>-><meth>...
    where <ref> is a reference variable whose value points to an instance of the class. Visible instance methods can be called from outside the class using
    CALL METHOD <class>=><meth>...
    where <class> is the name of the relevant class.
    When you call a method, you must pass all non-optional input parameters using the EXPORTING or CHANGING addition in the CALL METHOD statement. You can (but do not have to) import the output parameters into your program using the IMPORTING or RECEIVING addition. Equally, you can (but do not have to) handle any exceptions triggered by the exceptions using the EXCEPTIONS addition. However, this is recommended.
    You pass and receive values to and from methods in the same way as with function modules, that is, with the syntax:
    ... <Formal parameter> = <Actual parameter>
    after the corresponding addition. The interface parameters (formal parameters) are always on the left-hand side of the equals sign. The actual parameters are always on the right. The equals sign is not an assignment operator in this context; it merely serves to assign program variables to the interface parameters of the method.
    If the interface of a method consists only of a single IMPORTING parameter, you can use the following shortened form of the method call:
    CALL METHOD <method>( f).
    The actual parameter <f> is passed to the input parameters of the method.
    If the interface of a method consists only of IMPORTING parameters, you can use the following shortened form of the method call:
    CALL METHOD <method>(....<ii> =.<f i>...).
    Each actual parameter <f i > is passed to the corresponding formal parameter <i i >.
    Pls. mark if useful

  • Example program for returninng and importing with value addition

    HI ,
    I want few example programs on how to use the abap oops with returning addition and importing with value addition as Im getting syntax error for the Program when Im declaring them with these additions
    Thnaks .

    Hello,
    This statement declares a general instance method meth. Use additions ABSTRACT and FINAL to make the method abstract or final.
    The additions IMPORTING, EXPORTING and CHANGING define the parameter interface of the method. After every addition, the corresponding formal parameters are defined by a specification of the list parameters.
    The other additions determine which exceptions the method can propagate or trigger and determine whether the method is abstract or final.
    Note
    Within a method, you can use the logical expression IS SUPPLIED to check whether an actual parameter was assigned to an optional formal parameter at the call.
    Addition 1
    ... IMPORTING parameters PREFERRED PARAMETER p
    Effect
    IMPORTING defines input parameters. When calling the method, you need not specify an appropriate actual parameter for every non-optional input parameter. During the call, the content of the actual parameter is passed to the input parameter. The content of the input parameter - for which the reference transfer is defined - cannot be changed in the method.
    Use PREFERRED PARAMETER to identify an input parameter p1 p2 ... of list parameters after IMPORTING as a preferred parameter. This specification makes sense only if all input parameters are optional. When calling the method with the syntax
    CALL METHOD meth( a ).
    the actual parameter a is assigned to the preferred parameter if you have appropriate use of a functional method at an operand position.
    Addition 2
    ... EXPORTING parameters
    Effect
    EXPORTING defines output parameters. When calling the method, you can specify an appropriate actual parameter for every output parameter. The content of the output parameter - which is defined for value transfer - is passed to the actual parameter at the call after the method has been completed successfully.
    Note
    An output parameter that is defined for the reference transfer is not initialized when the method is called. Therefore, no read access to it should take place before the first write access.
    Addition 3
    ... CHANGING parameters
    Effect
    CHANGING defines input/output parameters. When calling the method, you must specify an appropriate actual parameter for every non-optional input/output parameter. The content of the actual parameter is passed to the input/output parameter at the call, and after the method has been completed, the content of the input/output parameter is passed to the actual parameter.
    Example
    The method read_spfli_into_table of this example has an input and an output parameter, which are typed fully by reference to the ABAP Dictionary.
    CLASS flights DEFINITION.
      PUBLIC SECTION.
        METHODS read_spfli_into_table
           IMPORTING VALUE(id)  TYPE spfli-carrid
           EXPORTING flight_tab TYPE spfli_tab.
    ENDCLASS.
    Addition 4
    ... RAISING exc1 exc2 ...
    Effect
    Use addition RAISING to declare the class-based exceptions exc1 exc2 ... that can be propagated from the method to the caller.
    For exc1 exc2 ..., you can specify all exception classes that are visible at this position and are subclasses of CX_STATIC_CHECK or CX_DYNAMIC_CHECK. You must specify the exception classes in ascending order corresponding to their inheritance hierarchy.
    Exceptions of the categories CX_STATIC_CHECK and CX_DYNAMIC_CHECK must be declared explicitly, otherwise a propagation results in a violation of the interface. An interface violation results in a treatable exception CX_SY_NO_HANDLER. Exceptions of category CX_NO_CHECK are always implicitly declared.
    Notes
    The declaration of exceptions of category CX_STATIC_CHECK is checked statically at the syntax check. For exceptions of category CX_DYNAMIC_CHECK, the check is executed at runtime.
    In a method in which class-based exceptions are declared with the addition RAISING, you cannot use the statement CATCH SYSTEM-EXCEPTIONS. Instead, handle the relevant treatable exceptions in a TRY control structure.
    Example
    In class math, you can propagate all exceptions represented by class CX_SY_ARITHMETIC_ERROR and its subclasses from within method divide_1_by. If, for example, the input parameter operand is filled at the call with the value 0, then the exception CX_SY_ZERODIVIDE is triggered, propagated, and can, as shown in the example, be handled by the caller in a TRY control structure.
    CLASS math DEFINITION.
      PUBLIC SECTION.
        METHODS divide_1_by
           IMPORTING operand TYPE I
           EXPORTING result  TYPE f
           RAISING   cx_sy_arithmetic_error.
    ENDCLASS.
    CLASS math IMPLEMENTATION.
      METHOD divide_1_by.
        result = 1 / operand.
      ENDMETHOD.
    ENDCLASS.
    START-OF-SELECTION.
    DATA oref TYPE REF TO math.
    DATA exc  TYPE REF TO cx_sy_arithmetic_error.
    DATA res  TYPE f.
    DATA text TYPE string.
    CREATE OBJECT oref.
    TRY.
        oref->divide_1_by( EXPORTING operand = 4
                           IMPORTING result = res ).
        text = res.
      CATCH cx_sy_arithmetic_error INTO exc.
        text = exc->get_text( ).
    ENDTRY.
    MESSAGE text TYPE 'I'.
    Addition 5
    ... EXCEPTIONS exc1 exc2 ...
    Effect
    Use addition EXCEPTIONS to define a list of non-class-based exceptions exc1 exc2..., which can be triggered with the statements RAISE or MESSAGE RAISING in the method. You specify identifiers exc1 exc2 ... for the exceptions to be defined at will and directly. Exceptions defined in this way are bound to the method - similar to formal parameters - and cannot be propagated.
    If such an exception is triggered in a method and no return value has been assigned to it in the addition EXCEPTIONS of the CALL METHOD statement in the method call, then a runtime error occurs.
    Note
    The additions RAISING and EXCEPTIONS cannot be used simultaneously. For new developments starting at release 6.10, we recommend to use class-based exceptions, which are independent of the respective method.
    Example
    In the class math, for method divide_1_by an exception arith_error is defined, which is triggered in the method with the RAISE statement if an arithmetic error occurs. If, for example, the input parameter operand is filled with value 0 at the call, the exception arith_error is triggered in the method-internal handling of exception CX_SY_ZERODIVIDE and handled after the call of the method by evaluating sy-subrc.
    CLASS math DEFINITION.
      PUBLIC SECTION.
        METHODS divide_1_by
           IMPORTING  operand TYPE I
           EXPORTING  result  TYPE f
           EXCEPTIONS arith_error.
    ENDCLASS.
    CLASS math IMPLEMENTATION.
      METHOD divide_1_by.
        TRY.
            result = 1 / operand.
          CATCH cx_sy_arithmetic_error.
            RAISE arith_error.
        ENDTRY.
      ENDMETHOD.
    ENDCLASS.
    START-OF-SELECTION.
    DATA res  TYPE f.
    DATA oref TYPE REF TO math.
    CREATE OBJECT oref.
    oref->divide_1_by( EXPORTING  operand = 4
                       IMPORTING  result  = res
                       EXCEPTIONS arith_error = 4 ).
    IF sy-subrc = 0.
      WRITE res.
    ELSE.
      WRITE 'Arithmetic error!'.
    ENDIF.
    Regards.

  • Inheritance related question

    class a{
         public void meth()
              System.out.println("In a");
    class b extends a{
         public void meth()
              System.out.println("In b");
    public class Test extends b{
         public static void main(String[]a)
    }can i call the a's meth() from Test without creating an instance of a? This might be a simple question and i think i cant create it, but if this is possible please tell me how to do it. also im not referring to runtime polymorphism. without using runtime polymorphism, can i access a's meth()? i know by calling super.meth() in b's meth() will solve it but i do not want to go that way.
    Thanks in advance,
    Geet

    meth is not a static method of the class a, so you can't really call it without instantiating class a.
    If you meant "can I call method meth in class a with an instance of class b?",(note that an instance of b is an instance of a) the answer is no as well, because your method from class b has overridden it... Note that you CAN call the method from class a from within class b (but not from Test), by using the keyword super.

  • Pass the internal table with different structures to the class module

    Hi ,
    I have created a class method to fill up the data in XML format. the method can be called from various programs with internal table with different structures. I want to pass it as dynamic How can I do that.
    I tried to declare that as type any.
    but not working.
    regards,
    Madhuri

    Hi,
    You could work with data reference.
    Use GET REFERENCE OF itab INTO data_ref for passing the internal table to your method, and dereference it within the method with ASSIGN statement...
    DATA: lr_data TYPE REF TO data.
    GET REFERENCE OF itab INTO lr_data.
    CALL METHOD meth EXPORTING pr_data = lr_data.
    METHOD meth.
      FIELD-SYMBOLS <fs> TYPE ANY TABLE
      ASSIGN pr_data->* TO <fs>.
    ENDMETHOD.
    Kr,
    Manu.

  • ICCMP_BT_FOUP - How to call meth. 'DO_HANDLE_EVENT other Component/View?

    Dear Experts,
    when changing the field CONC_KEY-BTN in view BTSHeader in component ICCMP_BTSHEAD (Interaction Record Component)
    the method DO_HANDLE_EVENT of the view controller is called.
    The standard coding of the method is:
    method DO_HANDLE_EVENT.
    * Eventhandler dispatching
        CASE htmlb_event_ex->event_server_name.
          WHEN others.
            global_event = super->do_handle_event( event           = event
                                                   htmlb_event     = htmlb_event
                                                   htmlb_event_ex  = htmlb_event_ex
                                                   global_messages = global_messages ).
        ENDCASE.
    endmethod.
    The component ICCMP_BTSHEAD is used in component ICCMP_BT_INR. Also visible in component ICCMP_BT_INR is the component ICCMP_BT_FOUP (View:CREATEFOLLOWUP) used to create Follow-Up Documents like Service Tickets.
    What I want to is that, if the value of the field CONC_KEY-BTN is '1', the fields of the view CREATEFOLLOWUP follow-up-document have to be not modifiable. If the value of field CONC_KEY-BTN is '2' the fields are modifiable and it is possible to create a Follow-Up Document. That is my basic requierement. Better would be if the view CREATEFOLLOWUP would not visible if the value of the field CONC_KEY-BTN is '1'. But that would be more difficult I think?
    To make the fields not modifiable, I think I have to modify the Get and Set Methods of the specific Atributes. But my problem is how can I modify the above mentioned method 'DO_HANDLE_EVENT' (View: BTSHeader) so that the event 'DO_HANDLE_EVENT' of the view controller of view CREATEFOLLOWUP is called at the same time (The problem is that the 'DO_HANDLE_METHOD of view CREATEFOLLOWUP is not called when changing the field CONC_KEY-BTN of the view BTSHeader ).
    Best Regards
    Oliver

    Hi Oliver,
    In my opinion, the logic is not to be controlled at the do_handle_event level. ICCMP_BT_FOUP is created as a component usage right? So  in the component ICCMP_BT_INR, there will be a navigation link defined with source as outbound plug of  ICCMP_BT_INR and  target as inbound plug of  ICCMP_BT_FOUP. In this outbound plug, you can fill the param IV_DATA_COLLECTION as follows:
    data: lr_current type ref to if_bol_bo_property_access,
                        lr_col      type ref to if_bol_bo_col.
      lr_current = me->typed_context->YOUR CONTEXT NODE->collection_wrapper->get_current( ).
      check lr_current is bound.
      create object lr_col
        type
          cl_crm_bol_bo_col.
      check lr_col is bound.
      lr_col->add( lr_current ).
    Now pass this collection to the target inbound plug.
    In the inbound plug of the target, you can control the logic based on the value of the attribute field in the collection.
    I think this should work.
    Regards,
    Nisha

  • How to take back the control from RFC function module to calling program

    Hi,
    In our system landscape, more than 200 child systems are connected to Solution manager(SMP). I have copied a RFC enabled function module into all the child systems and calling that FM from Sol Man in sychronous mode.
    Here goes my code in SolMan.
    LOOP AT it_dest INTO wa_dest.
      CALL FUNCTION 'Z_GET_LOGIN_DETAILS' DESTINATION wa_dest-rfcdest
        EXPORTING
          date_fr               = s_date-low
          date_to               = s_date-high
        TABLES
          tab_data              = it_val
        EXCEPTIONS
          communication_failure = 1
          system_failure        = 2
          OTHERS                = 3.
      IF sy-subrc EQ 0.
    *     Updates zuserlogon
          MODIFY zt_logon_det FROM TABLE it_val.
          COMMIT WORK.
          WRITE:/'RFC for Destination', wa_dest-rfcdest, 'succesfully updated.'.
      ELSE.
          WRITE:/'RFC for Destination', wa_dest-rfcdest, ' failed.'.
      ENDIF.
    ENDLOOP.
    Few child systems are very slow & takes more than 20 minutes(Many of the times system hangs) to return the result. But I should not wait for so long. Even if the child system doesn't return any values in 5 minutes I shoud continue with other system ignoring the current one.
    I tried calling the FM in asynchronous mode(STARTING NEW TASK) but no success because only 6 DIA processes possible but as I said I have more than 200 systems connected to SolMan.
    Please help me resolving this problem.
    Thanks,
    Prathap

    If there are only few child systems with bad response time, use asynchronous call using a CALL FUNCTION func STARTING NEW TASK task DESTINATION dest PERFORMING subr or CALLING meth ON END OF TASK. Count asynchronous calls still running/waiting (increment a counter when creating a task (not the one used for task id). In the form/method performed at end of a call decrement the counter. When counter is lower than a limit, 4-5 if 6 processes (*), perform an asynchronous call else perform a synchronous call or wait until the counter falls below the limit.
    Regards,
    Raymond
    (*) Use SPBT_INITIALIZE at start of program to get actual number of free/available processes.

  • I am having problem with me Iphone4, looks like the mic of my phone is not working. no one can hear me if I make a call to them

    Can any one please help me I am having problem with me Iphone4, looks like the mic of my phone is not working. no one can hear me if I make a call to them. I have tried all restoring options but no use. please help me

    The mic on my iPhone4 has just quit also. Similar symptoms to yours in that people I'm talking to hear only static or my voice very faintly. The voice/memo recorder also only really records static.
    It happened suddenly and seemed to get better after a day or two but then went completely after another day.
    I'm returning it to Vodafone New Zealand shortly but will have to wait 5-10 days for a replacement. There are NO Apple accredited means to speed this procedure up in NZ.
    We don't even have a single physical Apple Store where you could walk in and talk to a Genius.

  • How to differentiate which is exporting and importing parameters when calling dynamically using CL_ABAP_OBJECTDESCR

    Hello All,
    First of all sorry for posting the question in general abap queries, since somehow I am not able to post in ABAP objects discussions.
    My requirement is
    Step 1 :  To get table name as input  and dynamically derive all fields which is going to be passed as parameters for a method
    I did this using  cl_abap_typedescr class
    Step 2:  Then Pass the values into the relevant fields using below code
    ptab_line-name = 'DATA_TAB'.
    ptab_line-kind =
    cl_abap_objectdescr=>changing.
    GET REFERENCE OF text_tab INTO
    ptab_line-value.
    INSERT ptab_line INTO TABLE ptab.
    Step 3:  Later I am calling dynamic class like
        CALL METHOD (class)=>(meth)
          PARAMETER-TABLE
            ptab
          EXCEPTION-TABLE
            etab.
    I have read most of the post using Class cl_abap_typedescr=>describe_by_name to get parameter where I have to give correct parameter type.
    But my issue is that I also need to know which fields are acting as importing , exporting and changing parameter.
    Is there anyway to determine and pass method's paramter type as well ?
    Thanks!
    Regards,
    Ramya

    Might be I can use table view VSEOMEPARA

  • Using a dynamic variable in the Import command of a Method call

    Hi,
    I am trying to make a Method call fully dynamic.
    I have found out how to make the Method name dynamic, but I am having trouble figuring out how to make the Importing statement dynamic.
    in my code below:
          CALL METHOD o_main->(v_call)
            IMPORTING
              it_ekko = i_ekko.
    I would like to know if it's possible to make both "it_ekko" AND "i_ekko" dynamic so I can use this same call for various tables.
    Hope that makes sense...thanks for your help.
    Andy

    Hi Andrew,
    The method call is fully dynamic; not only the parameters can be specified dynamically but also the method name.
    This is a help extract:
    DATA: line     TYPE c LENGTH 80,
          text_tab LIKE STANDARD TABLE OF line,
          filename TYPE string,
          filetype TYPE c LENGTH 10,
          fleng    TYPE i.
    DATA: meth  TYPE string,
          class TYPE string,
          ptab TYPE abap_parmbind_tab,
          ptab_line TYPE abap_parmbind,
          etab TYPE abap_excpbind_tab,
          etab_line TYPE abap_excpbind.
    DATA: exc_ref TYPE REF TO cx_sy_dyn_call_error,
          exc_text TYPE string.
    class    = 'CL_GUI_FRONTEND_SERVICES'.
    meth     = 'GUI_DOWNLOAD'.
    filename = 'c:\temp\text.txt'.
    filetype = 'ASC'.
    ptab_line-name = 'FILENAME'.
    ptab_line-kind = cl_abap_objectdescr=>exporting.
    GET REFERENCE OF filename INTO ptab_line-value.
    INSERT ptab_line INTO TABLE ptab.
    ptab_line-name = 'FILETYPE'.
    ptab_line-kind = cl_abap_objectdescr=>exporting.
    GET REFERENCE OF filetype INTO ptab_line-value.
    INSERT ptab_line INTO TABLE ptab.
    ptab_line-name = 'DATA_TAB'.
    ptab_line-kind = cl_abap_objectdescr=>changing.
    GET REFERENCE OF text_tab INTO ptab_line-value.
    INSERT ptab_line INTO TABLE ptab.
    ptab_line-name = 'FILELENGTH'.
    ptab_line-kind = cl_abap_objectdescr=>importing.
    GET REFERENCE OF fleng INTO ptab_line-value.
    INSERT ptab_line INTO TABLE ptab.
    etab_line-name = 'OTHERS'.
    etab_line-value = 4.
    INSERT etab_line INTO TABLE etab.
    TRY.
        CALL METHOD (class)=>(meth)
          PARAMETER-TABLE
            ptab
          EXCEPTION-TABLE
            etab.
        CASE sy-subrc.
          WHEN 1.
        ENDCASE.
      CATCH cx_sy_dyn_call_error INTO exc_ref.
        exc_text = exc_ref->get_text( ).
        MESSAGE exc_text TYPE 'I'.
    ENDTRY.
    BR,
    Valentin

  • Using reflector to call a method on an objectRef

    hey all! i have the following code to call a function to the objectRef that i keep in an array (jobServers) ...
    //   jobServers[0].objServerRef.addService(theCallbackObjectRef, number, jobServers);
               Class c = Class.forName("WorkflowFramework.Job");
               System.out.println(jobServers[0].functionName);
               Method meth = c.getMethod(jobServers[0].functionName);
               meth.invoke(jobServers[0].objServerRef, theCallbackObjectRef, number, jobServers);
    but i get the following error :
    addService
    FileClient Error: WorkflowFramework.Job.addService()
    java.lang.NoSuchMethodException: WorkflowFramework.Job.addService()
    at java.lang.Class.getMethod(Unknown Source)
    at Client.main(Client.java:123)
    in the first line i print the name of the function (addService) that i want to be called, and it is correct. Then i see that the function is called on the WorkflowFramework.Job and not on the jobServers[0].objServerRef which is an object of instanse Job.
    The addService function exists there because the declaration that is now in commends is running just fine if i take out the commends..
    Do you think the problem lies in the fact that Job is actually an interface declared like :
    //the job interface to enable client to choose services.
    public interface Job extends JobOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity
    } // interface Job
    the addService function is declared in the JobOperations...
    any help plzzz?

    well.. you are kind of right...
    i write them as a struct in the IDL and the it is
    automatically transformed in the following java Class
    public final class lineArrayServers implements
    org.omg.CORBA.portable.IDLEntity
    public WorkflowFramework.Job objServerRef = null;
    public String functionName = null;
    public lineArrayServers ()
    } // ctor
    public lineArrayServers (WorkflowFramework.Job
    _objServerRef, String _functionName)
    objServerRef = _objServerRef;
    functionName = _functionName;
    } // ctorand then i wrap it in an array of these.. the
    jobServers...aha. so struct is an IDL construct in this case. I've never written any IDL, but I have written 'C', hence the confusion!
    thanks

  • Using reflector to call a method on the servant

    hey all! i have the following code to run a function to the objectRef that i keep in an array (jobServers) ...
    //   jobServers[0].objServerRef.addService(theCallbackObjectRef, number, jobServers);
               Class c = Class.forName("WorkflowFramework.Job");
               System.out.println(jobServers[0].functionName);
               Method meth = c.getMethod(jobServers[0].functionName);
               meth.invoke(jobServers[0].objServerRef, theCallbackObjectRef, number, jobServers);but i get the following error :
    addService
    FileClient Error: WorkflowFramework.Job.addService()
    java.lang.NoSuchMethodException: WorkflowFramework.Job.addService()
    at java.lang.Class.getMethod(Unknown Source)
    at Client.main(Client.java:123)
    in the first line i print the name of the function (addService) that i want to be called, and it is correct. Then i see that the function is called on the WorkflowFramework.Job and not on the jobServers[0].objServerRef which is an object of instanse Job.
    The addService function exists there because the declaration that is now in commends is running just fine if i take out the commends..
    Do you think the problem lies in the fact that Job is actually an interface declared like :
    //the job interface to enable client to choose services.
    public interface Job extends JobOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity
    } // interface Job
    the addService function is declared in the JobOperations...
    any help plzzz?

    when i copy/paste that code in here i realised that..but i thought that it wanted the type of the class so it could make any sense to me to declare it as an array ...
    anw i changed the declaration to
    Class[] paramTypes = { WorkflowFramework.TheCallbackInterface.class, int.class , WorkflowFramework.JobPackage.lineArrayServers[].class};
         but i get a "wrong number of arguments " now...
    FileClient Error: wrong number of arguments
    java.lang.IllegalArgumentException: wrong number of arguments
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at Client.main(Client.java:167)
    how is this possible?!?!?!?

  • Calling methods from Command prompt

    Hi,
    OK this may seem crazy:).
    Is it possible to call a method from the command prompt directly?.
    For eg. I have a class UFOSeeker that has a static method getPosinSky.
    Is it possible to just call this method directly form the cmd prompt?, something like this
    [neo@zeno ~]java UFOSeeker.getPosinSky()
    The . is wrong i know, but is there a way?.
    Reason for asking this, just bored and wondering whether this would be possible?.
    TIA,
    kris

    You could do it via another class and use reflection.
    For example:
    public class CallStaticMethod
        public static void main(String[] args)
            String className = args[0].substring(0, args[0].lastIndexOf('.'));
            String methodName = args[0].substring(args[0].lastIndexOf('.')+1, args[0].indexOf('('));
            try
                Class clazz = Class.forName(className);
                Method meth = clazz.getMethod(methodName, new Class[0]);
                meth.invoke(null, new Object[0]);
            catch ( Exception e )
                e.printStackTrace();
    }You would then run:
    java CallStaticMethod package.Class.method()
    or in your example
    java CallStaticMethod UFOSeeker.getPosinSky()
    The code above does not do anything about passing in parameters or getting return types. If you are really bored you could add it in.

  • "invalid request" when calling Apache Soap 2.2 webservice using 8.1.1

    I have tried setting soap-style to RPC as advised in the documentation but keep
    getting this same error. Server is Apache Soap 2.2. Another test client using
    Apache Soap 2.3.1 got the same error. I am trying to call a webservice in a WLI
    process flow. I have generated the web service control from the wsdl. Error follows:
    <01-Oct-2003 11:04:04 o'clock EST> <Warning> <WLW> <000000> <Id=bank_so_11; Meth
    od=processes.bank_so_1.GetNextAccountNumber(); Failure=com.bea.control.ServiceCo
    ntrolException: SOAP-ENV:Clientinvalid request>
    <01-Oct-2003 11:04:04 o'clock EST> <Warning> <WLW> <000000> <Id=top-level; Metho
    d=processes.TestWSBank_wf.$__clientRequest(); Failure=com.bea.wli.bpm.runtime.Un
    handledProcessException: Unhandled process exception [ServiceException]>
    <01-Oct-2003 11:04:04 o'clock EST> <Error> <WLW> <000000> <Failure=com.bea.wli.b
    pm.runtime.UnhandledProcessException: Unhandled process exception [ServiceExcept
    ion]>

    Hi Jerry,
    There is not much to go on here to help solve your problem. Can you
    successfully invoke the external service from Workshop's Test View? If
    this works OK you might ask your question to the integration newsgroup
    and see if they have some insight:
    http://newsgroups.bea.com/cgi-bin/dnewsweb?cmd=xover&group=weblogic.developer.interest.integration
    Hope this helps,
    Bruce
    Jerry Shea wrote:
    >
    I have tried setting soap-style to RPC as advised in the documentation but keep
    getting this same error. Server is Apache Soap 2.2. Another test client using
    Apache Soap 2.3.1 got the same error. I am trying to call a webservice in a WLI
    process flow. I have generated the web service control from the wsdl. Error follows:
    <01-Oct-2003 11:04:04 o'clock EST> <Warning> <WLW> <000000> <Id=bank_so_11; Meth
    od=processes.bank_so_1.GetNextAccountNumber(); Failure=com.bea.control.ServiceCo
    ntrolException: SOAP-ENV:Clientinvalid request>
    <01-Oct-2003 11:04:04 o'clock EST> <Warning> <WLW> <000000> <Id=top-level; Metho
    d=processes.TestWSBank_wf.$__clientRequest(); Failure=com.bea.wli.bpm.runtime.Un
    handledProcessException: Unhandled process exception [ServiceException]>
    <01-Oct-2003 11:04:04 o'clock EST> <Error> <WLW> <000000> <Failure=com.bea.wli.b
    pm.runtime.UnhandledProcessException: Unhandled process exception [ServiceExcept
    ion]>

Maybe you are looking for