Calling a method to a program

hello,
I have a requirement that I am working on, I need to create a program that will have vendor number and vendor bank account number on the selection screen.
Now what I need to do is I need to call a method from a class that will do some kind of validation, method name is  'validation'
My problem here is that method validation has only vendor bank account number as a parameter. Vendor number is defined as an attribute in the class, let's say z_vendor, and in the method we are using Z_vendor as a vendor number.
Can you please tell me how can I set the value of the attribute to the one that the user will enter using a FM and then how to call the method validation in to my program.
I can not make any change the way class has been declared.
The attribute z_vendor is defined as follows:
1. Level - Instance Attribute
2. Visibility - Public
I am very new to OOPS.. so any help will be really appreciated.

Hi Rahul,
You can do like this:
data:lr_object type ref to CLASS (NAME of your class)
create object lr.
1.lr_object->z_vendor = vendor no.
2. call method lr_object->method name (in Importing parameter pass the vendor bank account no.
And then in the method your vendor no and bank account will be passed.
Thanks
Bhanu

Similar Messages

  • How to call a Method in a Program?

    Hello,
    I am very new to the ABAP world.  I have been given a task to call a method if_hrbas_plain_infotype_access~read_single from the class CL_HRBAS_PLAIN_INFOTYPE_ACCESS in a program to see if we can use it to display some employee information.  I don't know how to call a method in a program.  Can somebody please provide me some pseudo code or instructions?
    Thanks.

    Hi Shan,
    here is the code to call a method. while calling the method Instance as 'r_info' which is the type reference to class as specified.
    pass the values to exporting parameters plvar,otype,objid...etc  according  to the requirement
    infotypes: 0002.   " creates an internal table p0002.
    data:
    r_info type ref to CL_HRBAS_PLAIN_INFOTYPE_ACCESS.
    TRY.
    CALL METHOD r_info->if_hrbas_plain_infotype_access~read
       EXPORTING
         plvar           = 
         otype           =
         objid           =
         istat           =
         infty           =
    *     SUBTY           =
         begda           =
         endda           =
         no_auth_check   =  'X'
         message_handler =
       IMPORTING
         PNNNN_TAB       = P0002
    *     HRTNNNN_TAB     =
    *     IS_OK           =
      CATCH CX_HRBAS_VIOLATED_ASSERTION .
    ENDTRY.
    LOOP AT P0002.
          WRITE:/
            P0002-VORNA,
            P0002-NCHMC,
            P0002-NACHN.
        ENDLOOP.
    Regards

  • Calling Java methods from C program

    After a year or so using these excellent forums to answer my queries, without ever having to post a question, I've finally had to ask for help with this one. I've already looked through the JNI tutorial, and these forums, extensively, but I'm still not quite sure of how best to solve my problem.
    I need to call Java methods from a C program. I've already used JNI to call a simple C program from Java, and that's fine, but I just can't determine exactly what I need to do for the reverse to work.
    What is the definitive solution for calling Java from C? Is it to use the invocation APIs to create a JVM, and then access it through the various GetMethod, FindClass methods? Or can I 'reverse engineer' the process I followed to get Java to call C?? The tutorial is a bit confusing, as the example it gives uses Callback stuff, but I guess that's only useful when you want to go Java-C-Java??
    Advice appreciated,
    Rich

    Forgive my blatant bumping, but anyone, please?

  • How to use Java to call a method in C program

    Hi,
    I have a method written in C program, and I need to call it in Java. Is there any way to do that? Thanks for ur suggestion.
    Regards

    Hi,
    JNI is the standard way to call C/C++ runtime code from Java.
    you find the spec under
    http://java.sun.com/products/jdk/1.2/docs/guide/jni/
    Greetings

  • Calling C++ method from Java program on Linux

    I'm trying to get set up to call a C++ method from a Java app on a SUSE Linux box. I follow the steps of the "Hello World" baby example in Beth Stearns's tutorial, "Integrating Native Code and Java Programs", but I get the following error message:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: /users/dmizell/testIF/libhello.so: /users/dmizell/testIF/libhello.so: invalid ELF header (Possible cause: endianness mismatch)
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1778)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1028)
    at HelloWorld.<clinit>(HW.java:7)
    at Main.main(Main.java:5)
    Any idea what I might be doing wrong?
    thanks
    David

    Your library is compiled in a way which is incompatible with the VM you are using.
    Note that there is a JNI forum.

  • Calling Standard Method of Object

    Dear All,
         I had requirement to call standard method 'CANCEL' of Object(MOVEINDOC) in abap program.But the problem is that the method is not released.How can i call this method in abap program.

    Thanks to all.
    I found in Metalink that this is really NOT supported by Oracle Objects : http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=FOR&p_id=189601.995
    Zlatko, your solution is pretty but i am not sure it is usable for my wide object hierarchy (very wide) which i have to rewrite.

  • How to call a standard BOR method in a program.

    Hi All,
    How to call a standard BOR method in a program. For example I have to call BOR method ISUSMORDER.Release in my program but don't know how to call.
    Also, plz tell me how to capture the Exceptions in case of BOR method.
    Plz help me out in this.
    Thanks,
    Mithilesh

    Would be easier (however not always possible), to determine the functionality of this method and call that in your program. I mean, normally this method calls a BAPI, or function module (or a transaction). Have a look at the coding inside of the method, and try and use this.

  • Program for call transaction method

    can any body  help  me , how to write a  call transaction method . how to create error logs for call transaction method

    hi
    REPORT  ZCALL.
    TYPES : BEGIN OF itab,
    lifnr TYPE rf02k-lifnr,
    ktokk TYPE rf02k-ktokk,
    END OF itab.
    DATA : i_tab TYPE TABLE OF itab INITIAL SIZE 0,
    wa_tab TYPE itab.
    DATA : i_bdc TYPE TABLE OF bdcdata INITIAL SIZE 0,
    wa_bdc TYPE bdcdata.
    DATA : i_message LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE,
    wa_message TYPE bdcmsgcoll.
    DATA : fname TYPE string VALUE 'd:\manish.txt'.
    DATA: p_text(100) TYPE c.
    START-OF-SELECTION.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = fname
    filetype = 'ASC'
    has_field_separator = 'X'
    TABLES
    data_tab = i_tab.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    LOOP AT i_tab INTO wa_tab.
    PERFORM bdc_dynpro USING 'SAPMF02K' '0100'.
    PERFORM bdc_field USING 'RF02K-LIFNR' wa_tab-lifnr.
    PERFORM bdc_field USING 'RF02K-KTOKK' wa_tab-ktokk.
    PERFORM bdc_field USING 'BDC_OKCODE' '= AUSW'.
    CALL TRANSACTION 'XK01' USING i_bdc MODE 'N'. " UPDATE 'S' MESSAGES
    "INTO i_message.
    REFRESH i_bdc.
    ENDLOOP.
    IF sy-subrc NE 0.
    READ TABLE i_message WITH KEY msgtyp = 'E'.
    IF sy-subrc = 0.
    LOOP AT i_message INTO wa_message.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
    id = i_message-msgid
    lang = 'EN'
    no = i_message-msgnr
    v1 = i_message-msgv1
    v2 = i_message-msgv2
    v3 = i_message-msgv3
    v4 = i_message-msgv4
    IMPORTING
    msg = p_text
    EXCEPTIONS
    not_found = 1
    OTHERS = 2.
    WRITE:/ p_text.
    ENDLOOP.
    ENDIF.
    ENDIF.
    *& Form bdc_dynpro
    text
    -->PROGRAM text
    -->DYNPRO text
    FORM bdc_dynpro USING program dynpro.
    CLEAR wa_bdc.
    wa_bdc-program = program.
    wa_bdc-dynpro = dynpro.
    wa_bdc-dynbegin = 'X'.
    APPEND wa_bdc TO i_bdc.
    ENDFORM. "bdc_dynpro
    *& Form bdc_field
    text
    -->FNAM text
    -->FVAL text
    reward if u find useful
    regards
    Nagesh.Paruchuri

  • Can we use Call transaction and session method in same program ?

    Hi experts,
                     Is it suggested to use call Transaction and session method in the same Program ?
                     i have a doubt , why cant we use multiple call transactions in same program instead of session method if we have multiple transaction updations ?

    Hi Dengyong Zhang,
    we can use the call transation and session method in same program.
    However for better performance it's benificial to use call trasaction method of BDC. but if u want to upload very large amount of data then Session method is more preferable to use.
    Session method is one of the method of BDC.
    U can also use BAPI to upload the data in SAP but it's a different concept than BDC. Performance wise BAPI is more advantageous than BDC.

  • Calling OCX Methods from a Java Program

    Hi All,
    Is it possible to call OCX methods from a Java program? If yes, can you please refer me to any documents or sample code to achieve this.
    All inputs are highly appreciated.
    Thanks
    Tarek

    JNI
    http://java.sun.com/docs/books/tutorial/native1.1/index.html

  • Call Applet method from JavaScript, tiny test program works... SOMETIMES!?

    I have an embedded Applet in a web page, and I am trying to directly call a method in that Applet from the same page, using JavaScript.
    Here is the complete Applet:
    import java.applet.Applet;
    public class Test extends Applet {
      public String test() {
        return "test() method return value";
    }Here is the complete web page:
    <HTML>
    <HEAD><TITLE>Applet Invocation test</TITLE></HEAD>
    <BODY>
    <APPLET CODE="Test" WIDTH=10 HEIGHT=10 NAME="test"></APPLET>
    <HR>
    <SCRIPT>
    document.write( "JavaScript is working<br>" );
    document.write( document.test.test() );
    </SCRIPT>
    </BODY>
    </HTML>Is there anything wrong with this? Because it works about 15% of the time, displaying an <HR>, "JavaScript is working", and then "test() method return value" on the next line.
    The other 85% of the time, it just gets to "JavaScript is working", then I get a JavaScript error "Object does not support this property or method" for the line: document.write( document.test.test() );
    Now here's another weird quirk... I can get it to work ALL the time, if I delay the execution of the Applet method. For example, if the first line after <SCRIPT> is alert( "alert" ); then the user gets a little dialog box with "alert" message in it, and when they hit OK execution continues, and the applet method call ALWAYS works. (On a side note, if I make the Applet test() method static, it NEVER works. Why is this?)
    So it seems to me, that when it is failing, it is because the Applet is not completely loaded into the browser yet. My question is, how can I get around this?? Is there a way to instruct JavaScript to wait until the Applet is finished loading before attempting to call any methods on it?
    PS I am using Windows ME and IE 6

    Thanks for the reply, I appreciate it. I have another question, if you don't mind... here is what my new test web page looks like:
    <HTML>
    <HEAD>
    <TITLE>Applet Invocation test</TITLE>
    <SCRIPT>
    function testFunc()
      document.write( document.test.test() );
    </SCRIPT>
    </HEAD>
    <BODY onLoad="testFunc()">
    <APPLET CODE="Test" WIDTH=10 HEIGHT=10 NAME="test">
    </APPLET>
    <HR>
    </BODY>
    </HTML>What happens is: the page loads, I see a 10x10 grey applet box, and a <HR>... then a split second later, onLoad is fired, and everything on the page so far is REPLACED with the output of testFunc(), so the ONLY thing on the page after this all completes is "test() method return value"
    Why is a single document.write() statement CLEARING the page before outputting? I don't understand. If calling a document.write() from an onLoad event wipes out everything on the page, this is not extremely helpful solution.

  • AutomationException while calling a method

    Hi all,
    I've got a problem accessing a COM/DCOM component in a Win2k box (Advanced Server)
    with jcom. I configured the server and client described in the "JSP to COM" example.
    The only difference: I don't want to access the excel sheet and I don't use a jsp
    to execute.
    I used the java2com.exe to create the proxies from my dll ScriptableUniversalTransAgt.dll.
    But when I try to call a method on the dll via Java, I get the exception:
    AutomationException: 0x80070005 - General access denied error in 'Invoke'
         at com.bea.jcom.Rpc.a(Rpc.java)
         at com.bea.jcom.be.a(be.java)
         at com.bea.jcom.StdObjRef.a(StdObjRef.java)
         at com.bea.jcom.Dispatch.vtblInvoke(Dispatch.java)
         at de.conet.galileo.suta.IScriptableUniversalTransAgentProxy.setHcmName(IScriptableUniversalTransAgentProxy.java:271)
         at de.conet.galileo.suta.ScriptableUniversalTransAgent.setHcmName(ScriptableUniversalTransAgent.java:336)
         at de.conet.galileo.SUTATest.start(SUTATest.java:33)
         at de.conet.galileo.SUTATest.main(SUTATest.java:27)
    I checked everything on the server, the user has all rights he needs but it doesn't
    work. In the eventlog of the server I can see that the login was successful.
    The attachment contains some log files and my program with the dll.
    Maybe someone can help me?
    Thanks
    Michael
    [src.zip]

    "Jeff Muller" <[email protected]> wrote in message
    news:[email protected]...
    Yeah, now I'm getting this error on code that worked two days ago.
    javax.servlet.ServletException: Unable to initialize servlet:
    AutomationExceptio
    n: 0x80070005 - General access denied error, status: Getting instance, and
    calli
    ng initialize.
    at com.teloquent.MyApp.MyServlet.initCOMObj(MyServlet.
    java:308)
    at com.teloquent.MyApp.MyServlet.init(MyServlet.java:8
    1)
    at
    weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubIm
    pl.java:700)
    at
    weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStub
    Impl.java:643)
    at
    weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
    mpl.java:588)
    at
    weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.
    java:368)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:242)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:200)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:2495)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2204)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    >
    ... but then again, I don't expect any response here.
    "Michael" <[email protected]> wrote in message
    news:[email protected]...
    Hi all,
    I've got a problem accessing a COM/DCOM component in a Win2k box
    (Advanced
    Server)
    with jcom. I configured the server and client described in the "JSP toCOM" example.
    The only difference: I don't want to access the excel sheet and I don'tuse a jsp
    to execute.
    I used the java2com.exe to create the proxies from my dllScriptableUniversalTransAgt.dll.
    But when I try to call a method on the dll via Java, I get the
    exception:
    >>
    AutomationException: 0x80070005 - General access denied error in'Invoke'
    at com.bea.jcom.Rpc.a(Rpc.java)
    at com.bea.jcom.be.a(be.java)
    at com.bea.jcom.StdObjRef.a(StdObjRef.java)
    at com.bea.jcom.Dispatch.vtblInvoke(Dispatch.java)
    atde.conet.galileo.suta.IScriptableUniversalTransAgentProxy.setHcmName(IScript
    ableUniversalTransAgentProxy.java:271)
    at
    de.conet.galileo.suta.ScriptableUniversalTransAgent.setHcmName(ScriptableUni
    versalTransAgent.java:336)
    at de.conet.galileo.SUTATest.start(SUTATest.java:33)
    at de.conet.galileo.SUTATest.main(SUTATest.java:27)
    I checked everything on the server, the user has all rights he needs butit doesn't
    work. In the eventlog of the server I can see that the login wassuccessful.
    The attachment contains some log files and my program with the dll.
    Maybe someone can help me?
    Thanks
    Michael

  • 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).........

  • Calling a method from another class. Please Help!!

    Here is my full program. Like I said in my last post. I am having trouble calling the baseMakesError1 method. This method is called in the subcallsbase1 method. Also, it would be of great help if you could look for any other errors with with my program. Thank you so much. I really appreciate it.
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    public class ThomasR11
    String sy;
    public static void main(String[] args)
    System.out.println("(main): Ryan Thomas, file ThomasR11: Exceptions");
    SubRT obj3;
    SubRT obj4;
    String sX;
    String x;
    String s;
    String sY;
    try
    ThomasR11 obj1=new ThomasR11();
    catch(NullPointerException NPE)
    System.err.println("Null Pointer Exception");
    ThomasR11 obj2=new ThomasR11("Hello");
    System.out.println("This is the last statement in main");
    public ThomasR11()
    SubRT obj3= new SubRT();
    obj3.subCallsBase1();
    public ThomasR11(String sY)
    throws FileNotFoundException
    SubRT obj4= new SubRT();
    obj4.subError2();
    obj4.subError3(sY);
    private static class BaseRT
    public BaseRT()
    System.out.println("In BaseRT constructor= " + this);
    public void baseMakesError1(int value0)
    System.out.println("In BaseRT constructor, about to throw exception");
    if (value0==0)
    throw new NullPointerException("NullPointerException");
    private class SubRT extends BaseRT
    SubRT subNull;
    public SubRT()
    System.out.println("In SubRT constructor before call to aMakes an error= " +
    "\n SubRT constructor= " + this);
    public void subCallsBase1()
    try
    System.out.println("Calling the method baseMakeserror1");
    baseMakesError1(subNull);<---------------------This is where I am getting the error it says "ThomasR11.java [79:1] baseMakesError1(int) in ThomasR11.BaseRT cannot be applied to (ThomasR11.SubRT)"
    catch(NumberFormatException NFE)
    System.err.println("\nNumber Format Exception");
    catch (NullPointerException NPE)
    System.err.println(NPE.getMessage() + "\n");
    System.err.println(NPE.toString() + "\n");
    throw NPE;
    public void subError2()
    try
    BufferedReader in = new BufferedReader( new FileReader( "c:/xx/xx.xx" ) );
    catch(NullPointerException NPE)
    System.out.println("Null Pointer Exception");
    catch (FileNotFoundException FNFE)
    System.err.println("FileNotFoundException");
    public void subError3( String sX)
    try
    System.out.println("Hello");
    System.out.println (sX.length());
    catch(NullPointerException NPE)
    System.err.println("Null Pointer Exception");

    "ThomasR11.java [79:1] baseMakesError1(int) in ThomasR11.BaseRT cannot be applied to (ThomasR11.SubRT)"
    ...this error is telling out that you wrote baseMakesError1 to accept an "int" as an argument, and you are trying to pass it an instance of the ThomasR11.SubRT class. You either have to change baseMakesError1 to accept a SubRT as an argument, or change your call to pass an integer.

  • Calling a method from a super class

    Hello, I'm trying to write a program that will call a method from a super class. This program is the test program, so should i include extends in the class declaration? Also, what code is needed for the call? Just to make things clear the program includes three different types of object classes and one abstract superclass and the test program which is what im having problems with. I try to use the test program to calculate somthing for each of them using the abstract method in the superclass, but its overridden for each of the three object classes. Now to call this function what syntax should I include? the function returns a double. Thanks.

    Well, this sort of depends on how the methods are overridden.
    public class SuperFoo {
      public void foo() {
         //do something;
      public void bar(){
         //do something
    public class SubFoo extends SuperFoo {
       public void foo() {
          //do something different that overrides foo()
       public void baz() {
          bar(); //calls superclass method
          foo(); //calls method in this (sub) class
          super.foo(); //calls method in superclass
    }However, if you have a superclass with an abstract method, then all the subclasses implement that same method with a relevant implementation. Since the parent method is abstract, you can't make a call to it (it contains no implementation, right?).

Maybe you are looking for