Insert ,Delete & Add a row in ALV

HI,
I have a ztable and i have used REUSE_ALV_GRID_DISPLAY to display all the data.
But the problem is i have want to give the user an option to Delete , Insert & Modify the data.
Can any please give me some i/p's
thanks
Ranjit

Continued..
  IF NOT git_selected_rows IS INITIAL.
* Pass the selected rows into a internal table
        LOOP AT git_selected_rows INTO ls_selected_row.
          LOOP AT git_po INTO gwa_po.
            lv_idx = sy-tabix.
            IF lv_idx EQ ls_selected_row-index.    "row_id.
              lwa_po_temp = gwa_po.
              APPEND lwa_po_temp TO git_po_temp.
            ENDIF.
          ENDLOOP.
        ENDLOOP.
ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT
for grid dispaly this is the code
DATA :  lc_custom_control_name_100 TYPE scrfname VALUE 'CC_GRID_100',
          lr_container_100 TYPE REF TO cl_gui_custom_container.
  DATA : lit_po TYPE TABLE OF zpo_approver,
         lwa_po LIKE LINE OF lit_po.
IF gr_alvgrid_100 IS INITIAL .
*----Creating custom container instance
    CREATE OBJECT lr_container_100
      EXPORTING
        container_name              = lc_custom_control_name_100
      EXCEPTIONS
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5
        OTHERS                      = 6.
    IF sy-subrc <> 0.
*--Exception handling
    ENDIF.
*----Creating ALV Grid instance
    CREATE OBJECT gr_alvgrid_100
      EXPORTING
        i_parent          = lr_container_100
      EXCEPTIONS
        error_cntl_create = 1
        error_cntl_init   = 2
        error_cntl_link   = 3
        error_dp_create   = 4
        OTHERS            = 5.
*----Preparing field catalog.
    PERFORM prepare_field_catalog_100 CHANGING gt_fieldcat_100.
*----Preparing layout structure
    PERFORM prepare_layout CHANGING gs_layout .
    CALL METHOD gr_alvgrid_100->set_table_for_first_display
      EXPORTING
        is_layout                     = gs_layout
      CHANGING
        it_outtab                     = git_po
        it_fieldcatalog               = gt_fieldcat_100
        EXCEPTIONS
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        OTHERS                        = 4.
Regards,
Nagaraj

Similar Messages

  • How to delete a particular row in ALV table

    Hi,
    How to delete a particular row in ALV table based on some condition(by checking value for one of the columns in a row)
    Thanks
    Bala Duvvuri

    Hello Bala,
    Can you please be a bit more clear as to how you intend to delete the rows from your ALV? By the way deleting rows from an ALV is no different from deleting rows from a normal table. Suppose you have enabled selection property in ALV & then select multiple rows and click up on a button to delete the rows then below would be the coding: (Also keep in mind that you would have to maintain the Selection property of the context node that you are binding to your ALV to 0..n)
    data : lr_table_settings  TYPE REF TO if_salv_wd_table_settings,
                 lr_config          TYPE REF TO cl_salv_wd_config_table.
      lr_table_settings  ?= lr_config.
    ** Setting the ALV selection to multiple selection with no lead selection
      lr_table_settings->set_selection_mode( value = cl_wd_table=>e_selection_mode-multi_no_lead ).
    Next delete the selected rows in the action triggered by the button:
    METHOD onactiondelete_rows .
      DATA:  wd_node TYPE REF TO if_wd_context_node,
             lt_node1 TYPE ig_componentcontroller=>elements_node,
             wa_temp  TYPE REF TO if_wd_context_element,
             lt_temp  TYPE wdr_context_element_set,
             row_number TYPE i VALUE 0.
      wd_node = wd_context->get_child_node( name = 'NODE' ).
      CALL METHOD wd_node->get_selected_elements
        RECEIVING
          set = lt_temp.
      LOOP AT lt_temp INTO wa_temp.
        wd_node->remove_element( EXPORTING element = wa_temp ).
      ENDLOOP.
      CALL METHOD wd_node->get_static_attributes_table
        EXPORTING
          from  = 1
          to    = 2147483647
        IMPORTING
          table = lt_node1.
      wd_node->bind_table( new_items = lt_node1 ).
    ENDMETHOD.
    If in case this isn't your requirement please do let me know so that I can try come up with another analysis.
    Regards,
    Uday

  • Append/Insert(not Single)  Mutliple rows on ALV Webdynpro

    Hello Friends,
    We all know that the std button Append/Insert , can insert only one row on a single click.
    My specific requirement is :
    1)  that when User clicks on this button(single click), we need to see  'n' rows( n will  be provided as a input box for th user to provide like 5,10,12 etc) appended/inserted at the end of the ALV list .
    2) In all the new rows, some of the columns should be defaulted to some data.
    Is there any approach to achieve this requirement?
    Regards
    Vinay.

    Hello Kiran,
    As i mentioned earlier, I already implemented the above said approach. Its working..
    But just wanted to check if there is any facility as these new rows will not be captured centrally in the
    r_param->t_inserted_rows (in data check event). So that i can move on with other processing .
    FYI...  there is a method in the class CL_SALV_WD_CONFIG_TABLE - IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_APPEND_ROWS_ALLOWED( which is obsolete now).
    I dont know why this facility is not provided.
    May be we need to check this faciltiy as well with Thomas Jung to re-add this in future.
    Anyways..i continue with my approach...
    Regards
    Vinay.

  • How do I insert/Delete/Update a row to the DB Table from Business Component Browser

    I am using the wizard and created a project containing Business component which contain some table.
    When I run the project I could see "Oracle Business Component Browser(local)" and when I select some table from "View Object Member" I get a window displaying all the field of that table and I could browse all the info.
    My Problem is when I try to insert a new record/Delete the existing record or update some record it never gets reflected to the DataBase.
    When I try to insert a new row I did save and there was a dialog box displayed saying "Transaction ID is 1". But finally It's not reflected in the Database.
    Can some one guide me how can I do insert/delete/update operation from Oracle Component Business Browser so that the changes reflect to the Original DataBase.
    Thanks in advance
    Jitendra

    Jitendra,
    This may be a problem of caching. If you do an update,insert, or delete, and do not receive an error, then the transaction should indeed be posted.
    I assume you are hitting the Save icon after your changes if you are getting a transaction ID. Are you checking for the updates through another session (i.e. SQL*Plus), or do you then requery the View Object in the tester? Do you exit the tester and come back in and not see the changes?

  • Missing functionality.Draw document wizard - delete/add rows and copy/paste

    Scenario:
    My customer is using 2007 SP0 PL47 and would like the ability to change the sequence of the rows of the draw document wizard and delete/add multiple rows (i.e. when you create an AR Invoice copied from several deliveries).
    This customer requires the sequence of items on the AR invoice to be consistent with the sequence on the original sales order including text lines and subtotals. Currently we cannot achieve this when there are multiple deliveries.
    Steps to reproduce scenario:
    1.Create a Sales order with several items and use text lines, regular and subtotals.
    2.Create more than one delivery based on the sales order and deliver in a different sequence than appears on the sales order.
    3.Open an AR Invoice and u2018Copy fromu2019 > Deliveries. Choose multiple deliveries. Choose u2018Customizeu2019.
    4.Look at the sequence of items on the Invoice. How can the items and subtotals and headings be moved around so they appear in the same sequence as on the sales order?
    Current Behaviour:
    In SAP B1 itu2019s not possible to delete or add more than one row at a time on the AR Invoice or Draw Document Wizard.
    Itu2019s not possible to copy/paste a row on the AR Invoice or Draw Document Wizard.
    Itu2019s not possible to change the sequence of the rows using the Draw Document Wizard.
    Business Impact: This customer is currently spending a lot of time trying to organize the AR invoice into a presentable format. They have to go through the invoice and delete the inapplicable rows one by one (because SAP B1 does not have the ability to delete multiple lines at a time) and also has to manually delete re-add rows to make it follow the same sequence as the sales order.
    Proposals:
    Enable users to delete or add more than one row at a time on the AR Invoice or Draw Document Wizard.
    Enable users to copy/paste rows on the AR Invoice or Draw Document Wizard.

    Hi Rahul,
    You said 'It is not at all concerned with Exchange rate during GRPO...' If that is the case how does the Use Row Exchange Rate from Base Document in the draw document wizard work? Does this mean 1 GRPO : 1 AP Invoice so I can use the base document rate?
    How should I go about with transactions like these? That is adding an AP Invoice from multiple GRPO's having different exchange rates. What I am trying to capture here is that in the AP Invoice, base document rates should be used in the row item level and not the current rate when adding the invoice.  
    Thanks,
    Michelle

  • How to get Inserted and Deleted Rows in ALV

    I have looked at the BC_EDIT* examples but I still can't figure out how to determine which rows were Inserted and Deleted from the ALV list.  Can someone please provide me the code to do this?
    Thanks.
    Sandy

    Hi sandy,
    i dont think you will have issue in inserting a row in ALV because whenever the user done some actions say for eg clicking the pushbutton at the toolbar you could insert the a new row into the ALV.for creating pushbutton you need to use the events TOOLBAR,USER_COMMAND.
    deleting a row may also follow the above procedure.
    Have a look at the demo program
    BCALV_GRID_05
    Cheers,
    Abdul Hakim

  • To add/delete the rows in ALV report outpout

    Hi,
    Is there any way by which we can  add/delete the rows in ALV report output.
    Thanks
    Ankul

    Hi,
    Try out this way:
    data: i_modified TYPE STANDARD TABLE OF mara,"For getting modified rows
            w_modified TYPE mara.
    CASE e_ucomm.
          WHEN 'EDIT'.
          perform save_database.
          CALL METHOD ref_GRID->REFRESH_TABLE_DISPLAY.
        ENDCASE.
    FORM SAVE_DATABASE .
    data: i_selected_rows TYPE lvc_t_row,                "Selected Rows
          w_selected_rows TYPE lvc_s_row.
    * Getting the selected rows index
        CALL METHOD ref_grid->get_selected_rows
                    IMPORTING  et_index_rows = i_selected_rows.
    * Through the index capturing the values of selected rows
        LOOP AT i_selected_rows INTO w_selected_rows.
        READ TABLE it_tab INTO wa_it_tab INDEX w_selected_rows-index.
        IF sy-subrc EQ 0.
          MOVE-CORRESPONDING wa_it_tab TO w_modified.
          APPEND w_modified TO i_modified.
        ENDIF.
      ENDLOOP.
      MODIFY mara FROM TABLE i_modified.
    Thanks,
    Krishna

  • Insert a row in ALV

    Hi ,
    I need to insert a row in ALV output. On click of a Inser Row button a pop up should show with a parameter.Once the value in entered in the parameter enter is hit , the first column of the new row should have value put in that parameter as non editable field.
    The Insert row of standard toolbar inserts a blank row . Is there any way to incorporate the above logic in the standard toolbar?
    I'm using CL_GUI_ALV_GRID to display the ALV.
    It would be helpful if you provide sample coding.
    Thanks.
    Ajith
    Edited by: Ajith  Krishna on Oct 28, 2008 8:01 PM

    Hello Ajith
    The enhanced version of sample report ZUS_SDN_ALVGRID_EDITABLE_8A demonstrates how to implement your requirement.
    *& ZUS_SDN_ALVGRID_EDITABLE_8A
    *& Thread: Insert a row in ALV
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1105097"></a>
    *& Thread: Blanking values on ALV Grid Row Duplicate
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1057161"></a>
    *& Thread: Delete line event in ALV
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="945471"></a>
    REPORT  zus_sdn_alvgrid_editable_8a.
    TYPES: BEGIN OF ty_s_outtab.
    INCLUDE TYPE knb1.
    TYPES: END OF ty_s_outtab.
    TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                          WITH DEFAULT KEY.
    DATA:
      gd_okcode        TYPE ui_func,
      gd_repid         TYPE syst-repid,
      gt_fcat          TYPE lvc_t_fcat,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_grid          TYPE REF TO cl_gui_alv_grid.
    DATA:
      gt_outtab        TYPE ty_t_outtab.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-DATA:
          mt_sel_rows     TYPE lvc_t_row.
        CLASS-METHODS:
          handle_toolbar
            FOR EVENT toolbar OF cl_gui_alv_grid
            IMPORTING
              e_object
              sender,
          handle_user_command
            FOR EVENT user_command OF cl_gui_alv_grid
            IMPORTING
              e_ucomm
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_toolbar.
    * define local data
        DATA: ls_button     TYPE stb_button.
        LOOP AT e_object->mt_toolbar INTO ls_button.
          CASE ls_button-function.
            when cl_gui_alv_grid=>MC_FC_LOC_INSERT_ROW.
              ls_button-function = 'INSERT_ROW'.
              MODIFY e_object->mt_toolbar FROM ls_button INDEX syst-tabix.
            WHEN cl_gui_alv_grid=>mc_fc_loc_delete_row.
              ls_button-function = 'DELETE_ROW'.
              MODIFY e_object->mt_toolbar FROM ls_button INDEX syst-tabix.
            WHEN cl_gui_alv_grid=>mc_fc_loc_copy_row OR
                 cl_gui_alv_grid=>mc_fc_loc_copy.
              ls_button-function = 'COPY_ROW'.
              MODIFY e_object->mt_toolbar FROM ls_button INDEX syst-tabix.
            WHEN OTHERS.
              CONTINUE.
          ENDCASE.
        ENDLOOP.
      ENDMETHOD.                    "handle_toolbar
      METHOD handle_user_command.
    * define local data
        DATA: lt_rows       TYPE lvc_t_row,
              ls_row        TYPE lvc_s_row.
        REFRESH: mt_sel_rows.
        CASE e_ucomm.
          when 'INSERT_ROW'.
          WHEN 'DELETE_ROW'.
          WHEN 'COPY_ROW'.
          WHEN OTHERS.
            RETURN.
        ENDCASE.
        "   User wants to delete or copy rows => store them in class attribute
        "   and trigger PAI afterwards where we actually delete /copy the rows
        "   and do the recalculations (in case of deletion)
        CALL METHOD sender->get_selected_rows
          IMPORTING
            et_index_rows = mt_sel_rows
    *        et_row_no     =
    *   Trigger PAI
        CALL METHOD cl_gui_cfw=>set_new_ok_code
          EXPORTING
            new_code = e_ucomm
    *      IMPORTING
    *        rc       =
      ENDMETHOD.                    "user_command
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    PARAMETERS:
      p_bukrs      TYPE bukrs  DEFAULT '2000'  OBLIGATORY.
    START-OF-SELECTION.
      SELECT  * FROM  knb1 INTO CORRESPONDING FIELDS OF TABLE gt_outtab
             UP TO 15 ROWS
             WHERE  bukrs  = p_bukrs.
      PERFORM init_controls.
      SET HANDLER:
        lcl_eventhandler=>handle_toolbar      FOR go_grid,
        lcl_eventhandler=>handle_user_command FOR go_grid.
      " Used to replace standard toolbar function code with custom FC
      go_grid->set_toolbar_interactive( ).
    * Link the docking container to the target dynpro
      gd_repid = syst-repid.
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = gd_repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * ok-code field = GD_OKCODE
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    **      CALL METHOD go_grid1->refresh_table_display
    ***        EXPORTING
    ***          IS_STABLE      =
    ***          I_SOFT_REFRESH =
    **        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.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN 'INSERT_ROW'.
          perform INSERT_ROW.
        WHEN 'DELETE_ROW'.
          PERFORM delete_rows.
        WHEN 'COPY_ROW'.
          PERFORM copy_rows.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
      CALL METHOD go_grid->refresh_table_display
    *      EXPORTING
    *        IS_STABLE      =
    *        I_SOFT_REFRESH =
        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.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  BUILD_FIELDCATALOG_KNB1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog_knb1 .
    * define local data
      DATA:
        ls_fcat        TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'KNB1'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 2
          OTHERS                       = 3.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Only non-key fields are editable
      ls_fcat-edit = 'X'.
      MODIFY gt_fcat FROM ls_fcat
        TRANSPORTING edit
        WHERE ( key NE 'X' ).
    ENDFORM.                    " BUILD_FIELDCATALOG_KNB1
    *&      Form  INIT_CONTROLS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM init_controls .
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent = cl_gui_container=>screen0
          ratio  = 90
        EXCEPTIONS
          OTHERS = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Create ALV grid
      CREATE OBJECT go_grid
        EXPORTING
          i_parent = go_docking
        EXCEPTIONS
          OTHERS   = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Build fieldcatalog and set hotspot for field KUNNR
      PERFORM build_fieldcatalog_knb1.
    * Display data
      CALL METHOD go_grid->set_table_for_first_display
        CHANGING
          it_outtab       = gt_outtab
          it_fieldcatalog = gt_fcat
        EXCEPTIONS
          OTHERS          = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " INIT_CONTROLS
    *&      Form  delete_rows
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM delete_rows .
    * define local data
      DATA: ls_row    TYPE lvc_s_row.
      SORT lcl_eventhandler=>mt_sel_rows BY index DESCENDING. " !!!
      LOOP AT lcl_eventhandler=>mt_sel_rows INTO ls_row.
        DELETE gt_outtab INDEX ls_row-index.
      ENDLOOP.
      " After deleting rows do RE-CALCULATION
    *  perform RECALCULATION.
    ENDFORM.                    " delete_rows
    *&      Form  COPY_ROWS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM copy_rows .
    * define local data
      DATA: ld_next   TYPE i,
            ls_row    TYPE lvc_s_row,
            ls_outtab TYPE ty_s_outtab.
      SORT lcl_eventhandler=>mt_sel_rows BY index DESCENDING. " !!!
      LOOP AT lcl_eventhandler=>mt_sel_rows INTO ls_row.
        READ TABLE gt_outtab INTO ls_outtab INDEX ls_row-index.
        CLEAR: ls_outtab-akont. " In your case: clear GUID
        ld_next = ls_row-index + 1.
        INSERT ls_outtab INTO gt_outtab INDEX ld_next.
      ENDLOOP.
    ENDFORM.                    " COPY_ROWS
    *&      Form  INSERT_ROW
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form INSERT_ROW .
    * define local data
      DATA: ld_value1  type SPOP-VARVALUE1,
            ls_outtab  TYPE ty_s_outtab.
      CALL FUNCTION 'POPUP_TO_GET_ONE_VALUE'
        EXPORTING
          textline1            = 'Enter Value (4 Chars):'
    *     TEXTLINE2            = ' '
    *     TEXTLINE3            = ' '
          titel                = 'Enter Value'
          valuelength          = 4
        IMPORTING
    *     ANSWER               =
          VALUE1               = ld_value1
        EXCEPTIONS
          TITEL_TOO_LONG       = 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.
      ls_outtab-kunnr = ld_value1.
      ls_outtab-bukrs = ld_value1.
      append ls_outtab to gt_outtab.
    endform.                    " INSERT_ROW
    Regards
      Uwe

  • 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

  • Inserting row in ALV

    hi  experts ..
    I want to add a row in the alv when i click on add button..
    I know there is insert row and append row buttons available in alv but i dont want those names ..
    Can i change the name of standard buttons or is there sm class that i can use to develop this functionality.
    jagruti.

    Hi Jagruti,
    You just have to add a new button with whatever name you want, and map it to the existing functionality in ALV. It will work and you dont need to do anything else.
    The code will be:
    data:
    lr_button type ref to cl_salv_wd_fe_button,
    lr_function type ref to cl_salv_wd_function.
    CREATE OBJECT lr_button.
    lr_button->set_text( 'Your text' ).
    lr_button->set_tooltip( 'Your tooltip' ).
    lr_function = l_alv_model->if_salv_wd_function_settings~create_function( id = 'INSERT' ).
    <b>lr_function->set_function_std( IF_SALV_WD_C_STD_FUNCTIONS=>EDIT_APPEND_ROW ).</b>
    lr_function->set_editor( lr_button ).
    The method set_function_std sets your funcion to take the behaviour of the standard ALV function for inserting rows. So it would work automatically. You have only changed the text.
    <b>If your problem is solved, please award points and close the threads. Couple of your previous threads are still open, please close them</b>
    Regards,
    Nithya

  • Alv add new row with counter

    Hello.
    I would like to add a new row to an ALV GRID CONTROL in which one of the fields is a counter. Which methods, codes have I to change/write?
    For example:
    ALV
    COUNTER FLIGHT DESTINATION
    1     1234  CDG
    2     3443  SVQ
    On adding a new row :
    COUNTER FLIGHT DESTINATION
    1     1234  CDG
    2     3443  SVQ
    3
    Thanks in advance!!!

    There are two options.
    1.  Use the data_changed event to put in the values.
    - Enable edit mode for the grid, so the row create/insert/copy icons appear on the toolbar. 
    - Create an event handler for the DATA_CHANGED event
    - In this method, use attribute table er_data_changed->MT_INSERTED_ROWS to check for new rows, and then er_data_changed->modify_cell to put in the line number.
    The problem is that if your counter field is set as non-editable, then you cannot put a value in...
    2.  implement your own add function.
    - Add a button to the toolbar (implement methiod for event handle_toolbar)
    - Create an event handler for event handle_user_command.
    - In the handler method, add a row to the outtab table used by the grid (with the correct line number).
    - CALL METHOD gr_grid->refresh_table_display to update the display with the additional line.
    Regards
    Michael

  • Editable ALV (CL_GUI_ALV_GRID) Pasting add new rows

    Hi all,
    I have a problem with OO ALV.
    I'm using class CL_GUI_ALV_GRID as I need to have a couple of editable columns.
    Let's say that we have columns Material and Quantity. And Quantity is editable.
    Toolbar buttons for adding new rows, paste, copy, are all disabled.
    Suppose I have 2 rows in the ALV.
    If I copy to clipboard from, for example, Excel, more than 2 rows, and paste them in Quantity column of the ALV, the result is that new rows are inserted till all the information in the clipboard is pasted. The new rows have all blank values except for the column I'm pasting.
    I do not want this rows inserted. I supposed that this wounldn't happened, as there are no buttons for inserting rows.
    Anybody knows how to change this behaviour?
    Thanks a lot.
    Alejandro Galliano.

    Hi Alejandro,
      You can implement your own functionality to create new row.You can add your own button in ALV   for New row creation. In another simple way is you place the button in the screen which display the ALV and implement the logic in PAI of the screen.
    the logic is simple add new row in the internal table which you are using to display ALV and refresh the ALV.Then your new row will appear in the Grid.
    Regards,
    Mike

  • Insert  Blank row  After every Row  in alv report

    How to insert blank  row After every row  in Alv report

    what do you mean by a 'blank row'? ALV displays tabular data with 'any' number of columns. Now if you actually want a blank row (no columns at all, just a row), then that is just not possible. If I'm not mistaken, this question was posted before, so try to do a search on SCN. See what is says.

  • To add additonal rows(text)  in ALV report

    Hi there,
    I want to add additional ROWS at the bottom of each grouping.
    Right now I am getting customer wise total comission amount but the requirement is on commsion amt ,i need to calculate 10 % tax and 2% tax and these taxes should get genrated below the commsion amt column as like below:
    Company code Customer Commsion Amt
    2000 101 1000
    2000 101 2000
    Total Comsion 3000
    10% Service Tax 300
    2% Edn Tax 6
    Total 3306
    2000 102 1230
    2000 102 678
    The output should be like this in ALV report .Could anyone plz help me out on this.
    I will really appreciate your help.
    Thanks,

    Hi Archana,
    You can have the subtotal displayed for each company code and commision in the alv.
    At end of each  comp code and customer , pass the total of the whole amount into a line and you can display a line of this total. 
    Your alv gets displayed like this .
    2000 101 1000
    2000 101 2000
    Total Comsion 3000
    10% Service Tax 300
    2% Edn Tax 6
                            3306
    Thanks,
    Guru

  • How to remove the the standard button APPEND/INSERT/DELETE in webdynpro alv

    Hello,
    how to remove the the standard button APPEND/INSERT/DELETE in webdynpro-abap  alv
    Thanks
    Rakshar

    Use  this.
        data lo_cmp_usage type ref to if_wd_component_usage.
        lo_cmp_usage =   wd_this->wd_cpuse_alv1( ).
        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_alv1( ).
        data lo_value type ref to cl_salv_wd_config_table.
        lo_value = lo_interfacecontroller->get_model(
        data: lr_std type ref to if_salv_wd_std_functions.
        lr_std ?= lo_value.
        lr_std->set_export_allowed( abap_false ).
    NOte: ALV1 is alv component name
    Regards
    Srinivas
    Edited by: sanasrinivas on Dec 1, 2011 6:11 AM

Maybe you are looking for

  • How can i transfer my music from one account to another on a different computer?

    So i have an itunes account on dell laptop and i share that account with other famliy members. I recently bought a mac pro and wanted to create a new account that way i can use icloud, is there any possible way to transfer everything from my old libr

  • Assigning a Character in a String

    Looking to assign a character in a string but it looks like charAt is read only? Ideas?

  • Error in IW32 transaction

    Hi all,         I am having a problem in TECO ing a service order. I have done the configuration required for the settlement rules to get generated. When I release the order and settle it the order is getting settled. But when I am trying to TECO the

  • Error 1015 when updating unable to restore to old

    I just recieved a iphone 3 g, I connected to Itunes and it said to update to latest version of OSi, this failed with an error 1015. So I tried to restore back to original software and this too failed with same error 1015. What to do next? thanks robb

  • Photoshop CS6 gone due to virus...how do I reinstall it?

    A long time ago I downloaded photoshop CS6 for my computer. A few days ago I got a virus and had to get my computer completely re-booted. I got to save my personal files, but anything that I downloaded I had to re-install them. The programs I remembe