Row wise total in editable ALV

hello all,
            I am workin on editable alv, the user need to enter the values in the editable fields and in the last column(non-editable) i need to populate the total row wise,as soon as user enters a value and goes to next editable cell or on entering a vale and press enter.how to accomplish this task...
with regards,
sandeep akella.
Edited by: sandeep akella on Aug 20, 2009 1:58 PM

You need to Implement the OnCellAction event.follow these steps;
1. Goto WDDOMODIFYVIEW and place the following code
IF first_time IS INITIAL.
    DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
    lo_cmp_usage =   wd_this->wd_cpuse_usg_alv( ).
    IF lo_cmp_usage->has_active_component( ) IS INITIAL.
      lo_cmp_usage->create_component( ).
    ENDIF.
    DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
    lo_interfacecontroller =   wd_this->wd_cpifc_usg_alv( ).
    DATA lo_value TYPE REF TO cl_salv_wd_config_table.
    lo_value = lo_interfacecontroller->get_model(
    CALL METHOD lo_value->if_salv_wd_table_settings~set_cell_action_event_enabled
     EXPORTING
        value = abap_true.
  ENDIF.
2. Implement the onCellAction event as follows;
    Goto Methods tab, create a new method. Method Type- Event Handler , Event - ON_CELL_ACTION
3. Now in this  method retrive the contents of the row and calculate the value as follows.
DATA: l_element TYPE REF TO if_wd_context_element.
  DATA:ls_stru TYPE wd_this->element_cn_alv.
  DATA: l_node TYPE REF TO if_wd_context_node.
  l_node  = wd_context->get_child_node( 'CN_ALV' ).
  l_element = l_node->get_element(  r_param->index ).
  l_element->get_static_attributes( IMPORTING static_attributes = ls_stru ).
  ls_stru-last_col = ls_stru-col1+ls_stru-col2....+ ls_stru-col5. " add all the cells data
  l_element->set_static_attributes( exporting static_attributes = ls_stru ).

Similar Messages

  • Row wise total in oops alv..............

    hi,
    i hav 4 fields among which 3 fields are quantity fields(f1 f2 f3) and i want the total of these threee fields in the fourth field f4....
    can anyone explain how to do this.....

    Hi,
    while preparing your final internal table you have to do like bleolw
    loop at it_final into wa_final.
    wa_final-f4 = wa_final-f1 + wa_final-f2 + wa_final-f3.
    modify it_final from wa_final index sy-tabix transporing f4.
    endloop.
    it works...
    Note: F4 will be the filed at the end in your final internal table.
    Thanks!

  • How to find item wise totals and header wise total using hierarchical ALV

    Hi Friends,
    I came across an issue of finding  item wise total using hierarchical ALV. I am getting header wise total by setting the field catalog. May you help me in finding  Item wise total.
    Regards
    Nikhil.

    hi,
    you must use "w_fieldcat-do_sum = 'X'" and change your layout like :
    w_sort-fieldname = 'FIELD'.
      w_sort-tabname   = 'TABNEME'.
      w_sort-up        = 'X'.
      w_sort-subtot    = 'X'.
      APPEND w_sort TO i_sort.
      CLEAR w_sort.
    you can use detailed code from http://wiki.sdn.sap.com/wiki/display/Snippets/Subtotalsinhirarchial+report.
    regards,
    orhan
    Edited by: goktasor on Jun 1, 2010 11:03 AM (need points : ) )

  • Ordering row wise totals in a column.

    Hi,
    I have a report in Pivot view having two columns namely Count and Category. I have to apply sort on these two columns-first on Count and then on Category.
    The Total Count is also calculated row wise. Now when I apply sort on count column, only the values in that column are being sorted and not according to row wise total count. But my requirement is to sort the total count row wise first and then by Category.I am unable to do so.
    Kindly provide me the solution to this problem.
    Thanks
    Ankita

    Use RunningSum() function.
    Regards,
    Rohit

  • Adding A row to a non editable ALV in ABAP Webdybpro

    I have an ALV thats currently non editable. My requirement is that, when a User clicks on an Insert Row button, then a new row has to be inserted in the ALV and this row alone should become completley editable. Is there any means of doing this. I am aware of some standard editable buttons (such as Insert Row, Delete row etc) but somehow this does not meet my requirement as 1.I dont need some standard buttons such as Check and 2. The whole ALV has to be editable for these buttons to work.

    There are options such as set_insert_row_allowed set_delete_row_allowed etc that lets you do this. And to the editable part of the questions, those rows can be bound to another attribute in a context and as per the needs that rows can be made editable or not.

  • Row wise total in column cell

    Hi,
    I would like to access a total(which is a sum of some 25 rows) in another column cell.
    How do i do that.
    Regards,
    Tulsi.

    Hi Tulsi,
    Create variable
    =If [Product]InList("A";"B";"C") Then Sum([Amount]+[Amount2]+[Amount3])
    or use this formula
    = If [Product]=[Product] Then Sum([Amount]+[Amount2]+[Amount3])
    Regards
    Mustafa

  • In alvs how to do totals by colum wise and row wise

    hi,
    in alvs how to do totals by colum wise and row wise
    could u plz explain clearly with coding

    Hi Rajesh,
    Go through these links...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    Reward Points if this helps,
    Satish

  • Add a row after Total row in ALV report

    Hi Experts,
    I have a report is displayed by  ALV format(not use function module to display it but use Class cl_gui_custom_container),I want to add a row after the total row. for example,
    Customer   amount1    amount2    amount3 
    10000         1,234        1,000         2,000
    10001         4,000        2,000         1,000
    10002         1,300        1,000         3,000
    11000         1,200        4,000         3,000
         Total:     7,734        8,000         9,000
    Ratio%        31.27       32.34          36.39
    the row of 'Total' is calculated by fieldcat-do_sum = 'X' But after the Total row we need a Ratio row to display the ratio. Yes we can calculate the total amout and ratio and then append it into the output itab, but we don't like this solution.We want to keep the total function in the ALV report.Any experts can poit me a direction. Thanks in advance.
    Joe

    Djoe,
    First you need to handle the user command,in order to capture the button action. For this you need to implment a class, i  am attaching sample codes here
    In top include write the following code
    CLASS lcl_event_handler DEFINITION .
      PUBLIC SECTION .
        METHODS:
         handle_toolbar  FOR EVENT toolbar                   " To add new functional buttons to the ALV toolbar
                         OF        cl_gui_alv_grid
                         IMPORTING e_object,
         handle_user_command FOR EVENT user_command          " To implement user commands
                            OF cl_gui_alv_grid
                            IMPORTING e_ucomm .
      PRIVATE SECTION.
    ENDCLASS.                                               " Lcl_event_handler DEFINITION
    Now   <b>Class implementation</b>
    CLASS lcl_event_handler IMPLEMENTATION .
      METHOD handle_toolbar.                                " Handle Toolbar
        PERFORM f9500_handle_toolbar USING e_object.
    ENDMETHOD .                                            " Handle_toolbar
      METHOD handle_user_command .                          " Handle User Command
        PERFORM f9600_handle_user_command USING e_ucomm .
      ENDMETHOD.
    ENDCLASS .                                              " lcl_event_handler IMPLEMENTATION
    FORM f9600_handle_user_command USING p_e_ucomm TYPE sy-ucomm.
      CONSTANTS:c_newl(4) TYPE c
                          VALUE 'NEWL',               " New line
                c_copy(4) TYPE c
                          VALUE 'COPY',               " Copy
                c_corr(4) TYPE c
                          VALUE 'CORR'.               " Correction
      CASE p_e_ucomm .
        WHEN c_newl.
    Create a new line
          PERFORM f9610_insert_new_line.
    ENDFORM.                                          " f9600_handle_user_command
    FORM f9610_insert_new_line .
    *Data Declarations
      DATA: lt_rows     TYPE lvc_t_row,                 " Itab for row property
            ls_rows     TYPE lvc_s_row,                 " Work area for row
            lv_cntid    TYPE i.                         " Counter
      DATA: gv_index TYPE sy-index.
      CLEAR gs_last.
      CALL METHOD gr_alvgrid->get_selected_rows
        IMPORTING
          et_index_rows = lt_rows.
      READ TABLE lt_rows INTO ls_rows INDEX 1.
      IF sy-subrc EQ 0.
        gv_index = ls_rows-index + 1.
      ELSE.
        gv_index = 1.
      ENDIF.
      DESCRIBE TABLE gt_last LINES lv_cntid.
      lv_cntid = lv_cntid + 1.
      gs_last-cntid = lv_cntid.
      INSERT gs_last INTO gt_last INDEX gv_index.
      LOOP AT gt_last INTO gs_last FROM gv_index TO gv_index.
    Make the new line editable
        PERFORM f9611_style.
      ENDLOOP.
      CALL METHOD gr_alvgrid->refresh_table_display
        EXCEPTIONS
          finished = 1
          OTHERS   = 2.
    ENDFORM.                    " f9610_insert_new_line
    You can ask questions doubts if any!
    regards
    Antony Thomas

  • Get Current row in Editable ALV

    Hi,
    I have editable alv, when i press "insert row" or "Append row" i need to get current inserted/appended row element reference or index.
    How can i get this??
    Please suggest.

    Hi kranthi ,
    While inserting row you must be selecting a row, you can get the index of the selected row by this following code
    get Index of selected table item
    CALL METHOD NODE_NAME->GET_LEAD_SELECTION_INDEX
    RECEIVING INDEX = Lv_Indx.
    ( DATA: Lv_Indx Type i )
    or while you are appending a row you can use Describe int_table LINES lv_line and use the value of 'lv_line' as the index.
    Regards

  • How to make a particular row and column field editable in ALV

    Hi Experts,
    I have a requirement to make a particular row and column field editable in ALV output. Like i need to make 2nd row - 4th column editable of ALV output.
    Kindly help me out to solve this.
    Any help would be appreciated.
    Thanks,
    Ashutosh

    Hi Ashutosh,
    please check below, explained by some experts.
    In the below link  editing two columns MOD_RANK and TECH_RANK.
    These two columns will be in edit mode once after selecting the required record
    Editing single cell in a row of ALV table
    And also look for more info
    http://scn.sap.com/thread/884976

  • Web dynpro abap - Editable alv - check row

    Hi, I'm working with an editable ALV table and I'd like to check wether the row the user has just entered is valid.
    IF the entered row is not valid, then it should disappear from the table.
    ATM i'm trying something out in WDDOMODIFYVIEW,

    Hi,
    Yes you have to do coding in WDDOMODIFYVIEW only.

  • Editable ALV- Disable Add, delete row buttons

    Hi,
    I have an editable ALV using OO Grid. Some columns are editable and some are not using field catalog. I want to disable the 'add new row' and 'delete row' buttons. How to go about it ?
    Regards,
    Vin

    You can simply add them to the "Exclude" table and pass them to the SET_TABLE_FOR_FIRST_DISPLAY method.
       data: iexclude type ui_functions,
       data: xexclude type ui_func.
        define macro_exclude.
         xexclude = &1.
          append xexclude to iexclude.
        end-of-definition.
        macro_exclude cl_gui_alv_grid=>mc_fc_loc_copy_row.
        macro_exclude cl_gui_alv_grid=>mc_fc_loc_delete_row.
        macro_exclude cl_gui_alv_grid=>mc_fc_loc_append_row.
        macro_exclude cl_gui_alv_grid=>mc_fc_loc_insert_row.
        macro_exclude cl_gui_alv_grid=>mc_fc_loc_move_row.
        macro_exclude cl_gui_alv_grid=>mc_fc_loc_copy.
        macro_exclude cl_gui_alv_grid=>mc_fc_loc_cut.
        macro_exclude cl_gui_alv_grid=>mc_fc_loc_paste.
        macro_exclude cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
        macro_exclude cl_gui_alv_grid=>mc_fc_loc_undo.
        call method alv_grid->set_table_for_first_display(
            exporting
                 it_toolbar_excluding  = iexclude     "<--- Right HEre
                 is_layout             = xlayout
            changing
                 it_outtab       =  izcmptrans[]
                 it_fieldcatalog = ifc[] ).
    Regards,
    Rich Heilman

  • Row id in editable ALV while using MP_MOD_ROWS

    Hi Experts
    I have an editable alv with 13 fields editable in it.     Inside the DATA_CHANGED event i am making use of the attribute MP_MOD_ROWS for doing some specific validations. But I am not able to pass the row_id to the the mehod add_protocal_entry while multiple rows are in MP_MOD_ROWS ,since its not available MP_MOD_ROWS .
    Can anyone tell me how i can get the row_id for  each row in MP_MOD_ROWS.
    Since I need the full row for validations , i cant use MT_MOD_CELLS.
    Regards,
    Suniljith.SS

    Hi,
    this is an excerpt of what we dir:
    METHOD handle_data_changed.
      FIELD-SYMBOLS:
        <dat> TYPE ANY,
        <mod> TYPE LINE OF lvc_t_modi,
      LOOP AT er_data_changed->mt_mod_cells ASSIGNING <mod>.
    * error case, sy-subrc <> 0 returned by MESSAGE ... RAISING
          symsg2alv_changed_data_prot( ir_cl_alv_changed_data_prot  = er_data_changed
                                       is_modi                      = <mod> ).
          DELETE er_data_changed->mt_mod_cells.
    using the method
    METHOD symsg2alv_changed_data_prot.
      MESSAGE
        ID sy-msgid
        TYPE sy-msgty
        NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
        INTO mv_msg. "for debug transparancy
      ir_cl_alv_changed_data_prot->add_protocol_entry(
        i_msgid     = sy-msgid
        i_msgty     = sy-msgty
        i_msgno     = sy-msgno
        i_msgv1     = sy-msgv1
        i_msgv2     = sy-msgv2
        i_msgv3     = sy-msgv3
        i_msgv4     = sy-msgv4
        i_fieldname = is_modi-fieldname
        i_row_id    = is_modi-row_id
    *      i_tabix     = i_tabix
    ENDMETHOD.
    I do not understand your question about row_id as this is a component  lvc_t_modi table. I don't know MP_MOD_ROWS as there is only attribute  MT_MOD_ROWS of parameter ER_DATA_CHANGED of event DATA_CHANGED of CL_GUI_ALV_GRID.
    Regards,
    Clemens

  • Row wise running total

    is there any method to create row wise running total in Crystal Reports?

    >
    gourav.sengupta wrote:
    > Hi,
    >
    > I needed a running total but for rows. Therefore if the data set is in the following manner:
    >
    > Column 1             Column 2             Column 3             Column 4
    > A                         12                       13                       14
    > B                         11                       10                       19
    >
    > The the running total will appear as:
    > RT                        23                       23                       33
    >
    >
    > Thanks and Regards,
    > Gourav
    I am confused as to what you want.
    Your sample shows sums for collumns, not rows. You do not need a running total for this, just sum them.
    If you want to total each row, make a formula that adds them up and place on the row.

  • Editable ALV Grid: Append new rows

    Hi All,
    I have developed a report which will displays output in editable ALV grid list. Users can modify the values in output and save. These values will be stored in one custom table.
    My requirement is whenever user clicks on '+' mark (Create entries or Append or Copy: Standard toolbar) report should allow to enter new entries and save. How do I capture the selected function code? why becuase i need to display one value from the custom table in that added new row...
    Regards,
    Ramesh.

    Hi Ramesh,
    please check changed data event.....
    please go through the reference link......
    https://wiki.sdn.sap.com/wiki/display/Snippets/UpdatingtheInternalTable-AfterEditinALVusingFunctionModules
    Regards,
    Venkat

Maybe you are looking for

  • Why does "All windows from last session" never work?

    I've set Safari 5.1.1's preferences to restore the last session when launching. Safari launches fine but opens NO windows at all. I've attached a screenshot of the contents of the Safari folder within my library, but have no idea what these things do

  • Satellite L755: Win8.1 update - Flash Cards message: Win 8 test version

    Hi; After I update to windows 8.1 from win8 mc I am getting message after my laptop is starting from (Toshiba Flash Card) like the picture bellow, Any idea how to fix it? I remove VAP then system driver and then functions key utility and re installin

  • Problem updating iPod with iTunes

    I plugged in my iPod base to the computer, then put the iPod into the cradle. When I turned on the computer and opened iTunes, it said it was "updating" without me having to tell it to do so. Now, the iPod is flashing "Do not disconnect", as if it is

  • ORABPEL-77005 Uninitialized data element

    Hi, I created BPM process and I used BusinessRuleTask in it. During testing I get: Non Recoverable System Fault : <bpelFault><faultType>0</faultType><subLanguageExecutionFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><sum

  • Progess with my disconnection problem

    So I was having problems with my Infinity dropping every 10 mins to several hours, only for a mere 20 seconds. After several calls to BT, they claimed I had a line fault, and eventually asked me to test my connection by using the test socket. Success