ALV Grid editable - How to raise the data_changed event from outside object

Hi,
i'd like to like to raise the data_changed event from outside the ALV-Grid object in order to display errors to the user.
For example a new row was inserted within the program. The user has only to complete the missing informations. Before saving the transactions the program has to execute some semantic checks. The errors of this check process should be shown to the user by creating an instance of the cl_alv_changed_data_portocol object.
Thanks.
Regards

You don't need to raise the data_changed event to perform the edits or to issue messages using cl_alv_changed_data_protocol.
The following assumes you have an ALV grid object g_alv based on the CL_GUI_ALV_GRID class.
You can mark the inserted records upon insertion as selected using the set_selected_rows method, and then retrieve these rows later using get_selected_rows and perform necessary edits.
Save the row number of each inserted row into a table of the appropriate type (see the method definition for this):
DATA: t_index_rows    TYPE  lvc_t_row.
DATA: s_row_no        TYPE  lvc_s_roid.
DATA: t_row_no        TYPE  lvc_t_roid.
Load entries into t_row_no after each insert.  Capture the row number and save in the table t_row_no.
e.g.
PERFORM insert_row USING s_row_no-row_id.
APPEND s_row_no TO t_row_no.
FORM insert_row would have whatever code you are using to insert the row.  Save the row id into s_row_no-row_id (which is an INT4).
When done with all inserts do the following
  IF t_row_no[] IS NOT INITIAL.
    CALL METHOD g_alv->set_selected_rows
      EXPORTING
        it_index_rows            = t_index_rows
        it_row_no                = t_row_no
        is_keep_other_selections = 'X'.
  ENDIF.
Then, if SAVE is pressed without the data_changed event having been raised (such as if the user just pressed SAVE without changing anything), use method get_selected_rows to retrieve the rows that were inserted and perform the necessary edits.
  DATA: l_t_rows    TYPE lvc_t_row.              " ALV control: Table rows
  CALL METHOD g_alv->get_selected_rows
    IMPORTING
      et_index_rows = l_t_rows.
Loop through l_t_rows and use the row as an index into the grid, perform the necessary edits, just as you would if the data_changed event had been raised.
If any edits fail, then send messages to the user, abort the save, and re-display the grid.
Remember to refresh the t_row_no and t_index_rows tables if you load a new data set.
You can also use a similar technique with the data_changed event to mark each changed row as selected by saving the row ids, and then you only have to update the changed rows on SAVE, which can minimize database I/O.
Good luck.
Brian

Similar Messages

  • How to catch the mouse event from the JTable cell of  the DefaultCellEditor

    Hi, my problem is:
    I have a JTable with the cells of DefaultCellEditor(JComboBox) and added the mouse listener to JTable. I can catch the mouse event from any editor cell when this cell didn't be focused. However, when I click the editor to select one JComboBox element, all the mouse events were intercepted by the editor.
    So, how can I catch the mouse event in this case? In other word, even if I do the operation over the editor, I also need to catch the cursor position.
    Any idea will be highly appreciated!
    Thanks in advance!

    Hi, bbritta,
    Thanks very much for your help. Really, your code could run well, but my case is to catch the JComboBox event. So, when I change the JTextField as JComboBox, it still fail to catch the event. The following is my code. Could you give me any other suggestion?
    Also, any one has a good idea for my problem? I look forward to the right solution to this problem.
    Thanks.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Test3
    extends JFrame {
    // JTextField jtf = new JTextField();
    Object[] as = {"aa","bb","cc","dd"};
    JComboBox box = new JComboBox(as);
    public Test3() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container content = getContentPane();
    String[] head = {
    "One", "Two", "Three"};
    String[][] data = {
    "R1-C1", "R1-C2", "R1-C3"}
    "R2-C1", "R2-C2", "R2-C3"}
    JTable jt = new JTable(data, head);
    box.addMouseListener(new MouseAdapter() {
    // jtf.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e)
    System.out.println("-------------------JComboBox mouseclick....");
    jt.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e)
    System.out.println("-------------------JTable mouseclick....");
    // jt.setDefaultEditor(Object.class, new DefaultCellEditor(jtf));
    jt.setDefaultEditor(Object.class, new DefaultCellEditor(box));
    content.add(new JScrollPane(jt), BorderLayout.CENTER);
    setSize(300, 300);
    public static void main(String[] args) {
    new Test3().setVisible(true);
    }

  • How to execute the InDesign Javascript from outside in MAC

    Hi All,
    I need to execute the InDesign Javascript from outside in MAC machine.
    Anyone can help me.
    Thanks in advance.
    Regards,
    Ramkumar

    If you just want to imitate double clicking a file, use execute() method, e.g.:
    var myJavaScriptFile = new File("~/Desktop/Test.jsx");
    myJavaScriptFile.execute();
    At the top of your .jsx file type #target indesign to make the script run in InDesign.
    And I want to add to what Harbs said in the previous post: when you use do script command, you can also send parameters and get back values. See DoScriptParameters and DoScriptReturnValues sample scripts from InDesign CS3 Guide Scripts for details.

  • Toolkit for CreateJS: How to control the main timeline from outside the canvas.

    Hey Everyone,
    I'm currently trying to do something simple, but my animation breaks whenever I attempt to change my code. I have created a basic animation in Flash where an object moves from the left side of the canvas, to the right, and then loops from the last frame to the first frame. Nothing else. The animation is simply put on the main timeline. I exported the animation with Toolkit for CreateJS through Flash's extension and the animation runs as it should. I am trying to start and stop (restarting from the first frame) the animation with mouse over and mouse off events. I want the events to fire when moused over/off a div OUTSIDE the animation's canvas tag. Is this possible with CreateJS? I'm trying to figure out how to control the main timeline without being inside the canvas tag.
    Example HTML:
    http://www.thephotoncore.com/testing/example_test.html
    Example Code:
    <section id="container">
      <canvas id="canvas" width="550" height="400" style="background-color:#cccccc"></canvas>
      <section id="animation_control">
        <p>Roll over to start and stop animation.</p>
      </section>
    </section>
    Thanks again for the help!
    -DJ

    Hi DjPhantasy5,
    All movieclips on the stage are children of the stage,
    So on the "mouseover" all movieclips on the stage could be stopped with stop and on the "mouseout" all children could be restarted with gotoAndPlay like this:
    function Stop()
              if (stage && stage.children)
                        var i, l = stage.children.length;
                        for (i = 0; i < l; i++)
                                  var child = stage.children[i];
                                  if ("stop" in child)
                                            child.stop();
    function Restart()
              if (stage && stage.children)
                        var i, l = stage.children.length;
                        for (i = 0; i < l; i++)
                                  var child = stage.children[i];
                                  if ("gotoAndPlay" in child)
                                            child.gotoAndPlay(0);
    See http://www.liauw.nl/forums/adobe/djfantasy5/index.html
    But it is also possible to expose "ball1", for example, by adding it to the document.
    This can be done by adding code to "ball1" like so:
    /* js
    document.ball1 = this;
    Then the stopping of the animation would look like:
    function Stop()
         if ("ball1" in document)
              document.ball1.stop();
    etc.
    Have fun!
    Ronald

  • How to Remove the Entity usage from View object at runtime

    Hi,
    A ViewObject can be created dynamically based on the Existing ViewObject Defintions. The newly created dynamic ViewObject will have all the defintion including Attributes, its structure along wtih Entity usage of the existing ViewObject definition.
    My requirement is i don't want to have the Entity usage alone whereas Remaining structure need to be retained.
    Can any body suggest on how to do it.
    regards.

    Hi,
    design time or runtime? At designtime, have you tried to just remove the entity reference? Given the disadvantage of removing the entity (and the changed behavior associated with it) what is the use case for which you want to disable the entity reference?
    Frank

  • How to raise Remote System Event

    Hi,
    I need to load data from a remote DB system (Not SAP system) when data is created or modified.  I setup DB Connect to load the remote data with an event triggered InfoPackage.  How can remote system trigger the local event?
    Thanks,
    Frank

    Frank, there should be a command on the server that your R/3 or BW system resides on called <b>sapevt</b>.  This command sits outside the SAP system and its sole purpose is to allow you to raise an SAP event from outside the SAP system.
    check out the following link:
    http://help.sap.com/saphelp_erp2004/helpdata/en/fa/096e6b543b11d1898e0000e8322d00/frameset.htm
    Regards,
    George

  • ALV GRID Edit Validations (how to do your own)

    Hi folks, I am using ALV Grid to enter some data, I would like to do some validations on save and also adjust data in the table and validate it upon another few buttons.
    All is good and works fine using the standard events, however these events are only triggered if you directly change the data yourself, <b>I need validates once a button is hit</b>.
    I have been playing with the following methods, and the cells are returned in the "good" list and the mod list (as expected), but the cell on the screen is not highlighted in red, and if you change something on the screen, the messages you have added are then lost.
      CALL METHOD p_grid->change_data_from_inside
        EXPORTING
          it_style_cells = lt_modi.
    Has anyone added there own custom validations upon hitting a button - in a manner that the red cell border is shown?
    I have tried both of these handlers:
    CALL METHOD p_defn-grid->register_edit_event
       EXPORTING
         i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    **Own event on enter or ucomm
      CALL METHOD p_defn-grid->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    I am adding in my messages in event data_changed, using method add_protocol_entry of class cl_alv_changed_data_protocol - this is passed to me in the data_changed event.
    I have also looked at the data_changed_finished event, but cant get anything from that either - it doesn’t even keep my good fields.
    Ps I have also played with the layout setting layout-val_data = 'X' and space and "C" - but the messages are still not kept, and cells not bordered in red.
    The solution may have something to do with triggering the event manually somehow - but i cant find a way to call a method that would do it as they are all private!
    thanks in advance - this is a tricky one!

    Adobe Pat 206
    You cannot create a Premiere Elements (any version) DVD Template from scratch using Photoshop Elements (any version). To do that you need Photoshop CS or higher. The reason for "higher" is that earlier Photoshop versions do not support Layers Groups within the Layer Groups.
    But, providing you find a version of Photoshop Elements on a given computer operating system that will open the Photoshop Layer Groups in its key structure (.psd file), you can use Photoshop Elements to edit (not create from scratch) the .psd file for the main and scene menus of a given existing Adobe theme. I am careful on my language here since there have been recent difficulties getting Photoshop Elements to do this job which it once did without issue.
    The process is easy enough, but very detail dependant, with strict requirements for names files as well as Layer Groups, sublayers groups, and layers in the .psd file. To give you an idea of what is involved, please check out two articles I have written related to Premiere Elements DVD Template creation and customization.
    http://www.elementsvillage.com/forums/showthread.php?t=56244
    http://www.atr935.blogspot.com/2013/05/pe-one-page-14-scene-buttons-dvd-menu.html
    Not placing the new menu in the correct directory and any error in spelling and such are just some of the ingredients for failure in this type of project.
    Unless you want to add extra buttons to a menu, it might be easier for you to explore customization opportunties in the Movie Menu section of the program. See Tools/Movie Menus. The Movie Menus customization area should look like this
    Note that the Adjustments...Menu Background shows Video or Stills among other things.
    If you have questions on anything that I have written, please ask me here in your thread.
    You can also check out the Adobe documentation on this type of topic.
    http://help.adobe.com/en_US/premiereelements/using/WS09e4b3c48f3a79fc19b622510385d4355c-7e 0c.html
    Thanks.
    ATR

  • Multiple Input Rows In ALV Grid (Editable)

    Hi,
    I have an editable ALV grid and need to have multiple blank rows ready for input. Something similar to what happens when you click the "New Entries" button in SM30 (Table Maintainance).
    There is a local function for appending lines in the ALV grid toolbar but this only allows a single entry.
    I have replaced the local function with my own button (same icon etc) and on user_command event, I am appending several blank lines to my output table.
    However these lines are not being shown on the screen. I have looked through the layout and field catalog but there is no field to allow blank lines to be shown.
    My 2 questions are:
    1. Is there some standard way of entering multiple entries in ALV Grid Editable.
    2. If not then how to allow blank lines to be shown as ready for input.
    Also if someone could suggest a way to do error checking for all entries on the screen especially duplicate entries I will be extremely grateful.
    Many Thanks,
    Preet

    Hi, Preet!
    You can easily do whatever checks you wish. You should declare an event handling method for event DATA_CHANGED and call the ADD_PROTOCOL_ENTRY method of the ER_DATA_CHANGED event parameter (it's an object of the class CL_ALV_CHANGED_DATA_PROTOCOL). You must not forget to set handler for your ALV grid.
    For example, this piece of code checks for all changed fields resulting in error message if they are initial. In short, this makes all the fields obligatory.
    METHODS: on_data_changed FOR EVENT data_changed OF cl_gui_alv_grid IMPORTING er_data_changed.
    SET HANDLER your_object->on_data_changed FOR your_alv_grid.
    METHOD on_data_changed.
    DATA: s_mod_cell TYPE lvc_s_modi.
    LOOP AT er_data_changed->mt_mod_cells INTO s_mod_cell.
        IF s_mod_cell-value IS INITIAL.
    *       issue message 'Make an entry in all required fields'
            CALL METHOD er_data_changed->add_protocol_entry
              EXPORTING i_msgid     = '00'
                        i_msgno     = '055'
                        i_msgty     = 'E'
                        i_fieldname = s_mod_cell-fieldname
                        i_row_id    = s_mod_cell-row_id.
        ENDIF.
    ENDMETHOD.
    Furthermore, if you make your class inherited from CL_GUI_ALV_GRID you can make use of protected attribute MT_OUTTAB which is a data object referencing your output table. Then you can have:
    FIELD-SYMBOLS: <outtab> TYPE STANDARD TABLE.
    ASSIGN me->mt_outtab->* TO <outtab>.
    * do whatever you want with <outtab>
    Hope this helps.
    Kind regards,
    Igor
    P.S. Regarding the blank lines that you need, what's wrong with standard ALV grid buttons "Append row" and "Insert row" which appear whenever the grid is editable (unless you deliberately remove them)? They work just fine with me (just like on SM30). I don't see reason for programatically appending lines to your internal table.

  • ALV Grid editable fields

    Hello,
    I got a dynpro with 3 ALV grids. I edit a value of grid 3, then I execute a pushbutton of grid 1. The value of grid 3 is resetted then.
    What should I do to keep the value?
    Reward points guaranteed.
    Regards
    René

    Sounds like the event handler method for event data_changed  is not being fired.  In one of my programs, I am registering the "ENTER" key, the user must hit enter after editing the field to fire the data_changed event. 
    * Set for first display
            call method alv_grid->set_table_for_first_display
                exporting
                     is_layout              = lt_layout
                     it_toolbar_excluding   = lt_exclude
                changing
                     it_outtab       = ialv[]
                     it_fieldcatalog = fieldcat[].
    * If cancelling points, register "ENTER" as event
    * and create the event receiver
    <b>          call method alv_grid->register_edit_event
                            exporting
                               i_event_id = cl_gui_alv_grid=>mc_evt_enter.</b>
    *   create Event Receiver
              create object event_receiver.
    *   handler for ALV grid
              set handler event_receiver->handle_data_changed for alv_grid.
    Do this records the changes that the user has made.  I believe that this must be done before you start the processing of the button on Grid1.
    Regards,
    Rich Heilman

  • How could control the scroll events in ALV OO?

    Hello experts!
    I'm programing a report, inside there is a field that need time of processing. I'm using ALV OO.
    I have thought that it could only calculate the field for the lines that visualize.
    How could control the scroll events to calculate the field of the visualized lines?
    I'm using CL_SALV_TABLE class and cl_salv_events_table to control the events, but there aren't any event to control the scroll.
    best regards!

    Hi Sriram,
    I did view the information that you was attaching, but this don't resolve my problem. With methods get_scroll_info_via_id and set_scroll_info_via_id, we can get and put information of selection and view rows in the screen but we don't control when the user click in the scroll for advance or to back down a page.
    I would like to refresh the data in ALV when the user view news rows.
    I want your genial ideas.
    Best regards!

  • How to raise the ringtone volume in nokia 5200??

    i cant figure it out how to raise the ringtone voice on my nokia 5200, when someone calls me the ringtone voice is low and than after like 4 seconds it goes higher and higher to the maximum...i want the ringtone volume to be at the maximum from the first second that someone calls me, some help would be great

    hi,
    What you need to do is go into:
    "Settings" then "Tones" and make sure "Incoming Alert" is changed to "Ringing" rather than "Ascending"
    I hope this helps.

  • ALV grid - using f4 search help - want separate value from hit list

    I have the following scenario that I am trying to resolve.
    I have created my own search help with a search help exit for a bespoke maintenance table which lists categories against HR positions which are to receive workflow for these categories.  I am designing a front-end for this table using an ALV grid whereby the person holding that position (i.e. name) is shown instead of position number.  The search help allows you to select by First name and last name and brings up a hit list which includes employee number, first name last name, formatted name field, position number, position description and org unit it belongs in.
    The issue occurs where the list brings back more than one hit.
    e.g.:
    1 Fred     Bloggs Fred Bloggs 50000001  pos1  org 1
    2 Frederic Bloggs Fred Bloggs 50000002  pos2  org 3
    If you select an entry, the formatted name field goes in the ALV grid field. I call the search help via F4IF_FIELDVALUE_REQUEST using the onf4 event .
    What I want to do is retrieve the position number of the entry selected and put this into another table without having to add this to my ALV grid and make available for input. I want to use name only for the input in my ALV grid (i.e. if I select the second example, the return table in F4IF_FIELDVALUE_REQUEST shows the name Fred Bloggs but does not show the position number which I need to add to another table to update my maintenance table).
    Can anyone suggest any way around this?
    Many thanks
    Larissa

    You are right, you can add this fields as an import parameter to the list.
    In Custom search help you must have marked fields as Export or Import parameters.
    If field is marked as Export parameters, it will be displayed in the selection pop up.
    If Import paramter check box is selected then this will be imported to the screen.
    Check this SAP documentation for both these options -
    Flag for IMPORT parameter of the search help                      
         Flag if the parameter is an import parameter.                                                                               
    Context information from the processed input template (screen) can be
         copied to the help process with an import parameter. Where an import 
         parameter gets its values from is defined when the search help is    
         attached to the corresponding field of the input template.           
    Flag for EXPORT parameter of the search help                                                                               
    Flag if the parameter is an export parameter.                                                                               
    Values can be returned from the hit list to the input template (screen)
         with an export parameter. The fields of the input template in which the
         contents of the export parameter are returned are defined by the search
         help attachment.
    Message was edited by: Ashish Gundawar

  • How to get the return values from a web page

    Hi all :
       how to get the return values from a web page ?  I mean how pass values betwen webflow and web page ?
    thank you very much
    Edited by: jingying Sony on Apr 15, 2010 6:15 AM
    Edited by: jingying Sony on Apr 15, 2010 6:18 AM

    Hi,
    What kind of web page do you have? Do you have possibility to for example make RFCs? Then you could trigger events (with parameters that could "return" the values) and the workflow could react to those events. For example your task can have terminating events.
    Regards,
    Karri

  • How to remove the credit card from the Apple id?

    how to remove the credit card from the Apple id?
    plz ITS urgently

    If the option to select "None" isn't appearing when you attempt to edit your payment information, then there is likely a billing issue with your last iTunes Store purchase(iTunes didn't receive payment from your credit card company for that order). Before you can remove your credit card, you have to pay for the unpaid order. You can call your credit card company and troubleshoot the billing issue with them, or try another card, or if you live in a country that supports iTunes Gift Cards, you can redeem one of those to pay for the order. Once you have done that, you should be able to remove your credit card info as outlined in http://support.apple.com/kb/ht1918

  • How to stop the gray wheel from spinning after logging out

    how to stop the gray wheel from spinning after logging out?

    Frank ...
    Make sure to quit all open applications before logging out.
    Your proflie indicates your Mac has v10.7.1 installed.
    If that is the case, updating your system software will help as far as functionaly as well as security.
    Install the OS X Lion Update 10.7.5 (Client Combo)
    Then restart your Mac.
    message edited by:  cs

Maybe you are looking for