Abap WD ALV: Event for calculation row?

Hi,
i have one Abap WebDynpro ALV Component. It is possible to register an event (ON_CLICK) for Cells which are an Link_to_action for example.
My Table:
ID | Group | Var
A1 | Test | 4
A2 | Test | 5
A3 | Dev | 4
A4 | Dev | 6
If i create the ON_CLICK event for the last row, which is then a link_to_action column, i can click on the numbers and the event is triggered
Now i have a table which uses the ALV Calculation feature and the Intermediate Results for the grouping.
My new output view is:
ID | Group | Var
->---Test    9
  A1 | Test | 4
  A2 | Test | 5
->---Dev  10
  A3 | Dev | 4
  A4 | Dev | 6
(It calculates the sum of the vars and groups it by the second column)
Now I need an Event if someone clicks on the numbers in the Var Row of the intermediate results row (here: 9 and 10). How can i do this?
If this is not possible, how can i register an event if someone expands or collapses a intermediate result row?
Kind Regards,
Thomas
Edited by: Thomas Rodemer on Oct 9, 2008 3:30 PM
Edited by: Thomas Rodemer on Oct 9, 2008 3:30 PM

Hi,
Is the DDLBK is filled with support function? if yes then look if you can enhance the method by post method exit etc..
Thanks,
Chandra

Similar Messages

  • How to set fire action event for particular rows in a table

    HI All,
    I have a requirement in which I want to set fire action event for particular rows in a table based on some condition.
    The table has columns like fullname,employee id etc.
    So i want to set fire action event for particulars rows only which will saisfy some condition.

    Atanu,
    Your approach(setting fire action for few rows) seems not possible. Better to go ahead with workaround.
    Do you want this functionality in processRequest(while page loading) or processFromRequest(on some event) method ? Give more explanation regd. your requirement ?
    In either case loop through the rows and when your condition is met write the action to be performed in controller.
    Regards,
    Anand

  • Custom FPM Event for Button row element

    Hi Expects,
    I have created a new button row element in standard screen, where I want to add custom FPM event and handle the same in get_data( ). But by default SAP is providing few event ID's in drop down.
    Please help me how to add custom FPM event for  button row element.
    Regards,
    Reny Richard

    Hi Remy,
    Process Event method does have any signature parameters in it which allow us to disable/enable buttons.
    We can handle this in Get data method.Get Data is always triggered after Process Event. So you can write that in Get Data instead.
    ****this is a sample code to do the same. You can do a read as well if single button needs tobe handled***
    LOOP AT CT_ACTION_USAGE INTO lw_action WHERE id = (your event id for the button).
        lw_action-enabled = abap_false.
        MODIFY CT_ACTION_USAGE FROM lw_action TRANSPORTING enabled.
        EV_ACTION_USAGE_CHANGED = 'X'.
    ENDLOOP.
    ***use field symbol to avoid modify if you want***

  • Event for Table rows deselection

    Hi Guys,
    I have created a Table  and created a method for  event 'OnSelect'.I am capturing row values into an internal table when  user select a value from the table.Here my problem is once deselected after selecting the row ,the selected data is still appearing in the internal table but deselected value should get deleted from the table.How it can be acheived.Is there any event for deselection.
    Thanks
    Nandana.

    Hi nandana,
    If i am understanding your query correctly, on Row select you are appending the row value to an internal table.
    Now on deselect you want the row to be removed.
    So do one thing in that event method before appending the row into table check if the row value previously exist.
    If it exist then remove the row from internal table otherwise append it into the table.
    Check it works or not.
    If it is not working with onSelect event try to use onLeadSelect event.

  • ABAP Web Dynpro ALV: event for "tabel selection menu" needed

    Hi all,
    we need to react on the "table selection menue" control in our ALV grids. We found, that event "lead_select" is triggerd, if single lines are selected and if "delete selection" from the table selection menu is used.
    But if the "select all" item is used, the event is not triggered.
    Is there another event we can use? Does anybody know a sensible workaround for this problem?
    Thanks  and regards
    Joachim

    Hello Joachim,
    perhaps it's better to post your question in the WebDynpro ABAP forum:
    Web Dynpro ABAP
    Best regards
    Stephan

  • ALV events for data_change  executing multiple times

    Hello Experts,
    I am using the event "data_changed" of cl_gui_alv_grid and its getting triggred multiple times based on
    no. of rows in my ALV grid output.
    For ex: if i have 5 rows and if i input a field in any cell in a new row, in data_changed event is triggered 2 times.
    The  LOOP AT er_data_changed->mt_mod_cells INTO ls_modified is executing 6 times as in above example
    even though is having only 1 entry.
    Can some one pls help me with this?
    Also i see the  toolbar event is often getting excuted multiples no of times making the application slow.
    Please suggest.
    Thanks
    Dan

    Dan,
    Maybe you've placed or doing something wrong, take this report as a pattern "BCALV_EDIT_03".
    Best regards,
    Alexandre

  • How to display total in alv only for single row

    Hello,
    I wish to replace VAT field in my ALV OUTPUT from another ITAB using READ TABLE. But in ALV output I have multiple rows for one document number.
    So the value is assigning to all the rows in output, is it possible to assign that VAT value to only one row ( to any one record from output with corresponding document number) .
    Thanks in advance.
    Regards,
    Ritesh Inamdar

    Hi Sudeesh,
    I am fetching data for PO details, GR details along with condition types of PO.
    All data is collected in ALV OUTPUT itab, after this I am trying to assign the values of VAT from another itab in ALV OUTPUT LOOP using READ TABLE with reference to PO-PO_ITEM-CONDITION_TYPE.
    Now, when the alv loop is getting executed and in that I am fetching data for VAT using READ statement, the program is assigning VAT to all records of output alv with comparison of PO-PO_ITEM-CONDITION_TYPE.
    see:
    LOOP AT it_alv ASSIGNING <fs-alv>.
         READ TABLE it_vat ASSIGNING <fs-vat>
              WITH KEY ebeln = <fs-alv>-ebeln
                               posnr = <fs-alv>-posnr
                                kschl = 'JVCS'.
         IF sy-subrc = 0.
              <fs-alv>-vat = <fs-vat>-kbetr / 10.
      <fs-alv>-vat_val = <<fs-alv>-vat * it_alv-menge.
         END IF.
    END LOOP.
    Please refer above.
    Thanks.
    Ritesh

  • ALV Event for data input

    I have an internal table . One of the fields can take input in the ALV grid using ABAP objects.
    When the user enters a value in this field , I would like to capture the values in all the cells of all the fields that are adjaccent to this editable field.
    I think I will have to use data_changed event . The SLIS examples are a bit complex, If there is a simpler example to show how this can be done , it will be great.

    That's right, that is the event that you want to use.  See example programs which start with BCALV_EDIT*
    Regards,
    Rich Heilman

  • Different onMouseOver Event for each row of a report

    Hi all,
    See
    http://htmldb.oracle.com/pls/otn/f?p=41861:1
    As you can see in the demo, all employees of a department are shown when you click the detail link for a department. This is done with the help of AJAX technologie to avoid the submit of the page.
    My question is: Is there a possibility to show the the employee report for the correct department when I move the mouse over the row of a department. In other words: what I am searching is a possiblity to define the behaviour of a certain row, so that code like
    <tr onMouseOver="javascript:getEmps(1)">....</tr>
    <tr onMouseOver="javascript:getEmps(2)">....</tr>
    is generated.
    Thank you in advance
    Stephan

    Hi,
    for this you need to call the PLSQL function upon table rendering, which means that you need a field in the table referencing a managed bean. In the managed bean you can use #{row} and resolve it using a ValueExpression. #{row} gives you access to the current rendered row (this is why you need to do it when the table renders) and thus allows you to call getAttribute(name) to get the values of field 1 - 3. The search field value you should get through the bindings reference (assuming the search form uses ADF). Then you create an operation binding for the executeWithParameters and call operationBindingName.getParamsMap().put(argname, argvalue); on it.
    Frank
    Ps.: I am concerned about the performance you get and wonder if it isn't possible to create a transient attribute that executes the function and displays the results. As I understand, the search parameters are only to filter the result set, which you still can do

  • ALV: how to handle event for multi (lead) row selection ?

    Hi,
    I use editable ALV and configure it for multi (lead) selection. Works fine.
    But I could not find any event handler for reading the selected lines.
    There is only the Event handler ON_LEAD_SELECT: this works only for 1 line
    (the lead line). But I could not read multi lines. Who can help?
    Thanks in advance, Christian

    Hi Christian,
    did you try a custom button?
    Try a call
    node->GET_SELECTED_ELEMENTS
    I cant remember if ALV sends event when multi-selection is on for each row selection.
    ie as each row is selected, do you get control ?
    If so, then you should still be able to call node->GET_SELECTED_ELEMENTS .
    regards
    Phil.

  • Event for the List Box in ALV Grid Control

    Hello,
    I have the below urgent requirment.
    I have an ALV Grid Control built using ABAP Objects. In the grid, I have few fields and one of these fields is a List Box. Depending on the values selected, I need to enable or disable some fields. So, is there any event for the List box in ALV Grid Control.
    For ex: I have 2 Fields, Designation and Commission. The designation field is a List Box field having 'Software Engineer' and 'Manager' as values. When I select 'Software Engineer', the commission field should be disabled. When I select 'Manager', the comission field should be enabled.
    Early reply is hightly appreciated.
    Priya

    REPORT  ZTEST1234    MESSAGE-ID ZZ                           .
    DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
    DATA: L_VALID TYPE C,
          V_FLAG,
          V_DATA_CHANGE,
          V_ROW TYPE LVC_S_ROW,
          V_COLUMN TYPE LVC_S_COL,
          V_ROW_NUM TYPE LVC_S_ROID.
    DATA: OK_CODE LIKE SY-UCOMM,
          SAVE_OK LIKE SY-UCOMM,
          G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
          GS_LAYOUT TYPE LVC_S_LAYO.
    DATA:BEGIN OF  ITAB OCCURS 0,
         VBELN LIKE LIKP-VBELN,
         POSNR LIKE LIPS-POSNR,
         COMISN(10),
         CELLCOLOR TYPE LVC_T_SCOL, "required for color
         DROP(20),
        <b> HANDLE_STYLE TYPE LVC_T_STYL,</b>
         END OF ITAB.
    *       CLASS lcl_event_handler DEFINITION
    CLASS LCL_EVENT_HANDLER DEFINITION .
      PUBLIC SECTION .
        METHODS:
    **Hot spot Handler
        HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                          IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
    <b>**Handler to Check the Data Change
        HANDLE_DATA_CHANGED FOR EVENT DATA_CHANGED
                             OF CL_GUI_ALV_GRID
                             IMPORTING ER_DATA_CHANGED
                                       E_ONF4
                                       E_ONF4_BEFORE
                                       E_ONF4_AFTER,</b>
    **Double Click Handler
        HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                                         IMPORTING E_ROW E_COLUMN ES_ROW_NO.
    ENDCLASS.                    "lcl_event_handler DEFINITION
    *       CLASS lcl_event_handler IMPLEMENTATION
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
    *Handle Hotspot Click
      METHOD HANDLE_HOTSPOT_CLICK .
        CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
        V_ROW  = E_ROW_ID.
        V_COLUMN = E_COLUMN_ID.
        V_ROW_NUM = ES_ROW_NO.
        MESSAGE I000 WITH V_ROW 'clicked'.
      ENDMETHOD.                    "lcl_event_handler
    *Handle Double Click
      METHOD  HANDLE_DOUBLE_CLICK.
      ENDMETHOD.                    "handle_double_click
    <b>**Handle Data Change
      METHOD HANDLE_DATA_CHANGED.
        DATA: X_CHANGE TYPE LVC_S_MODI,
                X_FINAL TYPE ITAB,
                L_FLAG,
                LS_OUTTAB LIKE LINE OF ITAB.
        DATA: LS_EDIT TYPE LVC_S_STYL,
              LT_EDIT TYPE LVC_T_STYL.
        LOOP AT ER_DATA_CHANGED->MT_GOOD_CELLS INTO X_CHANGE.
          IF X_CHANGE-FIELDNAME = 'DROP' AND X_CHANGE-VALUE = 'S/W ENGINEER'.
            LS_EDIT-FIELDNAME = 'COMISN'.
            LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
            LS_EDIT-STYLE2 = SPACE.
            LS_EDIT-STYLE3 = SPACE.
            LS_EDIT-STYLE4 = SPACE.
            LS_EDIT-MAXLEN = 8.
            INSERT LS_EDIT INTO TABLE LT_EDIT.
            INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
            MODIFY ITAB INDEX X_CHANGE-ROW_ID FROM LS_OUTTAB  TRANSPORTING
                                              HANDLE_STYLE .
          else.
            LS_EDIT-FIELDNAME = 'COMISN'.
            LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED.
            LS_EDIT-STYLE2 = SPACE.
            LS_EDIT-STYLE3 = SPACE.
            LS_EDIT-STYLE4 = SPACE.
            LS_EDIT-MAXLEN = 8.
            INSERT LS_EDIT INTO TABLE LT_EDIT.
            INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
            MODIFY ITAB INDEX X_CHANGE-ROW_ID FROM LS_OUTTAB  TRANSPORTING
                                              HANDLE_STYLE .
          ENDIF.
        ENDLOOP.
        CALL METHOD G_GRID->REFRESH_TABLE_DISPLAY
          EXCEPTIONS
            FINISHED = 1
            OTHERS   = 2.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDMETHOD.                    "HANDLE_DATA_CHANGED</b>
    ENDCLASS.                    "LCL_EVENT_HANDLER IMPLEMENTATION
    *&             Global Definitions
    DATA:      G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
                G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
    *- Fieldcatalog for First and second Report
    DATA: IT_FIELDCAT  TYPE  LVC_T_FCAT,
          X_FIELDCAT TYPE LVC_S_FCAT,
          LS_VARI  TYPE DISVARIANT.
    *                START-OF_SELECTION
    START-OF-SELECTION.
      SELECT VBELN
             POSNR
             FROM LIPS
             UP TO 20 ROWS
             INTO CORRESPONDING FIELDS OF TABLE ITAB.
    END-OF-SELECTION.
      IF NOT ITAB[] IS INITIAL.
        CALL SCREEN 100.
      ELSE.
        MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
      ENDIF.
    *&      Form  CREATE_AND_INIT_ALV
    *       text
    FORM CREATE_AND_INIT_ALV .
      DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
      CREATE OBJECT G_CUSTOM_CONTAINER
             EXPORTING CONTAINER_NAME = G_CONTAINER1.
      CREATE OBJECT G_GRID
             EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
    * Set a titlebar for the grid control
      CLEAR GS_LAYOUT.
      GS_LAYOUT-GRID_TITLE = TEXT-003.
       <b>GS_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.</b>
      GS_LAYOUT-ZEBRA = SPACE.
      GS_LAYOUT-CWIDTH_OPT = 'X'.
      GS_LAYOUT-NO_ROWMARK = 'X'.
      GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
    <b>  CALL METHOD G_GRID->REGISTER_EDIT_EVENT
        EXPORTING
          I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.</b>
      CREATE OBJECT G_HANDLER.
      SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
      SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
    <b>  SET HANDLER G_HANDLER->HANDLE_DATA_CHANGED FOR G_GRID.</b>
      DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
      DATA: L_INDEX TYPE SY-TABIX.
      "Here i am changing the color of line 1,5,10...
      "so you can change the color of font conditionally
      LOOP AT ITAB.
        L_INDEX = SY-TABIX.
        IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
          LS_CELLCOLOR-FNAME = 'VBELN'.
          LS_CELLCOLOR-COLOR-COL = '6'.
          LS_CELLCOLOR-COLOR-INT = '0'.
          LS_CELLCOLOR-COLOR-INV = '1'.
          APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
          MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
          LS_CELLCOLOR-FNAME = 'POSNR'.
          LS_CELLCOLOR-COLOR-COL = '6'.
          LS_CELLCOLOR-COLOR-INT = '0'.
          LS_CELLCOLOR-COLOR-INV = '1'.
          APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
          MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
        ENDIF.
      ENDLOOP.
    * setting focus for created grid control
      CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
        EXPORTING
          CONTROL = G_GRID.
    * Build fieldcat and set editable for date and reason code
    * edit enabled. Assign a handle for the dropdown listbox.
      PERFORM BUILD_FIELDCAT.
      PERFORM  SET_DRDN_TABLE.
    * Optionally restrict generic functions to 'change only'.
    *   (The user shall not be able to add new lines).
      PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
    **Vaiant to save the layout
      LS_VARI-REPORT      = SY-REPID.
      LS_VARI-HANDLE      = SPACE.
      LS_VARI-LOG_GROUP   = SPACE.
      LS_VARI-USERNAME    = SPACE.
      LS_VARI-VARIANT     = SPACE.
      LS_VARI-TEXT        = SPACE.
      LS_VARI-DEPENDVARS  = SPACE.
      CALL METHOD G_GRID->REGISTER_EDIT_EVENT
        EXPORTING
          I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.
    **Calling the Method for ALV output
      CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
          IS_VARIANT           = LS_VARI
          IS_LAYOUT            = GS_LAYOUT
          I_SAVE               = 'A'
        CHANGING
          IT_FIELDCATALOG      = IT_FIELDCAT
          IT_OUTTAB            = ITAB[].
    * Set editable cells to ready for input initially
      CALL METHOD G_GRID->SET_READY_FOR_INPUT
        EXPORTING
          I_READY_FOR_INPUT = 1.
    ENDFORM.                               "CREATE_AND_INIT_ALV
    *&      Form  EXCLUDE_TB_FUNCTIONS
    *       text
    *      -->PT_EXCLUDE text
    FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
    * Only allow to change data not to create new entries (exclude
    * generic functions).
      DATA LS_EXCLUDE TYPE UI_FUNC.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
    ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
    *&      Form  build_fieldcat
    *       Fieldcatalog
    FORM BUILD_FIELDCAT .
      DATA: L_POS TYPE I.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
      X_FIELDCAT-FIELDNAME = 'VBELN'.
      X_FIELDCAT-TABNAME = 'ITAB'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-NO_ZERO    = 'X'.
      X_FIELDCAT-OUTPUTLEN = '10'.
      X_FIELDCAT-HOTSPOT = 'X'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Item'(025).
      X_FIELDCAT-FIELDNAME = 'POSNR'.
      X_FIELDCAT-TABNAME = 'ITAB'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '5'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Drop'(025).
      X_FIELDCAT-FIELDNAME = 'DROP'.
      X_FIELDCAT-TABNAME = 'ITAB'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '5'.
      X_FIELDCAT-EDIT = 'X'.
      X_FIELDCAT-DRDN_HNDL = '1'.
      X_FIELDCAT-DRDN_ALIAS = 'X'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Comissn'(025).
      X_FIELDCAT-FIELDNAME = 'COMISN'.
      X_FIELDCAT-TABNAME = 'ITAB'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '10'.
      X_FIELDCAT-EDIT = 'X'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
    ENDFORM.                    " build_fieldcat
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAIN100'.
      IF G_CUSTOM_CONTAINER IS INITIAL.
    **Initializing the grid and calling the fm to Display the O/P
        PERFORM CREATE_AND_INIT_ALV.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  SET_DRDN_TABLE
    *       text
    FORM SET_DRDN_TABLE.
      DATA:LT_DRAL TYPE LVC_T_DRAL,
            LS_DRAL TYPE LVC_S_DRAL.
      LS_DRAL-HANDLE = '1'.
      LS_DRAL-VALUE =  'S/W Engineer'.
      LS_DRAL-INT_VALUE =  'S/W Engineer'.
      APPEND LS_DRAL TO LT_DRAL.
      LS_DRAL-HANDLE = '1'.
      LS_DRAL-VALUE =  'Manager'.
      LS_DRAL-INT_VALUE =  'Manager'.
      APPEND LS_DRAL TO LT_DRAL.
    **Setting the Drop down table for Reason Code
      CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
        EXPORTING
          IT_DROP_DOWN_ALIAS = LT_DRAL.
    ENDFORM.                               " set_drdn_table
    Regards
    vijay

  • ALV Grid default values for new rows added with Add/Insert buttons

    Hi!
    Help, please,  to find a way how to set default values for new rows added with Add/Insert buttons in
    ALV Grid.

    I have found salution:
    ALV Grid u2013 Insert row function
    Sometimes we need to assign some default values when we create a new row in a grid using standard ALV Append row button. In our scenario we will see how to assign default values to Airline Code (CARRID), Flight Connection Number (CONNID) and Flight date (FLDATE) when a new row is created. To do that we need to handle DATA_CHANGED event in the program like mentioned below.
    Definition of a class:
    Code:
          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
                           e_ucomm.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    Implementation of a class:
    Code:
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
      METHOD HANDLE_DATA_CHANGED.
        DATA: dl_ins_row TYPE lvc_s_moce.   " Insert Row
          FIELD-SYMBOLS: <fs> TYPE table.    " Output table
    Loop at the inserted rows table and assign default values
        LOOP AT er_data_changed->mt_inserted_rows INTO dl_ins_row.
          ASSIGN er_data_changed->mp_mod_rows->* TO <fs>.
          loop at <fs> into ls_outtab.
            ls_outtab-carrid  = 'LH'.
            ls_outtab-connid  = '400'.
            ls_outtab-fldate  = sy-datum.
            MODIFY <fs> FROM ls_outtab INDEX sy-tabix.
          endloop.
        endloop.
      ENDMETHOD.                    "handle_data_changed
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    Register the events to trigger DATA_CHANGED event when a new row is created.
    Code:
        CALL METHOD OBJ_GRID->REGISTER_EDIT_EVENT
          EXPORTING
            I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
        CALL METHOD OBJ_GRID->REGISTER_EDIT_EVENT
          EXPORTING
            I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.

  • How can I register an EVENT for ALV-GRID?????

    Hi,
    i have create Events for my ALV-Grid Table (cl_gui_alv_grid).
    But there is one Problem!!!!
    Which Event must i create, if users write something in the ALV row and press to key "enter" ???
    With kind regards
    Ersin

    Did you set the handler for one of forementioned events? If no, please suplement your code with the following
    "create handler class
    CLASS lcl_gui_alv_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
    "        Controlling data changes when ALV Grid is editable
              handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
                                  IMPORTING er_data_changed e_onf4 e_onf4_before e_onf4_after,
    "       To be triggered after data changing is finished
              handle_data_changed_finished FOR EVENT data_changed_finished OF cl_gui_alv_grid
                                           IMPORTING e_modified ,
    ENDCLASS.                  
    "implement you handler methods
    CLASS lcl_gui_alv_event_receiver IMPLEMENTATION.
      METHOD handle_data_changed .
        MESSAGE 'Data changed' TYPE 'I'.
      ENDMETHOD.
      METHOD handle_data_changed_finished .
         MESSAGE 'Data changed finished' TYPE 'I'.
      ENDMETHOD .
    ENDCLASS.
    data:  g_alv_event_ref TYPE REF TO lcl_gui_alv_event_receiver.
    CREATE OBJECT g_alv_event_ref.
    "set handlers for these events
    SET HANDLER:
      g_alv_event_ref->handle_data_changed FOR g_alv_grid_ref,
      g_alv_event_ref->handle_data_changed_finished FOR g_alv_grid_ref,
    "register the events after pressing enter
    CALL METHOD g_alv_grid_ref->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    Regards
    Marcin

  • How to use FORMULA in ABAP for calculation

    hi all,
    i have to do some calculation in my report and because of this reason i want to use formula. Could any body tell me the best way to use of formula for calculation purpose in ABAP or any other way?
    Thansk,
    abapfk
    Moderator Message: You don't need to open a thread to know the answer for this basic question. A simple search or using ABAP Help will help in getting the answer.
    Edited by: kishan P on Oct 4, 2010 11:20 AM

    There is another option to do the same thing.
    What can be done is, create running total. You can create running total from field explorer by right clicking and then new. Create Running Total Field dialog box appears. In that, provide the following:
    i)     Field to summarize - provide the field to maximize (i.e. id)
    ii)     Type of summary u2013 Maximum
    iii)     Evaluate u2013 On change of field (provide the name)
    iv)     Reset u2013 Never
    Keep this Running total field on the details section and suppress if you do not want to show it in the details section. Place this field wherever you want in the report.
    Hope this helps you. Let me know your comments.

  • Hotspot click for only some rows in ALV grid for a particular column ?

    Hi there,
            In ALV grid, we can make Hotspot enable for all rows in a specified column
    by specifying in the fieldcatalog with Hotspot attribute set as true.
    But I want to enable Hotspot only for certain rows in the particular column. I tried with MC_STYLE4_LINK , but I didnt got the required result.
    So , how could I achieve that in ALV grid.
    Points would be rewarded for helpful answers.
    Regards,
    Anil .

    Hi,
    You can do it for a column. Please refer to the code snippet below,
      DATA : it_fcat TYPE lvc_t_fcat,
             wa_fcat LIKE LINE OF it_fcat.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
      I_BUFFER_ACTIVE              =
         i_structure_name             = 'SMMW_ALERTS_ICON_S'
      I_CLIENT_NEVER_DISPLAY       = 'X'
      I_BYPASSING_BUFFER           =
      I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = it_fcat
       EXCEPTIONS
         inconsistent_interface       = 1
         program_error                = 2
         OTHERS                       = 3
    LOOP AT it_fcat INTO wa_fcat.
      IF wa_fcat-fieldname = 'STATUS'.
        wa_fcat-hotspot = 'X'.
        MODIFY it_fcat FROM wa_fcat.
        CLEAR wa_fcat.
      ENDIF.
    ENDLOOP.
    CALL METHOD l_obj_alv_grid->set_table_for_first_display
          EXPORTING
        i_structure_name              = 'SMMW_ALERTS_ICON_S'
       CHANGING
            it_outtab                     = lt_alerts_st
            it_fieldcatalog               = it_fcat.
    In the above replace the structure 'SMMW_ALERTS_ICON_S' with your structure and column 'STATUS' with your desired column.
    Hope this helps,
    Regards,
    Vinodh

Maybe you are looking for

  • My ipod was stolen and i need to fin the serial code. how do i do that?

    my ipod was stolen by some kid and i want to track it. and i need my serial code. how can i find it

  • Battery exchange program for iBook

    Hi, I ordered true the battery exchange program a new battery for my iBook 4G. I also got a confirmation emal from Apple that i reicive the batteru in 3 a 5 days. This was on 29 december 05 and still the battery isn't arived yet. Is this normal? than

  • LAYOUT FOR FBL1N

    HI EXPERTS ! The transaction code for the report we generate is FBL1N - vendor ledger. we require the vendor's bank detail in this report at the header i.e. vendor bank name , account no..(change layout of report for output ) this detail can be seen

  • Please tell me the releasing date of iOS7

    Please tell me the releasing date of iOS7 Im asking about original version realese. Not beta.

  • Loads of apps crashing

    Hi All I have an iPhone 4. It is up to date (v4.3.5). This morning all of a sudden (it was working fine last night!) apps are crashing all over the places. I have tried both a normal 'off and on', and a hard reset by holding the power down for ages.