How to handle events on standard toolbar

hi, the following code i worte is to load a form and fill data from db table ..but i'm getting only one record and the buttons on standard toolbar like next, previous, first and last are not enabled and not working...what should i do? plz give me the code....
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load       
        Dim SboGuiApi As SAPbouiCOM.SboGuiApi
        Dim sConnectionString As String
        Dim SBO_Application As SAPbouiCOM.Application
        Dim oDICompany As SAPbobsCOM.Company
        Dim ret As Long
        SboGuiApi = New SAPbouiCOM.SboGuiApi
        sConnectionString = Environment.GetCommandLineArgs.GetValue(1)
        sConnectionString = Command()
        SboGuiApi.Connect(sConnectionString)
        SBO_Application = SboGuiApi.GetApplication
        oDICompany = New SAPbobsCOM.Company
        Dim sCookie As String
        sCookie = oDICompany.GetContextCookie()
        Dim conStr As String
        conStr = SBO_Application.Company.GetConnectionContext(sCookie)
        ret = oDICompany.SetSboLoginContext(conStr)
        If Not ret = 0 Then
            Exit Sub 'the operation has failed.           
        End If
        ret = oDICompany.Connect()
        If ret <> 0 Then
            SBO_Application.MessageBox("Failed")
        Else
            SBO_Application.MessageBox("Connected to Database")
        End If
        ' loading(Form)
        Dim oForm As SAPbouiCOM.Form
        Dim creationPackage As SAPbouiCOM.FormCreationParams
        Dim oxmldoc As New Xml.XmlDocument 'u2026when using .netu2019s system.xml
        'create the formcreationparams object
        creationPackage = SBO_Application.CreateObject( _
         SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
        'please note: these parameters override corresponding data in the xml
        creationPackage.UniqueID = "Sales 111"
        creationPackage.FormType = "Sales Order"
        creationPackage.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Sizable
        'just a sample for an xml string describing a formu2026 same as used for loadbatchactions
        oxmldoc.Load("c:program filessapsap business oneSales Order.srf")
        creationPackage.XmlData = oxmldoc.InnerXml
        'add the form to the sbo application
        oForm = SBO_Application.Forms.AddEx(creationPackage)
        'set the form title and set it visible!
        oForm.Visible = True
        ''''''''''''''''''''''''''''''Data Binding
        '''''''''''binding data from DBDataSource to form items
        Dim oDBDataSource As SAPbouiCOM.DBDataSource
        Dim oItem As SAPbouiCOM.Item
        Dim oEdit As SAPbouiCOM.EditText
        '''''1st edit box
        oItem = oForm.Items.Item("4")
        oEdit = oItem.Specific
        oForm.DataSources.DBDataSources.Add("AACT")
        oEdit.DataBind.SetBound(True, "AACT", "AcctCode")
        ' getting the data sources bound to the form
        oDBDataSource = oForm.DataSources.DBDataSources.Item("AACT")
        oDBDataSource.Query()
        '''''2nd edit box
        oItem = oForm.Items.Item("5")
        oEdit = oItem.Specific
        oForm.DataSources.DBDataSources.Add("AACT")
        oEdit.DataBind.SetBound(True, "AACT", "AcctName")
        ' getting the data sources bound to the form
        oDBDataSource = oForm.DataSources.DBDataSources.Item("AACT")
        oDBDataSource.Query()
        ''''3rd edit box
        oItem = oForm.Items.Item("6")
        oEdit = oItem.Specific
        oForm.DataSources.DBDataSources.Add("AACT")
        oEdit.DataBind.SetBound(True, "AACT", "CurrTotal")
        ' getting the data sources bound to the form
        oDBDataSource = oForm.DataSources.DBDataSources.Item("AACT")
        oDBDataSource.Query()
    End Sub

You have to enable the menus on toolbar as
form.EnableMenu(1288, True)
             form.EnableMenu(1289, True)
             form.EnableMenu(1290, True)
             form.EnableMenu(1291, True)
If zou have the datas as UDO, use
form.DataBrowser.BrowseBy = "code" - specifies the logic for getting next, previous,... record
dont forget to take
ObjectType="your udo name"
to the form for specify from which UDO will be the datas.
If you dont have udo, you need enable themenus in toolbar and in menuevent catch the events and create own logic for this.

Similar Messages

  • How to handle Events in OO abap.

    Hii all as im new to SAP and  ABAP , i want to know , what are events all about and how to handle events?
    Like how to guide double click to call a transaction , or to create a hot sopt and then , calling the transaction...........
    Please Help.

    Hi Chandan,
    possibly you are not just new to ABAP but new to obeject oriented programming in general. In oo, you use events to trigger methods that are registered as 'listeners' for the event.
    As I have no idea on your current knowledge, I don't know what I could recommend to start with.
    My personal approach is first to have a task I want to complete and then find and understand the methods to get there.
    Regards,
    Clemens

  • How to handle events in webdynpro abap

    Hi,
    can any body explain how to handle the events in webdynpro abap.
    i want to know some concepts in general.
    Thanks,

    Hi Mahesh,
    you can create event handlers under the actions tab in you view. evry event handler has an importing parameter wdevent of type ref to cl_wd_custom_event.
    you can also create events in your component controller and they can be handled within your views
    check cl_wd_custom_event class for details about what all information you get when an event occurs.
    for further details you can check out the following links
    http://help.sap.com/saphelp_nw04s/helpdata/en/eb/ed6f4169e25858e10000000a1550b0/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/a9/c751415e3b6532e10000000a1550b0/frameset.htm
    also you can try the tutorial at the following link for further clarity
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2eb11b59-0a01-0010-dfa3-8292abdf9c4f
    Regards,
    Shweta
    Message was edited by:
            Shweta R Shanbhag

  • How to handle Event in JACOB API

    Hi,
    I am read the outlook mail using JACOB[Java Com Bridge] API successfully, now i want to handle events for outlook mail using JACOB. and also i can able to catch the new mail event. but i am unable to catch any deleted mail and move mail from one folder to another folder. This is extremely important for my project. so any one please tell me how to handle and catch the Outlook deleted event and move event using JACOB.
    Thanks in Advance,
    With Regards,
    Ganesh

    Windows can be closed in a number of ways and the simplest way to trap them would be to handle Window Closing in code behind.
    This is also the easiest way to show dialogs if that's how you wanted the warning message to appear.
    This:
    chxAllowToClose.IsChecked
    Looks like a checkbox to me, seeing as you have IsChecked.
    That presumably means you already have that bound to a viewmodel and visible to the user.
    You can therefore just test that value from the view.
    If you prefer to hide that instead then there are several options.
    You could have a dependency property and a binding in code behind which binds to the viewmodel. Test that in your event.
    Or
    You could save the value when it changes to application.current.resources.  Since dependency properties and bindings are a bit wordy this is easier.
    Or
    You could have just a variable in the view code behind and use messenger to tell that when the value changes from the viewmodel:
    http://social.technet.microsoft.com/wiki/contents/articles/26070.communicating-between-classes.aspx
    Please don't forget to upvote posts which you like and mark those which answer your question.
    My latest Technet article - Dynamic XAML

  • How to handle event when the user closing the browser (Urgent Please)

    Hi,
    How to handle the event when user closes the browser....
    i want to display some alter message when user trying to close the browser...
    Please can any one help me how i have to do this...........
    Thanks.

    Finally got this working. You cannot use the stop() or destroy methods. By the time they are called all database connections are gone and you will get a null pointer exception.
    You will have to use the onBeforeUnload method in the html file that calls the applet and use JavaScript to call the save method in java which saves the document:
    <SCRIPT LANGUAGE="JScript" TYPE="text/javascript">
    function Save()
    //i call the applets doSave() method from here in which i save all
    //changes to the database
    top.Tree.document.TestApplet.doSave();
    //this will invoke the default IE message for closing the window
    //when user clicks on the x in the browser
    message = "Your document has been saved."
    return message;
    window.onbeforeunload=Save;
    </SCRIPT>
    //the applets doSave()
    public void doSave()
    //this frame provides user with the message that document is being
    //saved
    final JFrame frame = new JFrame("Saving");
    JPanel contentPane = new JPanel();
    JLabel label = new JLabel(" Please wait, saving document...");
    frame.getContentPane().add(label,BorderLayout.CENTER);
    frame.setSize(250, 100);
    frame.setLocation(300, 400);
    frame.setResizable(false);
    frame.setVisible(true);
    frame.addWindowListener(new WindowAdapter()
    //the frame is just for user's information, so prevent user from
    //closing it or iconifying it.
    public void windowClosing(WindowEvent e)
    frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    public void windowIconified(WindowEvent e)
    frame.setState(frame.NORMAL);
    //call my saveDocument() method that saves everything to the database.
    editorModule.saveDocument();
    //System.out.println("finished calling saving document");
    //once the saving is done the frame with the message disappears
    frame.setVisible(false);
    //System.out.println("setting frame to false");
    //I also had an exit button in my applet, that would perform the same task, however now with the above onBeforeUnload method, the exit message would appear twice, so had to modify my exit button action performed, so that if the exitbutton was clicked the onbeforeunload method would get passed a null value and not do anything.
    private void exitButton_actionPerformed()
    if (DEBUG) System.out.println("Calling exit");
    doSave();
    window.eval("this.onbeforeunload=null;");
    window.eval("top.close();");
    //continue from here if user cancels the closing of the window
    window.eval("this.onbeforeunload=doSave;");
    window.eval("top.focus()");
    window.eval("document.TestApplet.requestFocus()");
    homePanel.requestFocus();
    }

  • How to handle events in Swng

    Hi!
    I would like to know which one of the following is the best way to handle events in Swing application.
    Method 1
    Write annonymus inner classes in the same class
    Method 2
    =======
    Write a seperate class which extends the adapter class of the event handling and create an object of that in the main class and assign it to the components with addActionHandler() method.
    I am trying to use the second one and I have the following design issue.
    I have a class frmMain.java in which I have a frame and to that frame I am adding a panel which consists of 'N' No. of components.
    I want to make this panel added to the frame when I click on a menu item (login) and want to remove the panel from frame when I click on a menu item(logout).
    I have a main class called Application.java where I create the object of my frame(frmMain.java).
    Thanks in advance,
    AV

    1. Your JFrame is now subject to receive action events from anywhere. You will have to be more careful that you respond only to the right events.
    2. If you have a lot of possible consequences to an event(for example, based on button pressed), you'll need a long if...then...else statement to determine what to do based on the source of the event.
    3. With individual ActionListener classes, it's easier to add the same listener to multiple components and no need to worry about source.
    4. Kind of the same thing: With individual classes, the event and its consequences are so tightly coupled.
    End preaching....basically, my style boils down to what I call the tool set vs Swiss army knife rule. Java seems designed around the concept of a large number of specific purpose classes vs a smaller number of multi purpose classes and I think its a design methodology that makes sense, because I believe strongly in functional isolation in my code.

  • How to handle events between two custom components?

    Hi ,
         i want to handle events between two custom components, example if an event is generated in one custom component ,and i want to handle it any where in the application.....can any one suggest me any tutorial or meterial in this concept...
    thanks

    Events don't really go sideways in ActionScript by default. They bubble upward. If you want to send an event sideways, you will probably have to coordinate with something higher up in the event hierarchy. You can send the event to a common ancestor, and then pass it down the hierarchy as a method argument.
    Another option is to use a framework that supports Injection. There are a number around these days. The one I'm most familiar with is Mate, which allows you to handle events and inject data in MXML. Mate is meant to be used as an MVC framework, and you may want to look into it if your application is complex, but you can also use it to coordinate global event handling if you don't need that level of structure.

  • How to handle events when artboard list change in Illustrator?

    It is very strange for me, but AIEvent has no event type for handle artboard list change events.
    http://cssdk.host.adobe.com/sdk/1.5/docs/WebHelp/references/cshalib/com/adobe/cshostadapte r/AIEvent.html
    May be there are any ideas how to get artboard events: "add", "delete", "reorder" 

    Well, the right event type is AIEvent.DOCUMENT_CROP_AREA_MODIFIED. It is very usefull to play with EventWatcher example from Remote Creative Suite SDK Examples.

  • How to handle Event when more that 2 rows are selected in a WD Table

    Hello WD developers,
    I need your assistance.
    My case is as following:
    I have a WD table populated with data.
    I also have several buttons in the toolbar table.
    One of those buttons should be enabled only in case that one row (and only one)
    is selected in the table otherwise it should be disable.
    The problem is that an even is triggered only when the first row is selected
    and when the second (third....) are selected no event occur.
    Do you have any idea How can I solve this issue.
    Thnaks in advance for your help.
    Regards
    Harry

    Hi,
    In the Onlead selection of table make it visible and invisble of your buttons as per your selection.
    The table have single selection and multi seletion options are availble when you defing the table you can find this options in the properties of the table.
    In onlead selection your button to be mapped with attribute WDVisble.
    And based on your selection you can visible and invisible.
    wdContext.currentContextElement.set<attribute>(WDVisble.Visble);
    and
    wdContext.currentContextElement.set<attribute>(WDVisble.NONE);
    This might helps you.
    Do you need more post your issues.
    Thanks,
    Lohi

  • How to handle event structures for two buttons and two counters.

         *I have two buttons A and B, and have to compare the difference in hits between them.  So do I place an event structure within a while loop for each button (2 buttons, 2 event structures, 2 while loops), or does it need to be one event structure with cases for both buttons whithin one while loop? 
         *How do I pass the values of buttons A and B's hit counters out of the while loop in order to calculate the differences between them after each increment, not just the final count after the stop button is hit? 
         *How would I make one stop button work to handle both buttons A and B?   I tried to place the actual stop button in one button A's structure and its global in B's structure, but It wont seem to let me use a local variable for a latchable control
    Checker

    You should probably have not started a new thread and waited until your question in the original thread was answered. You can modify altenbach's example for a second button. You have a single event structure with a new event for the second button. You have a second shift register to track the number of times the second button is pressed. Inside the while loop but outside the event structure, you just have a subtract function in or to report the difference. do not modify the posted example for the stop button. It works perfectly as is.

  • How to handle event in MVVM ?

    Hi everyone ,
    I'm currently learning to use MVVM model , about command handling, it's ok for me now. But , about Event handling, it causes me some difficulties. 
    Can anyone help me to solve this problem : I have a window and I want to handle the its Closing event . For example, when the window is closing , if the bool chxAllowToClose.IsChecked = true , the window can be closed, vice versa, the window will display a
    warning message : "Please check the checkbox" and then prevent the close operation 
    Thank you

    Windows can be closed in a number of ways and the simplest way to trap them would be to handle Window Closing in code behind.
    This is also the easiest way to show dialogs if that's how you wanted the warning message to appear.
    This:
    chxAllowToClose.IsChecked
    Looks like a checkbox to me, seeing as you have IsChecked.
    That presumably means you already have that bound to a viewmodel and visible to the user.
    You can therefore just test that value from the view.
    If you prefer to hide that instead then there are several options.
    You could have a dependency property and a binding in code behind which binds to the viewmodel. Test that in your event.
    Or
    You could save the value when it changes to application.current.resources.  Since dependency properties and bindings are a bit wordy this is easier.
    Or
    You could have just a variable in the view code behind and use messenger to tell that when the value changes from the viewmodel:
    http://social.technet.microsoft.com/wiki/contents/articles/26070.communicating-between-classes.aspx
    Please don't forget to upvote posts which you like and mark those which answer your question.
    My latest Technet article - Dynamic XAML

  • OOP ALV event on standard toolbar

    Hi everyone,
    I'm using a method SET_TABLE_FOR_FIRST_DISPLAY to create an ALV grid.
    After making it editable I get these "Append", "Insert", "Delete" and "Duplicate Row" buttons in the toolbar by default.
    Is there a way to override the functionality of these buttons?
    My requirement is to make some cells (key fields) editable if a row has been duplicated or a new row has been inserted.
    Thanks in advance,
    Yasantha

    If you implement the toolbar event handler for the class, you can remove icons from the toolbar that you don't want. 
    *   Set up event handlers.
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->toolbar for g_grid.
    METHODS:
          toolbar FOR EVENT toolbar OF cl_gui_alv_grid
                  IMPORTING e_object e_interactive.
    DATA: ls_toolbar type stb_button.
      LOOP AT p_e_object->mt_toolbar INTO ls_toolbar.
        IF ls_toolbar-function = '&REFRESH' OR
           ls_toolbar-function = '&LOCAL&CUT' OR
           ls_toolbar-function = '&LOCAL&COPY' OR
           ls_toolbar-function = '&LOCAL&PASTE' OR
           ls_toolbar-function = '&LOCAL&APPEND' OR
           ls_toolbar-function = '&LOCAL&INSERT_ROW' OR
           ls_toolbar-function = '&LOCAL&DELETE_ROW' OR
           ls_toolbar-function = '&LOCAL&COPY_ROW'.
           DELETE p_e_object->mt_toolbar.
        ENDIF.
      ENDLOOP.

  • How to handle events in J Table (Enter event)

    I created a J Table having multiple rows and columns. I want to have the event to happen on second column, on entering the code on first column, and then pressing ENTER.
    Eg:
    first column i enter code : say A010
    In the code master, the description matching the above code is "HIGH TENSION CABLE".
    When I enter "A010" in the first column and press "ENTER", i want the description to appear in the second column i.e. HIGH TENSION CABLE (by referring the code master, which I already created).
    How this can be handled. Please help me with the code/suggestions. As this urgently required for me in a project, I request the FORUM to help at the earliest.
    Thanking you in advance.
    PS: I shall appreciate if the reply is also sent to my email id: "[email protected]".
    N Murali

    This code would do your work
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    public class TestTable
        private JTable table;
        private AbstractTableModel model;
        private DefaultTableModel defaultModel;
        private JScrollPane jsp;
        public TestTable()
            table = new JTable();
            defaultModel = new DefaultTableModel(10,5);
            setModel(defaultModel);
            jsp = new JScrollPane(table);
            hookSetTextOnEnter();
        protected void hookSetTextOnEnter()
            String actionName = "selectNextRowCell";
            final Action enterAction = table.getActionMap().get(actionName);
            Action myAction = new AbstractAction()
                public void actionPerformed(ActionEvent e)
                    int row = table.getSelectedRow();
                    int column = table.getSelectedColumn();
                    System.out.println(" SELECTING NEXT ROW "+row+""+column);
                    if(row != -1 && column == 2 )
                        Object value = table.getValueAt(row,column);
                        if(value != null && value.toString().equals("A010"))
                        table.setValueAt("HIGH TENSION CABEL",row,column+1);
                    enterAction.actionPerformed(e);
            table.getActionMap().put(actionName,myAction);
        public void setModel(TableModel model)
            table.setModel(model);
        public JScrollPane getScrollPane()
            return jsp;
        public JTable getTable()
            return table;
        public static void main(String[] args)
            TestTable tt = new TestTable();
            JFrame frame = new JFrame("Test Table");
            frame.getContentPane().add(tt.getScrollPane());
            frame.pack();
            frame.setVisible(true);
    }------- Unformatted Version------------
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    public class TestTable
    private JTable table;
    private AbstractTableModel model;
    private DefaultTableModel defaultModel;
    private JScrollPane jsp;
    public TestTable()
    table = new JTable();
    defaultModel = new DefaultTableModel(10,5);
    setModel(defaultModel);
    jsp = new JScrollPane(table);
    hookSetTextOnEnter();
    protected void hookSetTextOnEnter()
    String actionName = "selectNextRowCell";
    final Action enterAction = table.getActionMap().get(actionName);
    Action myAction = new AbstractAction()
    public void actionPerformed(ActionEvent e)
    int row = table.getSelectedRow();
    int column = table.getSelectedColumn();
    System.out.println(" SELECTING NEXT ROW "+row+""+column);
    if(row != -1 && column == 2 )
    Object value = table.getValueAt(row,column);
    if(value != null && value.toString().equals("A010"))
    table.setValueAt("HIGH TENSION CABEL",row,column+1);
    enterAction.actionPerformed(e);
    table.getActionMap().put(actionName,myAction);
    public void setModel(TableModel model)
    table.setModel(model);
    public JScrollPane getScrollPane()
    return jsp;
    public JTable getTable()
    return table;
    public static void main(String[] args)
    TestTable tt = new TestTable();
    JFrame frame = new JFrame("Test Table");
    frame.getContentPane().add(tt.getScrollPane());
    frame.pack();
    frame.setVisible(true);
    Thanks,
    Kalyan

  • How to handle events occuring on different items in a tree control

    I am developing a small application in which I need to display different panels when user clicks on a tree control item....how to make it display a panel inside a parent panel when a user clicks an item in a tree control....any help would be greatly appreciated. thank you
    If you are young work to Learn, not to earn.

    The tree control can handle several events that you can rely on to handle user interaction. I suggest you take a llok at treeevent.prj example that comes with CVI. In your situation, one possible event to handle is EVENT_SELECTION_CHANGE, that marks the operation the user does when clicking on a new tree item.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How to Handle Events for JOptionPane buttons?

    Hi All,
    I need a help...
    I am trying to develop a simple SWING application that consists of multiple elements (mainly text fields) and a Submit button. On pressing Submit button, it should validate all the fields and then do something else. But if some fields are left blank, then it should give a pop-up message and on clicking the OK button on the pop-up message, the focus should go to that text field which is left null.
    The problem is I am not able to understand how to Capture this OK button click-event of the pop-up message. I mean how to do something when the OK/Cancle button of the pop-up window is clicked.
    Please Help me.
    Thanks in Advance,
    Ujjal

    As already pointed out, JOptionPane has some static methods which show a dialog, and return an int, or a string. The whole point of this class is to remove the need for any event handling by the developer, that is, you simply call the showDialog method or whatever, and it returns a value telling you, for example, which button was pressed - no need for action listeners at all. The result of the showDialog method (or whichever you use) tells you which button was pressed. Check the javadocs for JOptionPane for details of several constants that indicate which button was pressed
    The class exists to make simple dialogs trivial to generate - you're overcomplicating things!

Maybe you are looking for

  • House banking, manual cheque lot creation,

    hello, house banking, manual cheque lot creation, the first feild to enter is payment document number, from where we get that payment document number, just entered the payment posting number, but count not save ,

  • Number to date

    Hi Experts, I have a DATE_WID column as Number(10). I want to convert this to Date format in MM/DD/YYYY in BMM layer. How can I do that? thx, parag

  • New iPod catagory and Disk access problem

    OK, what is the new "Other" catagory along with the Audio Video and Games that are at the bottom of the iPod screen. It has about 80 MB of stuff on my iPod, but I have no idea what. Also, iTunes says that Disk Access is off (Unchecked) but I can see

  • Media Manager Woes

    My apologies in advance if this topic has already been posted and answered; I could not find it & I'm under the gun... We lost all the captured footage for 2 30-minute shows; but we retained the projects intact. They were 90% complete, and we had cut

  • Jax-ws ws-addressings non-anonymous replyto header asynchronous client

    Hi All, I have an asynchronous jax-ws client with addressingfeature enabled. This will add the replyto header as anonymous and open a client listening port for the reply message when I execute the asynchronous method to the server. The client is then