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

Similar Messages

  • 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

  • How to debug the method in abap program

    How to debug the method in abap program ?
    Could you please give the solution.
    Thanks
    sai

    Hi ,
    Place break point at call method .
    It takes u in to the method implementation .
    Here u can analyse the method implementation ...
    Reward if useful
    Thanks
    Jagadeesh.G

  • How to call main method in one class from another class

    Suppose i have a code like this
    class Demo
    public static void main(String args[])
    System.out.println("We are in First class");
    class Demo1
    public static void main(String args[])
    System.out.println("We are in second class");
    In the above program how to call main method in demo calss from Demo1 class......???????

    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 the method from the java bean and pass it to JSP textbox

    i'm quite new to java thats why i'm asking how to call a method in the java bean file and pass it to the JSP textbox. My projects are communicating JSP with C#. i had successfully created a C# client bean file for JSP. The whole process is to type something on the server(C# programming) and it would appear in the textbox.

    your question doesn't provide much informartion. provide some other information and coding so that we could tell exactly what you are looking for?

  • How to call a method in private section of a class in the public section

    Hi Everybody,
    i have written a method(meth1) in the private section of a class(C1).
    it is as follows
    class C1 definition.
    private section.
    methods: meth1 importing im_dt1 like tp1
                                             im_dt2 like tp2
                                             im_dt3 like tp3
                                             im_dt4 like tp4
                               returning value(re_dt1) like tp5.
    endclass.
    i have the final data that has to be displayed in internal table re_dt1.
    now my question is how to call  this method present in private section into public section and display the data present in re_dt1.
    Thanks,
    learning.abap.

    Hi,
    what you need is one public method being called at start-of-selection. Within this the private methods have to be called.
    The question is, why has the method for reading the database tables to be private? If you have only one private method reading all database tables the public method being called at start-of-selection will only consist of a call-method statement.
    This seems to be one call to much.
    The logic for reading the different database tables is hidden inside the class anyway.
    Is there any further logic reading the different database tables?
    Have always all table to be read? If not another approach would be one private method for each database table being called by a public method deciding which table has to be read:
    public section.
    methods get_data returning value(re_Dt1).
    private section.
    methods:
    get_table_a returning value(im_dt1),
    get_table_b returning value(im_dt2),
    get_table_c returning value(im_dt3),
    get_table_d returning value(im_dt4),
    combine_data importing im_dt1
                                    im_dt2
                                    im_dt3
                                    im_dt4
                            returning value(re_dt1).
    *- implementation of public method:
    method get_data.
      data: lt_dt1 ...
               lt_dt2,
               lt_dt3,
               lt_dt4.
    * here decide which tables have to be read:
    lt_dt1 = get_table_a( ).
    lt_dt2 = get_table_b( ).
    lt_dt3 = get_table_c( ).
    lt_dt4 = get_table_d( ).
    re_dt1 = combine_data( i_dt1 = lt_dt1
                                           i_dt2 = lt_dt2
                                           i_dt3 = lt_dt3
                                           i_dt4 = lt_dt4 ).
    endmethod.
    *- implementation of private methods
    method get_table_a.
    endmethod.
    method get_table_b.
    endmethod.
    method get_table_c.
    endmethod.
    method get_table_d.
    endmethod.
    method combine_data.
    endmethod.
    Regards
    Dirk

  • How to call subroutines defined in ABAP program with type S

    how to call subroutines defined in ABAP program with type S? can you give an example?

    Normal executable program,
    REPORT  ZTEST_MAIN.
    perform sub1 in program ztest_sub.
    "you can call using in program addition
    Subroutine pool program
    PROGRAM  ZTEST_SUB.
    form sub1.
    endform.

  • How to call a idoc in abap program and updates catsdb table

    how to call a idoc in abap program and updates catsdb table
    thank you,
    Jagrut BharatKumar Shukla

    Hi Kishan,
    You can refer to following help document,
    http://help.sap.com/saphelp_nw04/helpdata/en/bf/d005244e9d1d4d92b2fe7935556b4c/content.htm
    Regards,
    Meera

  • How to call a method from a separate class using IBAction

    I can't work out how to call a method form an external class with IBAction.
    //This Works 1
    -(void)addCard:(MyiCards *)card{
    [card insertNewCardIntoDatabase];
    //This works 2
    -(IBAction) addNewCard:(id)sender{
    //stuff -- I want to call [card insertNewCardIntoDatabase];
    I have tried tons of stuff here, but nothing is working. When i build this I get no errors or warnings, but trying to call the method in anyway other that what is there, i get errors.

    Can you explain more about what you are trying to do? IBAction is just a 'hint' to Interface Builder. It's just a void method return. And it's unclear what method is where from your code snippet below. is addNewCard: in another class? And if so, does it have a reference to the 'card' object you are sending the 'insertNewCardIntoDatabase' message? Some more details would help.
    Cheers,
    George

  • How to call Operating System commands / external programs from within APEX

    Hi,
    Can someone please suggest how to call Operating Systems commands / external programs from within APEX?
    E.g. say I need to run a SQL script on a particular database. SQL script, database name, userid & password everything is available in a table in Oracle. I want to build a utility in APEX where by when I click a button APEX should run the following
    c:\oracle\bin\sqlplusw.exe userud/password@database @script_name.sql
    Any pointers will be greatly appreciated.
    Thanks & Regards,

    Hi Guys,
    I have reviewed the option of using scheduler and javascript and they do satisfy my requirements PARTIALLY. Any calls to operating system commands through these features will be made on the server where APEX is installed.
    However, here what I am looking at is to call operating systems programs on client machine. For example in my APEX application I have constructed the following strings of commands that needs to be run to execute a change request.
    sqlplusw.exe user/password@database @script1.sql
    sqlplusw.exe user/password@database @script2.sql
    sqlplusw.exe user/password@database @script3.sql
    sqlplusw.exe user/password@database @script4.sql
    What I want is to have a button/link on the APEX screen along with these lines so that when I click that link/button this entire line of command gets executed in the same way it would get executed if I copy and paste this command in the command window of windows.
    Believe me, if I am able to achieve what I intend to do, it is going to save a lot of our DBAs time and effort.
    Any help will be greatly appreciated.
    Thanks & Regards,

  • How to call a method defined in AM when I select any value in LOV

    Lets say there is a LOV. The scenario is as soon as I select any value in LOV, a method needs to be called which I have written in the AM. And the output of the method is displayed in a output text box.
    I am not able to understand how to call a method when the user selects any value in LOV.
    This is wht I did. I had created the binding for the method. Changed the autosubmit property of the LOV to True, and in the properties of the output box, in the partial submit trigger property, passed the ID of the LOV. But I didnt get any place where I need to call the method. I am also not able to drop an action listener on the LOV

    Hi,
    +"its showing an error(underlined in orange)."+
    Any reason you don't share this error with us? Anyway, here is how it goes
    1. LOV, set autosubmit="true" and configure a value change listener
    2. Expose the AM method as a method binding in the PageDef file
    3. In the value change listener:
    BindingContext bctx = BindingContxt().getCurrent();
    BindingContainer bindings = bctx.getCurrentBindingsEntry();
    OperationBinding method = (OperationBinding) bindings.get("name of method binding in PageDef");
    method.getParamsMap().put("argument name1", value1);
    method.getParamsMap().put("argument name2", value2);
    Object retVal = method.execute();
    if(!method.getErrors().isEmpty()){
      //handle errors
    else{
      //write retVal to the managed bean variable that is referenced by the outputText value property
      //PPR output text component
      ADFFacesContext.getCurrentInstance().addPartialTarget(outputTextRef);
    }Note that you may have to set clientComponent = "true" on the output text component
    Frank

  • How to call a method in the servlet from an applet

    I want to get the data for the applet from the servlet.
    How to call a method that exits in the servlet from the applet? I want to use http protocol to do this.
    Any suggestions? Please help.
    thanks

    Now that Web Services is around, I'd look at possibly implement a Web Service call in your applet, which can then be given back any object(s) on return. Set up your server side to handle Web Service calls. In this way, you can break the applet out into an application should you want to (with very little work) and it will still function the same

  • How to call a method of another class ?

    Hello,
    I�d like to know how to call a method of another class. I have to classes (class 1 and class 2), class 1 instantiates an object of class 2 and executes the rest of the method. Later, class 1 has to call a method of class 2, sending a message to do something in the object... Does anybody know how to do that ? Do I have to use interface ? Could you please help me ?
    Thanks.
    Bruno.

    Hi Schiller,
    The codes are the following:
    COMECO
    import javax.swing.UIManager;
    import java.awt.*;
    import java.net.*;
    import java.io.*;
    import java.awt.event.*;
    import javax.swing.*;
    //Main method
    class comeco {
    public static void main(String[] args) {
    try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    catch(Exception e) {
    AGORA testeagora=new AGORA();
    // Code for socket
    int port;
         ServerSocket server_socket;
         BufferedReader input;
         try {
         port = Integer.parseInt(args[0]);
         catch (Exception e) {
         System.out.println("comeco ---> port = 1500 (default)");
         port = 1500;
         try {
         server_socket = new ServerSocket(port);
         System.out.println("comeco ---> Server waiting for client on port " +
                   server_socket.getLocalPort());
         // server infinite loop
         while(true) {
              Socket socket = server_socket.accept();
              System.out.println("comeco ---> New connection accepted " +
                        socket.getInetAddress() +
                        ":" + socket.getPort());
              input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
              // print received data
              try {
              while(true) {
                   String message = input.readLine();
                   if (message==null) break;
                   System.out.println("comeco ---> " + message);
    testeagora.teste(message);
              catch (IOException e) {
              System.out.println(e);
              // connection closed by client
              try {
              socket.close();
              System.out.println("Connection closed by client");
              catch (IOException e) {
              System.out.println(e);
         catch (IOException e) {
         System.out.println(e);
    AGORA
    import javax.swing.UIManager;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    import javax.swing.*;
    import java.net.*;
    //public class AGORA {
    public class AGORA {
    boolean packFrame = false;
    //Construct the application
    public AGORA() {
    try {
    Main frame = new Main();
    System.out.println("agora ---> Criou o frame");
    //Validate frames that have preset sizes
    //Pack frames that have useful preferred size info, e.g. from their layout
    if (packFrame)
    frame.pack();
    else
    frame.validate();
    //Center the window
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = frame.getSize();
    if (frameSize.height > screenSize.height)
    frameSize.height = screenSize.height;
    if (frameSize.width > screenSize.width)
    frameSize.width = screenSize.width;
    frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
    frame.setVisible(true);
    catch(Exception e)
    { System.out.println("agora ---> " +e);
    // Tem que criar a THREAD e ver se funciona
    public void remontar (final String msg) {
    try {
                   System.out.println("agora ---> Passou pelo Runnable");
    System.out.println("agora --> Mensagem que veio do comeco para agora: "+ msg);
    Main.acao(msg);
    catch(Exception x) {
    x.printStackTrace();
    MAIN
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import com.borland.jbcl.layout.*;
    import javax.swing.border.*;
    import java.net.*;
    import java.io.*;
    public class Main extends JFrame {
    // ALL THE CODE OF THE INTERFACE
    //Construct the frame
    public Main() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
    jbInit();
    catch(Exception e) {
    e.printStackTrace();
    public void acao() {
    // C�digo para mudar a interface
    Runnable setTextRun=new Runnable() {
    public void run() {
    try {
                   System.out.println("main ---> Passou pelo Runnable");
    TStatus.setText("main ---> Funcionou");
    catch(Exception x) {
    x.printStackTrace();
    System.out.println("main ---> About to invokelater");
    SwingUtilities.invokeLater(setTextRun);
    System.out.println("main ---> Back from invokelater");
    // Aqui vai entrar o m�todo para ouvir as portas sockets.
    // Ele deve ouvir e caso haja alguma nova mensagem, trat�-la para
    // alterar as vari�veis e redesenhar os pain�is
    // Al�m disso, o bot�o de refresh deve aparecer ativo em vermelho
    //Component initialization
    private void jbInit() throws Exception {
    // Initialize the interface
    //Setting | Host action performed
    public void SetHost_actionPerformed(ActionEvent e) {
         int port;
         ServerSocket server_socket;
         BufferedReader input;
    System.out.println("main ---> port = 1500 (default)");
         port = 1500;
         try {
         server_socket = new ServerSocket(port);
         System.out.println("main ---> Server waiting for client on port " +
                   server_socket.getLocalPort());
         // server infinite loop
    while(true) {
              Socket socket = server_socket.accept();
              System.out.println("main ---> New connection accepted " +
                        socket.getInetAddress() +
                        ":" + socket.getPort());
              input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    String espaco=new String(": ");
         JLabel teste2=new JLabel(new ImageIcon("host.gif"));
              PHost.add(teste2);
    System.out.println("main ---> Adicionou host na interface");
              repaint();
    System.out.println("main ---> Redesenhou a interface");
              setVisible(true);
              // print received data
              try {
              while(true) {
                   String message = input.readLine();
                   if (message==null) break;
                   System.out.println("main ---> " + message);
              catch (IOException e2) {
              System.out.println(e2);
              // connection closed by client
              try {
              socket.close();
              System.out.println("main ---> Connection closed by client");
              catch (IOException e3) {
              System.out.println(e3);
         catch (IOException e1) {
         System.out.println(e1);
    public void OutHost_actionPerformed(ActionEvent e) {
              repaint();
              setVisible(true);
    //Help | About action performed
    public void helpAbout_actionPerformed(ActionEvent e) {
    Main_AboutBox dlg = new Main_AboutBox(this);
    Dimension dlgSize = dlg.getPreferredSize();
    Dimension frmSize = getSize();
    Point loc = getLocation();
    dlg.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y);
    dlg.setModal(true);
    dlg.show();
    //Overridden so we can exit on System Close
    protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if(e.getID() == WindowEvent.WINDOW_CLOSING) {
    fileExit_actionPerformed(null);
    public void result(final String msg) {
    // C�digo para mudar a interface
    Runnable setTextRun=new Runnable() {
    public void run() {
    try {
                   System.out.println("main ---> Chamou o m�todo result para mudar a interface");
    System.out.println("main --> Mensagem que veio do agora para main: "+ msg);
    TStatus.setText(msg);
    catch(Exception x) {
    x.printStackTrace();
    System.out.println("main --> About to invokelater");
    SwingUtilities.invokeLater(setTextRun);
    System.out.println("main --> Back from invokelater");
    []�s.

  • How to call  a method of one view in other view

    Hi
      could any one suggest "how to call  a method of one view in other view "
    thanks
    kaushik

    Hi Kausic,
    Its not possible to call a method from view to View.
    Since view is private entity we can not pass the data directly.
    I suggest you to declare the method in Component/Custom controller and call.
    the code is,
    wdThis.wdGet<Component/Custom Name>Controller().<methodName>();
    Regards,
    <b>Ramganesan K</b>

  • How to call a method in onload using jsf

    Hi
    i have task where i neeed to retrive datas from database on page onload . i have written retriving code in backing bean but how to call that
    method on onload in jsf.......
    Can anybody help ???????????
    thanks

    public class firstbean{
         list mylist = new ArrayList();
         firstbean(){
         new firstcontroller().retriveData()
    public class firstcontroller{
         public void retriveData(){
              // I need to get first bean object reference to assign the retived data to my list variable(mylist)
              // but iam getting first bean object object as nulll
              Object object =
                   FacesContext
                   .getCurrentInstance()
                   .getExternalContext()
                   .getSessionMap()
                   .get("FirstBean");
              FirstBean firstBean = (FirstBean)object;
              // firstBean = null its coming
              firstBean.mylist = new FirstDao().getdata();
    this is my code how to implement the onload function in this login . here when i try accesss my first bean reference is showing as null . so aim not able to assign the retrived data in to mylist variable

Maybe you are looking for

  • How do I remove a the contents of a movie clip created using loadClip?

    I have a Flash site that loads specific SWFs into a movie clip called "content_mc" based on a button click. I do this using the "loadClip" method. I then remove (I thought) the SWF from the movie clip with "unloadClip" and replace it with a new SWF u

  • J2me http connection error

    Hi, I got null value from my hand set when getting conn.getHeaderField value while my J2ME emulator is working fine. Any one hv a clue on tis.. My snipet of code HttpConnection conn = (HttpConnection)Connector.open("http://61.6.108.195:8001/Frens/tes

  • How to find the authentic "date created " of a file

    Hi there How can I retrieve the date of the creation of a file? It's picture I have scanned, I need to authentify it's date of creation. Finder doesn't do it A utility in Photoshope CS3 ( XMP ) doesn't seem reliable. Is there any way I can retrieve w

  • Re: Audit Trail

    Dear All, I would like to get some ideas to see if any of you have implement audit functionality in SCM DP in some form or the other. Here is what I want to do....If a user logs into the system and executes the following - Executes a Transaction - Ex

  • Can I publish a web page from my Mac with something more sophisticated than I-Web for my business?

    I want to construct a web page for my business. I-Web seems to be less sophisticated.  I wanted to use SiteBuilder by Yahoo, but Mac is not compatable. I have looked and have not found much, and that suggests that there are no tools to publish a web