Problem handling data_changed event in OO ALV

I'm displaying my internal table with an OO ALV and I'm trying to handle the data_changed event in order to do some checking before actually modify my internal table.
this is the code of how I was planing to do that:
handle_data_changed
        FOR EVENT data_changed OF cl_gui_alv_grid
            IMPORTING er_data_changed
                      e_onf4
                      e_onf4_before
                      e_onf4_after
                      e_ucomm.
METHOD handle_data_changed.
*    IF er_data_changed->mt_mod_cells-fieldname = 'COD_M'.
*         do something
*    else if er_data_changed->mt_mod_cells-fieldname = 'QUANTIDADE'.
*         do something else
*    endif.
*  alv->refresh_table_display.
  ENDMETHOD.                           "handle_data_changed
but it gives me this error:
"MT_MOD_CELLS" is a table without a header line and therefore has no component called "FIELDNAME".
My question is, how can access the cell that is being modified, and the new data?

Dont know if this is the most clever way to do it but i solved it like this
DATA: wa_data_changed TYPE lvc_s_modi,
          wa_tabi TYPE zsl_mat_c.
    READ TABLE er_data_changed->mt_mod_cells INDEX 1
                                             INTO wa_data_changed.
    IF wa_data_changed-fieldname = 'COD_M'.
*     do something
    ELSEIF wa_data_changed-fieldname = 'QUANTIDADE'.
*     do something else
    ENDIF.
thanks for your help

Similar Messages

  • Trigger DATA_CHANGED event from triggered DATA_CHANGED event in second ALV

    Hello,
    I do have 2 ALVs (class CL_GUI_ALV_GRID) in a Splitter-Control.
    Both ALVs do have registered the event DATA_CHANGED in seperate handler methods.
    If there is a change in first ALV(line insertion with values), there will be inserted a new line with values in the second ALV.  After handling the event at first ALV, I call CHECK_CHANGED_DATA of the second ALV and REFRESH_TABLE_DISPLAY of the second ALV. I would expect that the call of CHECK_CHANGED_DATA would trigger the event DATA_CHANGED, but it does not trigger the event DATA_CHANGED of the second ALV.
    The problem is maybe that the input at the data is not made by the user(UI).
    What could I do to trigger this event and check the new data at second ALV?
    Yours Joerg

    Hello ,
    yeah thats correct , but in your case what you can do is
    g_grid1(first alv) >CHECK_CHANGED_DATA( Importing E_VALID =  l_Valid )>in the implementation method of this ..update global variable g_second = 'X' in order to refresh ALV2.
    g_grid1(first alv) -->Refresh_table_display( ).
    if g_second = 'X'.
    g_grid2-->SET_TABLE_FOR_FIRST_DISPLAY. so it will refresh the second alv contents.
    endif.
    regards
    Prabhu

  • How to handle the event "GROUPLEVEL_CHANGE" in ALV?

    Hi,
    I have done a BLOCL ALV report. In i am sorting the first field and not displaying it. But for every change in the first field page break should happen and the particular field is to be printed at every page break at the top. I am handling the page break by passing the IT_SORT-GROUP = '*'. there fore the page breaking is happening well. now i need to have a control such that i print the first field at every page break.
    Please help on this...........
    I think the event GROUPLEVEL_CHANGE is to used please tell me the parameters to be passed for this subroutine
    (Defenitely point will be given)

    Hi,
    Check the below thread...
    Re: Adding row after subtotal in ALV
    Regards,
    Maha

  • Problem handling JFileChooser events...

    The problem I have is rather tricky to explain. I feel maybe I'm treading on an area I'm not ready for yet... but here goes:
    I have a JInternalFrame with an "open" button which triggers the JFileChooser and underneath a text field to log activity. My goal is simply to have a String array of all the filenames selected ( one at a time, whilst adding to the array ).
    All seems well to start with. I have a System.out.println running after each filename is added to the array, and it verifies that they are being added successfully.
    The problem comes just after that... When I call for the String array, it appears to be empty!
    I'm sure that this will be a foolish mistake on my behalf, but still, I'm yet to spot it!
    this is the code where the filenames are added to the array:
    public void actionPerformed(ActionEvent e) {
                if (e.getSource() == openButton) {
                int returnVal = fc.showOpenDialog(FileSelector.this);
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();
                str[a] = file.getName();
                a++;
                   log.append("File: " + file.getName() + " added to list" + newline);
            } else {
                   log.append("Open command cancelled by user." + newline);
               log.setCaretPosition(log.getDocument().getLength());
         System.out.println(str);
    }I'm not sure what other bits of code are needed, so ill hold fast.
    cheers in advance for any help.
    John.

    The error message says it all:
    "java.lang.IllegalArgumentException: cannot add to layout: constraints must be a GridBagConstraint"
    You are apparently adding something to a panel that uses a GridBagLayout, but the constraint you are specifying is not a GridBagConstraints.
    JPanel pnl = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    pnl.add(new JLabel("correct"), c);
    pnl.add(new JLabel("wrong"), BorderLayout.CENTER);The second add in the above code will cause the error you are getting. This would also explain why it works when you are using a BorderLayout.
    Here is the relevant code:The code you posted was not the relevant code. The relevant code is what takes place in your button's ActionListener. There you call the method gotoNextSection(), which you did not post.

  • DATA_CHANGED event handler is not triggered after input.(OO ALV)

    Dear Experts,
    What I did:
    I register Enter as the trigger event for data_changed event, and I put my checking logic in data_changed_handler which is a method of a local class. When the checking fails, I put messages using er_data_changed->add_protocal_entry to show messages.
    My checking is simple, if the cell is empty, error messages pops up tells that this cell can not be blank for this row.
    My problem:
    When there is no entry in the alv list(Only this situation), I insert a new entry, the cell which is required is empty, I press Enter, data_changed event is triggered, the message pops up saying that the cell is required. Then close the pop up message window, I input something in the cell, and press enter. The data_changed event is not triggered.
    Is there any1 has any ideas on this problem?
    Vicnent
    Edited by: Changjiu Tan on Sep 7, 2009 1:33 PM

      METHOD HANDLE_DATA_CHANGED.                               "#EC NEEDED
    *<<<  BEGIN MODIFY EXAMPLE CODE
    *   u4FDDu5B58u30C7u30FCu30BFu3092u7DE8u96C6u3059u308Bu3000START
        DATA: LW_INS      TYPE LVC_S_MOCE,
              LV_FNAME    TYPE LVC_FNAME,
              LW_MOD      TYPE LVC_S_MODI,
              LV_MAX      TYPE I,
              LV_RES(12)  TYPE C,
              LW_LIST     TYPE ZTSRE012,
              LV_ROWID    TYPE LVC_S_ROID,
              LT_MOD      TYPE LVC_T_MODI,
              LV_COLID    TYPE LVC_S_COL,
              LV_ROW_ID    TYPE LVC_S_ROW,
              LV_COL_ID    TYPE LVC_S_COL.
    *   u73FEu5728u306Eu30D5u30A9u30FCu30ABu30B9u4F4Du7F6Eu3092u53D6u5F97
        CALL METHOD GO_ALV_GRID7->GET_CURRENT_CELL
          IMPORTING
            ES_ROW_ID = LV_ROW_ID
            ES_COL_ID = LV_COL_ID.
        LOOP AT GT_LIST INTO LW_LIST.
          IF LW_LIST-ID > LV_MAX.
            LV_MAX = LW_LIST-ID.
          ENDIF.
        ENDLOOP.
    *   u30B0u30EBu30FCu30D7ID
        LV_FNAME = CNS_ID.
        LOOP AT ER_DATA_CHANGED->MT_INSERTED_ROWS INTO LW_INS.
          LV_MAX = LV_MAX + 1.
          CALL METHOD ER_DATA_CHANGED->MODIFY_CELL
            EXPORTING
              I_ROW_ID    = LW_INS-ROW_ID
              I_FIELDNAME = LV_FNAME
              I_VALUE     = LV_MAX.
        ENDLOOP.
        CLEAR: LV_FNAME.
        LT_MOD[] = ER_DATA_CHANGED->MT_GOOD_CELLS[].
    *   u30C7u30FCu30BFu30C1u30A7u30C3u30AF
        LOOP AT LT_MOD INTO LW_MOD.
          IF LW_MOD-FIELDNAME = CNS_ZZTTSN.
            LV_COLID-FIELDNAME = LW_MOD-FIELDNAME.
            LV_ROWID-ROW_ID    = LW_MOD-ROW_ID.
            CALL METHOD GO_ALV_GRID7->SET_CURRENT_CELL_VIA_ID
              EXPORTING
                IS_COLUMN_ID = LV_COLID
                IS_ROW_NO    = LV_ROWID.
            CALL METHOD GO_ALV_GRID7->GET_CURRENT_CELL
              IMPORTING
                E_VALUE = LV_RES.
            IF LV_RES IS INITIAL.
              CALL METHOD ER_DATA_CHANGED->ADD_PROTOCOL_ENTRY
                EXPORTING
                  I_MSGID     = CNS_MSGID
                  I_MSGTY     = CNS_MSGTY
                  I_MSGNO     = CNS_MSGNO
                  I_FIELDNAME = LW_MOD-FIELDNAME
                  I_ROW_ID    = LW_MOD-ROW_ID.
            ENDIF.
            CALL METHOD ER_DATA_CHANGED->MODIFY_CELL
              EXPORTING
                I_ROW_ID    = LW_MOD-ROW_ID
                I_FIELDNAME = LW_MOD-FIELDNAME
                I_VALUE     = LV_RES.
           ENDIF.
          CLEAR:  LV_RES,
                  LV_COLID,
                  LV_ROWID.
        ENDLOOP.
        CALL METHOD GO_ALV_GRID7->SET_CURRENT_CELL_VIA_ID
          EXPORTING
            IS_ROW_ID    = LV_ROW_ID
            IS_COLUMN_ID = LV_COL_ID.
      ENDMETHOD.                    "handle_data_changed
    Edited by: Changjiu Tan on Sep 7, 2009 1:31 PM
    Edited by: Changjiu Tan on Sep 7, 2009 1:32 PM

  • ALV Grid Handle Edit Event (Lost Focus)

    Hi all,
    I have some problems with the ALV Grid.
    Target:
    I have an ALV Grid with editable Column. If the user insert, update or delete the content of the column and leave the column (column lost focus) i'd like to do somthing - this means I need a event for this action. Can anybody help me to solve this problem?
    Thanks Stefan

    Use Event data_changed and data_changed_finished of the cl_gui_alv_grid.Then all you have to do is registering your event to the ALV and fill the methods with what you want to do.In ALV Grid, There is no event to capture the lost focus of a column if you don't modify it.
    CLASS lcl_event_receiver DEFINITION.
        METHODS:
    *$ Check the change
           handle_data_changed FOR EVENT data_changed
                                   OF cl_gui_alv_grid
                               IMPORTING er_data_changed
                                         e_ucomm
                                         e_onf4
                                         e_onf4_before
                                         e_onf4_after,
           handle_data_changed_finished
                               FOR EVENT data_changed_finished
                                   OF cl_gui_alv_grid
                                IMPORTING e_modified
                                         et_good_cells
                                         sender,
    ENDCLASS.                    "LCL_EVENT_RECEIVER DEFINITION

  • ABAP WebDynpro: Handling the ON_ENTER Event in editable ALVs

    Sub: ABAP WebDynpro : Handling the ON_ENTER Event in editable ALVs
    Hi,
    I would like to know if there exists an event to handle TABout (i.e, when user navigates out of the cell with a TAB key-press) for a cell of an editable ALV.
    Alternatively, any help on how to handle ON_ENTER event and how it is triggered when data is entered by user into a cell of an editable ALV, would be really appreciated.
    Thanks,
    Adithya

    Hi
    I had one similar problem where user enter something into the editable cell and press enter. to handle this scenario i used WDDOBEFOREACTION  method of my view to call alv interface method check_data.
    if there is any change in the any table cell, it will fire an event on_data_check..which has paramater column name, row index and new and old value of the cell.
    you can handle this event and write your business logic in event handler method.
    hope it will help
    Regards
    Saurabh Garg

  • How to handle selection event in alv component

    Hi all,
        i am new to webdynpro abap. and i want to know how to handle selection event(such as select all / unselect ) in my simple alv application.
    Thanks very much

    Hi,
    By default when you use the selection mode for the ALV as Multi/Mutli No Lead then this option is enabled.
    Try to implement the event ONLEADSELECT and check wether this event is triggered or not.
    DATA: lo_value type ref to cl_salv_wd_config_table.
        CALL METHOD  lo_value->if_salv_wd_table_settings~set_selection_mode
          EXPORTING
            value = cl_wd_table=>e_selection_mode-multi_no_lead.
    Try to implement these event for ALV and put a break-point and test which event is getting triggered.
    ON_CLICK           
    ON_DATA_CHECK      
    ON_FUNCTION        
    ON_LEAD_SELECT     
    ON_STD_FUNCTION_AFTE
    ON_STD_FUNCTION_BEFO
    Please provide more inputs.
    Regards,
    Lekha.

  • Problem when handling Portal events

    Hi all,
    I am trying to handle portal events between two Iviews on a same page.For this I am using all the necessary parts from coding prospectives(eg. Event fire, Subscribe event and action handler method).
    But I am not able to handle portal events.I found some properties on Iview and page level as:
    1) Web Dynpro Client on Iview level - Default auto (Some threads suggest that events only works on HTML pages).
    I change it to plain HTML, but having doubt that is this value passed to this property.
    2) ID Prefix - Default blank (I-View level)
    I assign com.sap to it and also assign application name to ID.
    Is these will affect something on Portal handling.
    I also watch some e-learning sessions, I do similer to those sessions but at my end I still facing problem.
    Please suggest what I will do more to handle Portal events.
    Thanks
    Sanket sethi

    I am using this code to  fire and catch Portal events.Please look at the code and suggest where I am lacking.
    Fire:
    data node                               type ref to if_wd_context_node.
    data portal_event_namespace  type string value 'urn:com.sap.webdynpro.testApplications.testEvent'.
    data portal_event_name          type string value 'FMP_EVENT'.
    data portal_event_parameter   type string.
      data lr_componentcontroller type ref to ig_componentcontroller .
      data l_api_componentcontroller type ref to if_wd_component.
      data lr_port_manager type ref to if_wd_portal_integration.
      lr_componentcontroller =   wd_this->get_componentcontroller_ctr( ).
      l_api_componentcontroller = lr_componentcontroller->wd_get_api( ).
      lr_port_manager = l_api_componentcontroller->get_portal_manager( ).
      lr_port_manager->fire(
        exporting
          portal_event_namespace = portal_event_namespace
          portal_event_name      = portal_event_name
          portal_event_parameter = portal_event_parameter ).
    Catch: (Register and receive parameter)
      data node                                  type ref to if_wd_context_node.
      data subscribe_hello                   type wdy_boolean.
      data  view                                  type ref to if_wd_view_controller.
      data  portal_event_namespace    type string value 'urn:com.sap.bc.webdynpro.<namerspace>.<Name>.
      data  portal_event_name             type string value 'FMPEVENT'.
    here is the name of the action where the portal event will be received!
    you have to create this action in the application!!
    data  portal_event_action_name  type string value 'RECEIVE_PORTAL_EVENT'.
      data lr_componentcontroller type ref to ig_componentcontroller .
      data l_api_componentcontroller type ref to if_wd_component.
      data lr_port_manager type ref to if_wd_portal_integration.
    DATA lo_api_component  TYPE REF TO if_wd_component.
    DATA lo_portal_manager TYPE REF TO if_wd_portal_integration.
    lo_api_component = wd_comp_controller->wd_get_api( ).
    lo_portal_manager = lo_api_component->get_portal_manager( ).
    DATA lo_api_controller  TYPE REF TO if_wd_view_controller.
    lo_api_controller ?= wd_this->wd_get_api( ).
    CALL METHOD lo_portal_manager->unsubscribe_event
      EXPORTING
        portal_event_namespace = portal_event_namespace
        portal_event_name      = portal_event_name
        view                   = lo_api_controller
      lr_componentcontroller =   wd_this->get_componentcontroller_ctr( ).
      l_api_componentcontroller = lr_componentcontroller->wd_get_api( ).
      lr_port_manager = l_api_componentcontroller->get_portal_manager( ).
      view ?= wd_this->wd_get_api( ).
       call method lr_port_manager->subscribe_event
          exporting
            portal_event_namespace = portal_event_namespace
            portal_event_name      = portal_event_name
            view                   = view
            action                 = portal_event_action_name.
      data node                              type ref to if_wd_context_node.
      data portal_event_namespace type string.
      data portal_event_name          type string.
      data portal_event_parameter   type string.
      portal_event_namespace = wdevent->get_string('PORTAL_EVENT_NAMESPACE').
      portal_event_name          = wdevent->get_string('PORTAL_EVENT_NAME').
      portal_event_parameter   = wdevent->get_string('PORTAL_EVENT_PARAMETER').
      node = wd_context->get_child_node( name = 'PORTAL_EVENT_DATA' ).
      node->set_attribute( exporting name = 'PORTAL_EVENT_NAME' value = portal_event_name ).
      node->set_attribute( exporting name = 'PORTAL_EVENT_PARAMETER' value =                         portal_event_parameter ).

  • 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

  • Event In Editable ALV

    Hello,
    I have a problem in getting the event when adding a new row in ALV using OOP.
    Here's my requirement:
    I have an initial output, and I have a custom button, which when pressed, will make the fields editable. There is also a new set of toolbar shown. In the toolbar, is a button which the user can add a row, or delete a row. Now my problem is I can't handle the event in adding a new row, since I still need to do some validation on the input of the user.
    Anyone who can give an insight on how to do this?
    Any response is highly appreciated.
    Thanks,
    Louisse

    Hello Preet
    I can only tell you how I would solve this using the ALV grid control (CL_GUI_ALV_GRID) because I have abandoned using ALV function modules.
    The problem with running through PAI is whether the focus (i.e. the cursor) is still on the control or already on the (surrounding) main program. If the control has the focus, you do not run through PAI.
    I would add a "Refresh" button to the toolbar of the ALV list. Normally, this button is already there or you only have to make it visible.
    When the user pushes this button you catch the corresponding user-command and call the CHECK_DATA_CHANGED method to see if values have been changed on the editable grid. If so, the previous method will fire event DATA_CHANGED.
    Now, in the event handler method (e.g. HANDLE_DATA_CHANGED) you receive as input a data change object (CL_ALV_CHANGED_DATA_PROTOCOL). This object contains all changed values. These values you will need to make your checks.
    I assume that the logic will be similar using ALV function modules.
    Regards
       Uwe

  • After F4 Event on OOP ALV.

    Hi;
    Let me describe my problem.
    On a OOP ALV grid there are two fields. One of them is MATNR and the Other is empty.
    A list of material number is listed .When the user press f4 on matnr field and selects a material number and press enter I want to fill the empty field nearby with the description from the makt table.
    How can I do that ? Is it technically possible.
    Would you please suggest me a code sample ?
    Kind regards.
    erkan.

    You may need to use the DATA_CHANGED event in this case.
    When you define your ALV Grid you can specify when this event should be fired, in your case, you may want it to be triggered when the user hits ENTER, so after setting all the handlers, you need to do this.
      call method g_d_grid->set_ready_for_input
        exporting
          i_ready_for_input = 1.
      call method g_d_grid->register_edit_event
        exporting
          i_event_id = cl_gui_alv_grid=>mc_evt_enter
        exceptions
          error      = 1
          others     = 2.
    Then, when you pick a value from the F4 field and hit ENTER afterwards, the DATA_CHANGED event will be fired, and you can set the description in your own handler.
    FORM handle_data_changed USING p_data_changed TYPE REF TO
                                   cl_alv_changed_data_protocol.
      TABLES: t503k,
              t530.
      DATA: ls_mod_cell     TYPE lvc_s_modi,
            lv_value_fecha  TYPE lvc_value,
      DATA: l_wa_listado TYPE gtype_listado.
      LOOP AT p_data_changed->mt_mod_cells INTO ls_mod_cell.
        READ TABLE g_t_listado INTO l_wa_listado INDEX
                                    ls_mod_cell-row_id.
        CALL METHOD p_data_changed->get_cell_value
          EXPORTING
            i_row_id    = ls_mod_cell-row_id
            i_fieldname = 'NIVEL'
          IMPORTING
            e_value     = lv_value_nivel.
    * MODIFY ALV Table accordingly
      CALL METHOD g_d_grid->refresh_table_display
        EXPORTING
    *      IS_STABLE      =
           i_soft_refresh = 'X'
        EXCEPTIONS
           finished       = 1
           OTHERS         = 2

  • WHAT ARE EVENTS IN AN ALV REPORT ?

    WHAT ARE EVENTS IN AN ALV REPORT ? PLEASE EXPLAIN HOW TO MAKE AN ALV REPORT AND WHAT THE EVENTS DO ?
    BEST REGARDS,
    RYAN

    Events are driven by user interaction...Like...
    DATA_CHANGED
    DOUBLE_CLICK
    ONF4
    Here's a sample code of OO ALV using events...
    *& Report  ZDUMMY_ATG_2
    REPORT zdummy_atg_2.
    TYPES: BEGIN OF ty_scarr,
           carrid TYPE scarr-carrid,
           carrname TYPE scarr-carrname,
           currcode TYPE scarr-currcode,
           END OF ty_scarr.
    DATA: t_spfli TYPE STANDARD TABLE OF spfli,
          w_spfli LIKE LINE OF t_spfli,
          lt_f4 TYPE lvc_t_f4 WITH HEADER LINE,
          return_tab TYPE STANDARD TABLE OF ddshretval WITH HEADER LINE,
          t_custom_scarr TYPE STANDARD TABLE OF ty_scarr WITH HEADER LINE,
          t_stable TYPE STANDARD TABLE OF lvc_s_stbl WITH HEADER LINE.
    FIELD-SYMBOLS: <fs_spfli> LIKE LINE OF t_spfli,
                   <fs_scarr> LIKE LINE OF t_custom_scarr.
    CLASS cl_gui_object DEFINITION LOAD.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    INCLUDE <cl_alv_control>.
    DATA: ok_code LIKE sy-ucomm,
          gt_fieldcat TYPE lvc_t_fcat,
          gt_sort TYPE lvc_t_sort,
          event_receiver TYPE REF TO lcl_event_receiver,
          gs_layout TYPE lvc_s_layo,
          mycontainer TYPE scrfname VALUE 'CUSTOM_ALV',
          custom_container TYPE REF TO cl_gui_custom_container,
          grid1 TYPE REF TO cl_gui_alv_grid,
          gs_variant TYPE disvariant,
          x_save,
          w_error TYPE c,
          l_valid(1) TYPE c.
    *       CLASS LCL_EVENT_RECEIVER DEFINITION
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS: handle_data_changed
          FOR EVENT data_changed OF cl_gui_alv_grid
          IMPORTING er_data_changed,
          handle_f4_help
          FOR EVENT onf4 OF cl_gui_alv_grid
          IMPORTING e_fieldname es_row_no er_event_data.
    ENDCLASS.                    "LCL_EVENT_RECEIVER DEFINITION
    *       CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_data_changed.
        PERFORM data_changed USING er_data_changed.
      ENDMETHOD.                    "HANDLE_DATA_CHANGED
      METHOD handle_f4_help.
        PERFORM handle_onf4 USING e_fieldname es_row_no.
        er_event_data->m_event_handled = 'X'.
      ENDMETHOD.                    "HANDLE_F4_HELP
    ENDCLASS.                    "LCL_EVENT_RECEIVER IMPLEMENTATION
    *&      START-OF-SELECTION                                             *
    START-OF-SELECTION.
      PERFORM cargar_customs.
      PERFORM cargar_datos.
      PERFORM fill_layout.
      PERFORM fill_catalog.
      PERFORM llamar_alv.
      CALL SCREEN 0100.
    *&      Form  CARGAR_DATOS                                             *
    FORM cargar_datos.
      SELECT mandt carrid connid countryfr cityfrom
             airpfrom countryto cityto airpto
             fltime deptime arrtime distance
             distid fltype period
      INTO TABLE t_spfli
      FROM spfli.
    ENDFORM.                    " CARGAR_DATOS
    *&      Form  CARGAR_CUSTOMS                                           *
    FORM cargar_customs.
      SELECT carrid carrname currcode
      INTO TABLE t_custom_scarr
      FROM scarr.
    ENDFORM.                    " CARGAR_DATOS
    *&      Form  FILL_LAYOUT                                              *
    FORM fill_layout.
      gs_layout-sel_mode = 'A'.
    ENDFORM.                    " FILL_LAYOUT
    *&      Form  FILL_CATALOG                                             *
    FORM fill_catalog.
      DATA: gs_fieldcat TYPE lvc_s_fcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 1.
      gs_fieldcat-fieldname = 'CARRID'.
      gs_fieldcat-reptext   = 'Compañia'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = 'X'.
      gs_fieldcat-f4availabl = 'X'.
      gs_fieldcat-outputlen = '8'.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 2.
      gs_fieldcat-fieldname = 'CONNID'.
      gs_fieldcat-reptext   = 'Conexión'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = 'X'.
      gs_fieldcat-outputlen = '8'.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 3.
      gs_fieldcat-fieldname = 'COUNTRYFR'.
      gs_fieldcat-reptext   = 'País'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = 'X'.
      gs_fieldcat-outputlen = '4'.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 4.
      gs_fieldcat-fieldname = 'CITYFROM'.
      gs_fieldcat-reptext   = 'Ciudad Salida'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = space.
      gs_fieldcat-outputlen = '20'.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 5.
      gs_fieldcat-fieldname = 'AIRPFROM'.
      gs_fieldcat-reptext   = 'Arp. Salida'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = 'X'.
      gs_fieldcat-outputlen = '10'.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 6.
      gs_fieldcat-fieldname = 'COUNTRYTO'.
      gs_fieldcat-reptext   = 'País'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = 'X'.
      gs_fieldcat-outputlen = '4'.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
      gs_fieldcat-col_pos   = 7.
      gs_fieldcat-fieldname = 'CITYTO'.
      gs_fieldcat-reptext   = 'Ciudad Llegada'.
      gs_fieldcat-tabname   = 'T_SPFLI'.
      gs_fieldcat-edit      = space.
      gs_fieldcat-outputlen = '20'.
      APPEND gs_fieldcat TO gt_fieldcat.
    ENDFORM.                    " FILL_CATALOG
    *&      Form  LLAMAR_ALV                                               *
    FORM llamar_alv.
      IF custom_container IS INITIAL.
        CREATE OBJECT custom_container
          EXPORTING
            container_name              = mycontainer
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5.
      ENDIF.
      CREATE OBJECT grid1
        EXPORTING
          i_parent = custom_container.
      CREATE OBJECT event_receiver.
      lt_f4-fieldname = 'CARRID'.
      lt_f4-register = 'X' .
      lt_f4-getbefore = 'X' .
      lt_f4-chngeafter = 'X' .
      APPEND lt_f4.
      SET HANDLER event_receiver->handle_data_changed FOR grid1.
      SET HANDLER event_receiver->handle_f4_help FOR grid1.
      CALL METHOD grid1->register_f4_for_fields
        EXPORTING
          it_f4 = lt_f4[].
      IF sy-batch IS INITIAL.
        CALL METHOD grid1->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_modified.
      ENDIF.
      CALL METHOD grid1->set_table_for_first_display
        EXPORTING
          is_variant      = gs_variant
          i_save          = x_save
          i_default       = 'X'
          is_layout       = gs_layout
        CHANGING
          it_fieldcatalog = gt_fieldcat
          it_sort         = gt_sort[]
          it_outtab       = t_spfli[].
      CALL METHOD grid1->set_ready_for_input
        EXPORTING
          i_ready_for_input = 1.
    ENDFORM.                    " LLAMAR_ALV
    *&      Form  HANDLE_ONF4                                              *
    FORM handle_onf4 USING p_e_fieldname
                           p_es_row_no STRUCTURE lvc_s_roid.
      CASE p_e_fieldname.
        WHEN 'CARRID'.
          CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
            EXPORTING
              retfield        = 'CARRID'
              value_org       = 'S'
            TABLES
              value_tab       = t_custom_scarr
              return_tab      = return_tab
            EXCEPTIONS
              parameter_error = 1
              no_values_found = 2
              OTHERS          = 3.
          IF NOT return_tab[] IS INITIAL.
            READ TABLE return_tab INDEX 1.
            READ TABLE t_spfli INDEX p_es_row_no-row_id
            ASSIGNING <fs_spfli>.
            <fs_spfli>-carrid = return_tab-fieldval.
            CALL METHOD grid1->refresh_table_display
              EXPORTING
                is_stable = t_stable.
          ENDIF.
      ENDCASE.
    ENDFORM.                    " HANDLE_ONF4
    *&      Module  STATUS_0100  OUTPUT                                    *
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'MAIN_STATUS'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT                               *
    MODULE user_command_0100 INPUT.
      ok_code = sy-ucomm.
      CASE ok_code.
        WHEN 'BACK' OR 'STOP' OR 'CANCEL'.
          SET SCREEN 0.
          LEAVE SCREEN.
        WHEN 'SAVE'.
          CALL METHOD grid1->check_changed_data
            IMPORTING
              e_valid = l_valid.
          IF l_valid EQ 'X'.
            PERFORM grabar_datos.
          ENDIF.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  DATA_CHANGED                                             *
    FORM data_changed USING rr_data_changed TYPE REF TO
                                            cl_alv_changed_data_protocol.
      DATA: w_new,
            ls_mod_cells TYPE lvc_s_modi,
            ls_cells TYPE lvc_s_modi.
      DATA: l_carrid TYPE spfli-carrid.
      CLEAR l_carrid.
      LOOP AT rr_data_changed->mt_good_cells INTO ls_mod_cells.
        CASE ls_mod_cells-fieldname.
          WHEN 'CARRID'.
            CALL METHOD rr_data_changed->get_cell_value
              EXPORTING
                i_row_id    = ls_mod_cells-row_id
                i_fieldname = ls_mod_cells-fieldname
              IMPORTING
                e_value     = l_carrid.
            IF l_carrid IS INITIAL.
              CALL METHOD rr_data_changed->add_protocol_entry
                EXPORTING
                  i_msgid     = '0K'
                  i_msgno     = '000'
                  i_msgty     = 'E'
                  i_msgv1     = 'Seleccione algún código'
                  i_fieldname = ls_mod_cells-fieldname
                  i_row_id    = ls_mod_cells-row_id.
              w_error = 'X'.
            ELSE.
              READ TABLE t_custom_scarr WITH KEY carrid = l_carrid
              ASSIGNING <fs_scarr>.
              IF sy-subrc NE 0.
                CALL METHOD rr_data_changed->add_protocol_entry
                  EXPORTING
                    i_msgid     = '0K'
                    i_msgno     = '000'
                    i_msgty     = 'E'
                    i_msgv1     = 'Código ingresado no existe'
                    i_fieldname = ls_mod_cells-fieldname
                    i_row_id    = ls_mod_cells-row_id.
                w_error = 'X'.
              ENDIF.
            ENDIF.
        ENDCASE.
      ENDLOOP.
    ENDFORM.                    " DATA_CHANGED
    *&      Form  GRABAR_DATOS                                             *
    FORM grabar_datos.
      LOOP AT t_spfli ASSIGNING <fs_spfli>.
        w_spfli = <fs_spfli>.
        MODIFY spfli FROM w_spfli.
        IF sy-subrc EQ 0.
          COMMIT WORK.
        ELSE.
          ROLLBACK WORK.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " GRABAR_DATOS
    Greetings,
    Blag.

  • Is it possible to handle multiple events using Jscript for a button in Apex

    Hi,
    I've application wherein in one of the pages for a button, I need to trigger 2 events as: 1. redirect to a new page upon 'click' of the button
    2. display a set of values on 'mouse over' that button.
    I'm able to handle both separately, but not in one button. I would like to know if there is any limitation in Apex that we cant handle multiple events? Currently I've put a text item near the button, and called the Jscript for mouse over event in that as a temporary workaround. Can someone let me know if this is feasible? If not any other alternative to handle this?
    Thanks in advance,
    gsachidh

    Hi Gsachidh,
    well interesting problem you're facinng. Indeed, it can't be specified using the 'Button Attributes' So we have to come up with an workaround.
    A quick en dirty solution would be to specify it with the 'Optional URL Redirect options'. In a normal button, with processing on same page, this would be 'no target'. but in case of additional things to be done this can be used, using an target URL. I used this many times, in example with popUp windows for refreshing the caller object when changes are made. In your case we have to add next to the href an onmouseover event. this can be done with;
    Target set to => URL
    URL - target => javascript:doSubmit('<button_name>');" onMouseOver="javascript:showTooltip('tooltip');"
    Here the " is the key, letting ApEx know the target (href) is doSubmit('<button_name>'), just like when no target would be specified and adding a new javascript event; onMouseOver.
    Although this is a dirty solution in my opinion, it is the best i could come up with. I have another idea in how to do this, that is by adding this event dynamically with javascript with an addEvent. But i don't have an example at the moment for this scenario.
    Simon
    Message was edited by:
    S1M0N

  • Reg : Cross browser issue while handling LOV event on KeyFlexFeild

    Hi OA Gurus,
    We are encountering issues on R12.0.6, JDev 120Rup6.
    We have the following test case and code changes.
    Requirement:
    We have OA page where we have one KeyFlexFeild item and a normal LOV. Page items are part of one AM and LOV is in another AM.
    The requirement was to make LOV dependent on keyFlexfeild. Test case is mentioned as per following flow.
    1.     User changes cost center segment of Accounting Flex(Key flex) using Cost center LOV.
    2.     Another LOV in the same page should be dependent on new value of cost center as modified in step 1.
    Solution Implemented:
    Describing in the 3 steps
    1) Here the KeyFlexFeild is expense account. Whenever User changes any segment, we handle
    ‘lovValidate’ and ‘lovUpdate’ events on KeyFlexFeild in processFormRequest of controller.
    2) Retrieve the value of cost center segment using getSegmentsQualifiedBy(), Update corresponding VO attribute of the LOV query parameter.
    3) Forward the request to current page so that LOV will have modified value with updated query.
    4) Forwarding to current page is must because LOV is built with another AM and will loaded only when page is built.
    Issue:
    This works fine on internet explorer. When trying to run the same in Mozilla we have following issue
    1) User modifies one of the segments of expense account and make a tab – out
    2) Now the page refresh happens
    3) Now in the same page no other LOV or no other button works. He can’t click on any button for submit or cancel.
    LOVs will not open even after clicking on it.
    Code changes:
    //Step1 – Handle LOV events
    String source = pageContext.getParameter(SOURCE_PARAM);
    String eventType = pageContext.getParameter(EVENT_PARAM);
    if(source !=null && eventType != null) {
    if(source.startsWith("Acct") && eventType.equals("lovUpdate") || eventType.equals("lovValidate") ) {
    KeyFlexfield flex = (KeyFlexfield)lkff.getAttributeValue(OAWebBeanConstants.FLEXFIELD_REFERENCE);
    // Step -2 Updating the corresponding VO attribute for LOV to get the modified the value
    Segment[ ] segmentL = flex.getSegmentsQualifiedBy(FA_COST_CTR");
    CostCenterValue = segmentL[0].getValue().getValue();
    if(CostCenterValue != null ){
    sampleViewObject.getCurrentRow().setAttribute("ToCostCenter",CostCenterValue);
    OAFormValueBean formValueBean = (OAFormValueBean)webBean.findIndexedChildRecursive("ToCostCenter");
    if(formValueBean != null)
    formValueBean.setValue(pageContext, CostCenterValue);
    OAMessageLovInputBean formValueBean1 = (OAMessageLovInputBean)webBean.findIndexedChildRecursive("ReceivingApprover");
    if(formValueBean1 != null)
    formValueBean1.setValue(pageContext, null);
    else
    sampleViewObject.getCurrentRow().setAttribute("ToCostCenter",null);
    //Step 3 – Forward the request Current Page again
    pageContext.setForwardURLToCurrentPage(null, true, ADD_BREAD_CRUMB_YES, (byte)0);
    We have following questions.
    a)     Solution implemented by us is correct ? or we have to implement it in another way ?
    b)     Is OA version mentioned above supported on Mozilla browser version 3.x ? This issue is not occurring on Mozilla 1.x while running from JDev.
    Please let us know if any additional details required.
    Thanks for help in advance.
    Edited by: user774130 on Dec 15, 2009 2:27 AM

    Hi,
    It seems that you have not noticed that this forum is not for posting product-related questions/problems....
    So , this might be the correct forum....
    Java Server Pages (JSP)
    Sim

Maybe you are looking for

  • Smart calendars in iCal?

    Morning. Is there any ability in iCal to create and use smart calendars, e.g. a smart calendar containing all events in the same location? This would be very helpful to manage multiple calendars for the users of one conference room. Or an smart calen

  • Windows phone 8.1 not saving recorded video

    This is now a huge problem i have recorded a video of around 10 minutes when i stopped and pressed back all my app tiles goes blank so i switched off and then switched on the device guess what i got the video but it was half. Half if the video got fr

  • How to loop through data of ALV grid in Webdynpro for Abap view

    hello, I have a view with an ALV component(SALV_WD_TABLE). I just want to loop through the lines shown (particularly when the user has set filter). Can you help me to find how to reach the internal table ? In summary, I want to know the reverse metho

  • 2009 iMac 3.06 (w/Nvidia 130GT) not supporting 1920x1080p on a HP w2338h

    I just purchased a new 2009 3.06 iMac (stock) and upon hooking up the Mini DisplayPort to DVI adapter to a DVI to HDMI cable and plugging it into the HP w2338h it comes up at the proper 1920x1080 resolution but the iMac will only drive it Interlaced

  • Adobe Presenter Installation Issue

    Hi I just installed Acrobat 9 Extended which was supposed to ship with Presenter. I am running Windows XP SP 2 and Powerpoint 2003 SP 3. I do not see the menu item in powerpoint. How do I know if it even installed? Would there be a folder in Programs