ALV grid oo delete rows and update to table

Hi all
  How can I delete one row and update to the db table?
thanks

Hi,
Refer:-
The ALV Grid has events data_changed and data_changed_finished. The former method is
triggered just after the change at an editable field is perceived. Here you can make checks for
the input. And the second event is triggered after the change is committed.
You can select the way how the control perceives data changes by using the method
register_edit_event. You have two choices:
1. After return key is pressed: To select this way, to the parameter i_event_id pass cl_gui_alv_grid=>mc_evt_enter.
2. After the field is modified and the cursor is moved to another field: For this, pass cl_gui_alv_grid=>mc_evt_modifies to the same parameter.
To make events controlling data changes be triggered, you must select either way by
calling this method. Otherwise, these events will not be triggered.
To control field data changes, ALV Grid uses an instance of the class
CL_ALV_CHANGED_DATA_PROTOCOL and passes this via the event data_changed.
Using methods of this class, you can get and modify cell values and produce error messages.
Hope this helps you.
Regards,
Tarun

Similar Messages

  • Adding or Deleting Rows and Columns from Tables

    I have notices that you can't delete or add a row or columns from a table in iWeb without having problems.
    You may get two added or deleted.
    I should indicate that the table comes from Excel.
    Does anyone know of a work-around?

    Problem 1 - The sub-form 'Stds' was not configured for repeating rows.
    Problem 2 - The script was on the wrong event. The script should be on the 'change' event and not the 'initialize' event.
    Problem 3 - Which header row in which sub-form are you referring too?
    Steve

  • ALV Grid - Add/Delete/Change Values

    Hi,
    I have an ALV Grid with editable fields. I know want to process the changed, deleted and added lines.
    Is it not possible to get the shown ALV table back?
    In the event DATA CHANGED I have only attributes and methods of CL_ALV_CHANGED_DATA_PROTOCOL. So I have a method to get deleted, changed and added rows. But this event is only thrown, when I press enter or something else, but not when I´m pressing the icon for "add" or "delete".
    End when the event is thrown, i´m only getting the changed data. In some case it´s not possible to react in the right way.
    For example:
    I have an internal table with 5 lines. I now build the alv grid with that table. When I´m now adding a line with the "add" Icon, the event is not thrown. But if I press enter, I can handle the event. In the event methods I now have one line in added data. But when I´m deleting and adding again, it sometimes "forget" some actions I have done. Isn´t there a better way to compare the changed data in ALV with my "real" internal table?
    Next example:
    If I´m adding a new line to the alv, I can compare the key of that line with the exisiting keys of my internal table. If the user has typed in a line with the same key, I can throw and error message.
    But when the user is changing a line it should be possible to update that line. But how to compare, if the line is a new addewd line or a changed line?
    I hope it´s not too complicated to understand!
    Reward points guaranteed!

    As we can now make our ALV Grid editable we may require controlling input data. The ALV Grid has events “data_changed” and “data_changed_finished”. The former method is triggered just after the change at an editable field is perceived. Here you can make checks for the input. And the second event is triggered after the change is committed.
    You can select the way how the control perceives data changes by using the method “register_edit_event”. You have two choices:
    1. After return key is pressed: To select this way, to the parameter “i_event_id” pass “cl_gui_alv_grid=>mc_evt_enter”.
    2. After the field is modified and the cursor is moved to another field: For this, pass “cl_gui_alv_grid=>mc_evt_modifies” to the same parameter.
    To make events controlling data changes be triggered, you must select either way by calling this method. Otherwise, these events will not be triggered.
    To control field data changes, ALV Grid uses an instance of the class “CL_ALV_CHANGED_DATA_PROTOCOL” and passes this via the event “data_changed”. Using methods of this class, you can get and modify cell values and produce error messages. Here are some of those methods:
    get_cell_value: Gets the cell value. You pass the address of the cell to the interface.
    modify_cell : Modifies the cell value addressed via parameters.
    add_protocol_entry : Add a log entry. You make use of standard message interface with message type, message id, etc…
    protocol_is_visible : Make the error table visible or not.
    refresh_protocol : Refreshing log entries.
    Table 16 – Methods to use for controlling data changes
    With the reference of the instance, you can reach information about modifications. These useful attribute tables are:
    MT_MOD_CELLS
    Contains addresses of modified cells with “row_id”s and “fieldname”s.
    MP_MOD_ROWS
    Contains modified rows. Its type is generic.
    MT_GOOD_CELLS
    Contains cells having proper values
    MT_DELETED_ROWS
    Contains rows deleted from the list
    MT_INSERTED_ROWS
    Contains rows inserted to the list
    Rgds
    Mohit

  • How to add new row and update existing rows at a time form the upload file

    hi
    How to add new row and update existing rows at a time form the upload file
    example:ztable(existing table)
    bcent                      smh            nsmh         valid date
    0001112465      7.4                       26.06.2007
    0001112466      7.5                       26.06.2007
    000111801                      7.6                       26.06.2007
    1982                      7.8                       26.06.2007
    Flat file structure
    bcent                       nsmh         valid date
    0001112465     7.8     26.06.2007  ( update into above table in nsmh)
    0001112466     7.9     26.06.2007  ( update into above table in nsmh) 
    000111801                     7.6      26.06.2007 ( update into above table in nsmh
    1985                      11              26.06.2007   new row it should insert in table
    thanks,
    Sivagopal R

    Hi,
    First upload the file into an internal table. If you are using a file that is on application server. Use open dataset and close dataset.
    Then :
    Loop at it.
    *insert or modify as per your requirement.
    Endloop.
    Regards,
    Srilatha.

  • Deleting rows from very large table

    Hello,
    I need to delete rows from a large table, but not all of them, so I can't use truncate. The delete condition is based on one column, something like this:
    delete from very_large_table where col1=100;
    There's an index (valid, B-tree) on col1, but it still goes very slow. Is there any instruction which can help delete rows faster?
    Txh in adv.
    A.

    Your manager doesn't agree to your running an EXPLAIN PLAN? What is his objection? Sounds like the prototypical 'pointy-hair boss'.
    Take a look at these:
    -- do_explain.sql
    spool explain.txt
    -- do EXPLAIN PLAN on target queries with current index definitions
    truncate table plan_table
    set echo on
    explain plan for
    <insert query here>
    set echo off
    @get_explain.sql
    -- get_explain.sql
    set linesize 120
    set pagesize 70
    column operation     format a25
    column query_plan     format a35
    column options          format a15
    column object_name     format a20
    column order           format a12
    column opt           format a6
    select     lpad(' ',level) || operation "OPERATION",
         options "OPTIONS",
         decode(to_char(id),'0','COST = ' || NVL(to_char(position),'n/a'),object_name) "OBJECT NAME",
         cardinality "rows",     
         substr(optimizer,1,6) "OPT"
    from     plan_table
    start     with id = 0
    connect by prior id = parent_id
    There are probably newer, better ways, but this should work with all living versions of Oracle and is something I've had in my back pocket for several years now. It's not actually executing the query or dml in question, just running an explain plan on it.

  • Analysing and Updating a table

    Hi,
    Can anyone help me on follwing query..
    Can analyse of a table and updation on to same table can happen paralley?
    thank in advance.

    What's your db version? The very first thing is that you should not use the analyze command but dbms_stats package. Now , I am not sure why you want to gather the stats and update the table at the same time? As mentioned by Erica, the update should be followed with the stats gathering. And about the index usage, there are couple of things that can stop index from being used, for example, low selectivity on the column can very well stop the index. Other than that, if you are accessing the column containing the index alone and the column is supposed to contain the null values, oracle would rather use a FTS than using the index which actually makes perfect sense since use of index would result in incorrect data. So there can be couple of htings possible which may stop your index from being used. All what dbms_stats(and even Analyze) command would do , is to make the distribution of the data known tooracle. Having stats alone doesn't guarantee that the index would be used for sure.
    HTH
    Aman....

  • How to call a idoc in abap program and updates catsdb table

    how to call a idoc in abap program and updates catsdb table
    thank you,
    Jagrut BharatKumar Shukla

    Hi Kishan,
    You can refer to following help document,
    http://help.sap.com/saphelp_nw04/helpdata/en/bf/d005244e9d1d4d92b2fe7935556b4c/content.htm
    Regards,
    Meera

  • Check two columns and update other table

    HI ,
    I have a table called trackCenterline .Below is the table.
    What i want to do is If the segmentSequenceID is 1 it should pick the corresponding SegmentID i.e 10001 and Check for the same segment id in other table called TrackSegment which is below.  and pick the BeginMilepost of that segmentID and Update That
    Milepost in a new table .At end SegmentSequenceID number it should pick ENDMilepost and update
    TrackCenterline table.
    TrackSegment table
    In the below table for 10001 SegmentID it should pick BeginMilepost. For end Number of SegmentSequenceID in above table ID ends at 121 for that end sequenceID It should refer TrackSegment table below and pick EndMilepost and should be updated in another
    table Milepost column.
    after that a new segment starts with new sequence .and so on ...
    bhavana

    Hi Deepa_Deepu,
    According to your description, since the issue regards T-SQL. I will help you move the question in the T-SQL forums at
    http://social.technet.microsoft.com/Forums/en-US/home?forum=transactsql. It is appropriate and more experts will assist you.
    When you want to check two columns from two tables then return some results and update the third table. I recommend you use join function and combine two tables, then use update select from statement for modifying the Mailpost table. You can refer to the
    following T-SQL Statement.
    -----using join to connect to two tables
    select TrackCenterline.FeatureId,TrackCenterline.SegmentId,
    TrackCenterline.SegmentSequenceId,TrackSegment.BeginMilepost,TrackSegment.EndMilepost
    from dbo.TrackCenterline join dbo.TrackSegment
    on TrackCenterline.SegmentId=TrackSegment.SegmentId
    order by TrackCenterline.SegmentId, TrackCenterline.SegmentSequenceId
    ---the result shows as following.
    FeatureId SegmentId SegmentSequenceId BeginMilepost EndMilepost
    AMK100011 10001 1 61.0000 61.3740
    AMK100012 10001 2 61.0000 61.3740
    AMK100013 10001 3 61.0000 61.3740
    AMK1000121 10001 121 61.0000 61.3740
    AMK100021 10002 1 61.1260 61.7240
    AMK100023 10002 3 61.1260 61.7240
    AMK100033 10003 3 61.3740 62.9530
    -----Then you can use update select from statement to modify the Mailpost table, Or you can post the table structure of Mailpost
    And for more information, you can review the following article about update statement.
    http://www.techonthenet.com/sql/update.php
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Comparing Two tables with 300k records and update one table

    Could you let me know how to compare two tables having 300k records and update one table.below is the scenario.
    Table Tabl_1 has columns A,B and Tabl_2 has columns B,new_column.
    Column B has same data in both the tables.
    I need to update Tabl_2 in new_column with Tabl_1 A column data by comparing B column in both tables.
    I m trying to do using PLSQL Tables.
    Any suggestion?
    Thanks.

    Hi,
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved, so that the people who want to help you can re-create the problem and test their ideas.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    If you're asking about a DML statement, such as UPDATE, the CREATE TABLE and INSERT statements should re-create the tables as they are before the DML, and the results  will be the contents of the changed table(s) when everything is finished.
    Always say which version of Oracle you're using (for example, 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002
    ef2019c7-080c-4475-9cf4-2cf1b1057a41 wrote:
    Could you let me know how to compare two tables having 300k records and update one table.below is the scenario.
    Table Tabl_1 has columns A,B and Tabl_2 has columns B,new_column.
    Column B has same data in both the tables.
    I need to update Tabl_2 in new_column with Tabl_1 A column data by comparing B column in both tables.
    I m trying to do using PLSQL Tables.
    Any suggestion?
    Thanks.
    Why are you trying to use PL/SQL tables?  If tabl_1 and tabl_2 are regular database tables, it will be much simpler and faster just to use them.
    Depending on your requirements, you can do an UPDATE or MERGE, either in SQL or in PL/SQL.

  • Help req : alv grid with multiple row selection

    Hi all sap gurus,
    i have a alv list display program , in which i can select the o/p rows(multiple rows)
    and perform some actiom based on some icons .
    now i have to convert this in to grid display
    this is initial code i.e for list
    DATA :  BEGIN OF itab OCCURS 0.
            INCLUDE STRUCTURE ztest.
    DATA :  checkbox type c.
    DATA : END OF itab.
    s_layout-box_fieldname = 'CHECKBOX'.
      ty_events-name = slis_ev_top_of_page.
      ty_events-form =  'TOP_OF_PAGE'.
      APPEND ty_events TO it_events.
    ALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                i_program_name     = v_repid
                i_internal_tabname = 'ITAB'
                i_inclname         = v_repid
           CHANGING
                ct_fieldcat        = build_fieldcatalog.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
         EXPORTING
       I_INTERFACE_CHECK              = ' '
       I_BUFFER_ACTIVE                = ' '
         i_callback_program             = v_repid
         i_callback_pf_status_set       = 'SET_PF_STATUS'
         i_callback_user_command        = 'USER_COMMAND'
         i_structure_name               = 'ITAB'
         is_layout                      = s_layout
         it_fieldcat                    = build_fieldcatalog[]
       IT_EXCLUDING                   =
       IT_SPECIAL_GROUPS              =
       IT_SORT                        =
       IT_FILTER                      =
       IS_SEL_HIDE                    =
       I_DEFAULT                      = 'X'
       I_SAVE                         = ' '
       IS_VARIANT                     =
         it_events                      = it_events
       IT_EVENT_EXIT                  =
       IS_PRINT                       =
       IS_REPREP_ID                   =
       I_SCREEN_START_COLUMN          = 0
       I_SCREEN_START_LINE            = 0
       I_SCREEN_END_COLUMN            = 0
       I_SCREEN_END_LINE              = 0
    IMPORTING
       E_EXIT_CAUSED_BY_CALLER        =
       ES_EXIT_CAUSED_BY_USER         =
          TABLES
            t_outtab                    = itab
         EXCEPTIONS
           program_error                = 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.
    FORM user_command USING ucomm LIKE sy-ucomm
    selfield TYPE slis_selfield.
      IF ucomm = 'DELE'.
        LOOP AT iTAB WHERE CHECKbox = 'X' .
        ENDLOOP.
        MODIFY  ztEST FROM TABLE itAB.
      ENDIF.
      selfield-refresh = 'X'.
    ENDFORM.
    NOW I HAVE A LIST O/P WHERE I CAN SELECT THE BOX AND CLICK DELETE ICON.
    NOW I WANT TO CHANGE TO GRID, SO I KEPT EVERYTHING SAMRE AND I CHANGED  " LIST" TO "GRID"
    NOW TWO THINGS HAPPEND
    1) I SEE A EMPTY COLUMN IN THE O/P , I GUESS THATS BECAUSE CHECKBOSX IN INTERNAL TABLE , SO I REMOVED IT
    SO THIS MADE ME TO REMOVE
    IF ucomm = 'DELE'.
        LOOP AT iTAB." WHERE CHECKbox = 'X' .------PROBLEM
        ENDLOOP.
        MODIFY  ztEST FROM TABLE itAB.
      ENDIF.
      selfield-refresh = 'X'.
    NOW I DON'T SEE THE EMPTY COLUMN , BUT NOW PROBLEM  IS I CANNNOT DISTINGUISH AS TO WHICH IS SELECTED AND AT ANY POINT OF TIME I CANSELECT ONLY ROW.
    ALL I WANT IS
    1) I WANT TO SELECT MULTIPLE ROWS AND SHOULD BE ABLE TO KNOW WHICH ROWS WERE SELECTED IN THE O/P SCREEN.
    IN THE LIST DISPLAY I HAD CHECKBOX = 'X' FOR ALL THE ROWS THAT WERE SELECTED , I WANT THE SIMILAR THING in grid display
    LET ME KNOW whether this can be done without USING 00 LANG.
    thanks

    Hi Swati,
    Below code might help full for you. Description: is It selects multiple rows from ALV and display it on the next ALV.
    *************************Reward Point If help full********************************************
    *& Report   z7cc_alv_oops_show_next_alv                                *
    *&          DEVELOPERS NAME : CHIDANAND CHAUHAN
    *&          DATE: SATURDAY 08-07-2006
    *&          DESCRIPTION: TO CREATE AN OBJECT ORIENTED ALV
    REPORT      z7cc_alv_oops_show_next_alv MESSAGE-ID  z5hs .
    DATA : BEGIN OF it_mara OCCURS 0,
      mark  TYPE flag,
      matnr TYPE matnr,
      mtart TYPE mtart,
      meins TYPE meins,
    END OF it_mara.
    DATA : BEGIN OF it_mara1 OCCURS 0,
    *  mark  type flag,
      matnr TYPE matnr,
      mtart TYPE mtart,
      meins TYPE meins,
    END OF it_mara1.
    DATA : BEGIN OF it_mara2 OCCURS 0,
    *  mark  type flag,
      matnr TYPE matnr,
      mtart TYPE mtart,
      meins TYPE meins,
    END OF it_mara2.
    DATA : t_fieldcat TYPE lvc_t_fcat,
             t_fieldcat1 TYPE lvc_t_fcat,
          s_fieldcat LIKE LINE OF t_fieldcat.
    DATA : s_layout TYPE lvc_s_layo.
    DATA : control TYPE REF TO cl_gui_custom_container,
           grid  TYPE REF TO cl_gui_alv_grid.
    DATA: BEGIN OF wa ,
      mark  TYPE flag,
      matnr TYPE matnr,
      mtart TYPE mtart,
      meins TYPE meins,
    END OF wa.
    *       CLASS lcl_events_box DEFINITION
    CLASS lcl_events_box DEFINITION.
      PUBLIC SECTION.
        METHODS :
    *Handler_Data_Changed for event Data_Changed of cl_gui_alv_grid
    *imporTing er_data_changed,
        handler_user_command FOR EVENT user_command OF cl_gui_alv_grid
        IMPORTING e_ucomm,
        handler_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
        IMPORTING e_object e_interactive.
    ENDCLASS.                    "lcl_events_box DEFINITION
    *       CLASS lcl_events_box IMPLEMENTATION
    CLASS lcl_events_box IMPLEMENTATION.
    * method to handle the user command.
      METHOD handler_user_command.
        PERFORM form_usercommand CHANGING e_ucomm.
      ENDMETHOD.                    "Handler_user_command
    *& Mehod to handle the toolbar.
      METHOD handler_toolbar.
        PERFORM form_toolbar CHANGING e_object e_interactive
        e_object->mt_toolbar.
      ENDMETHOD.                    "Handler_ToolBar
    ENDCLASS.                    "lcl_events_box IMPLEMENTATION
    START-OF-SELECTION.
      DATA : w_events TYPE REF TO lcl_events_box.
      SELECT matnr mtart meins FROM mara INTO CORRESPONDING FIELDS OF TABLE
      it_mara.
      CALL SCREEN 100.
    *&      Module  pbo_module  OUTPUT
    *       text
    MODULE pbo_module OUTPUT.
      IF grid IS INITIAL.
        CREATE OBJECT control
          EXPORTING
            container_name     = 'CUST_CTRL'.
        CREATE OBJECT grid
          EXPORTING
            i_parent          = control.
        PERFORM build_catalog.
        PERFORM build_catalog1.
        PERFORM build_layout.
        CALL METHOD grid->set_table_for_first_display
          EXPORTING
            is_layout       = s_layout
          CHANGING
            it_outtab       = it_mara[]
            it_fieldcatalog = t_fieldcat.
        CREATE OBJECT w_events.
        SET HANDLER : w_events->handler_toolbar FOR grid,
                      w_events->handler_user_command FOR grid.
        CALL METHOD grid->set_toolbar_interactive.
      ELSE.
        CALL METHOD grid->refresh_table_display.
      ENDIF.
    ENDMODULE.                 " pbo_module  OUTPUT
    *&      Form  BUILD_CATALOG
    FORM build_catalog .
      s_fieldcat-col_pos = '1'.
      s_fieldcat-fieldname = 'MARK'.
      s_fieldcat-checkbox = 'X'.
      s_fieldcat-edit = 'X'.
      APPEND s_fieldcat TO t_fieldcat.
      CLEAR s_fieldcat.
      s_fieldcat-col_pos = '2'.
      s_fieldcat-fieldname = 'MATNR'.
      s_fieldcat-scrtext_m = 'MATERIAL'.
      APPEND s_fieldcat TO t_fieldcat.
      s_fieldcat-col_pos = '3'.
      s_fieldcat-fieldname = 'MTART'.
      s_fieldcat-scrtext_m = 'MATERL TYPE'.
      APPEND s_fieldcat TO t_fieldcat.
      s_fieldcat-col_pos = '4'.
      s_fieldcat-fieldname = 'MEINS'.
      s_fieldcat-scrtext_m = 'UOM'.
      APPEND s_fieldcat TO t_fieldcat.
    ENDFORM.                    " BUILD_CATALOG
    *&      Form  BUILD_LAYOUT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_layout .
      s_layout-zebra = 'X'.
    * S_LAYOUT-CWIDTH_OPT = 'X'.
      s_layout-grid_title = 'Material Details'.
    ENDFORM.                    "BUILD_LAYOUT
    " BUILD_LAYOUT////////////////////////////////////
    " USER_COMMAND_0100  INPUT
    *&      Form  FORM_USERCOMMAND
    *       text
    *      <--P_E_UCOMM  text
    FORM form_usercommand  CHANGING p_e_ucomm.
      CASE p_e_ucomm.
        WHEN 'INT1'.
          DO.
            READ TABLE it_mara INDEX sy-index TRANSPORTING mark matnr.
            IF sy-subrc <> 0.
              EXIT.
            ENDIF.
            IF it_mara-mark = 'X'.
              READ TABLE it_mara INTO wa TRANSPORTING matnr mtart meins .
              MOVE-CORRESPONDING wa TO it_mara1.
              READ TABLE it_mara1 TRANSPORTING matnr mtart meins .
              MOVE-CORRESPONDING it_mara1  TO it_mara2.
              APPEND it_mara2.
              CALL METHOD grid->set_table_for_first_display
                EXPORTING
                  is_layout       = s_layout
                CHANGING
                  it_outtab       = it_mara2[]
                  it_fieldcatalog = t_fieldcat1.
    *       SET PARAMETER ID 'MAT' FIELD IT_MARA-MATNR.
    *       CALL TRANSACTION 'MM02'.
            ENDIF.
    *      ENDIF.
          ENDDO.
      ENDCASE.
    ENDFORM.                    " FORM_USERCOMMAND
    *&      Form  FORM_TOOLBAR
    *       text
    *      <--P_E_OBJECT  text
    *      <--P_E_INTERACTIVE  text
    *      <--P_E_OBJECT_>MT_TOOLBAR  text
    FORM form_toolbar  CHANGING p_e_object TYPE REF TO
    cl_alv_event_toolbar_set
    p_e_interactive
    mt_toolbar TYPE ttb_button.
      DATA wal_button TYPE stb_button.
    *WAL_BUTTON-ICON = ICON_status_reverse.
      wal_button-text = 'GO'.
      wal_button-quickinfo = 'PROCEED'.
      wal_button-function = 'INT1'.
      wal_button-butn_type = 0.
      wal_button-disabled = space.
      INSERT wal_button  INTO p_e_object->mt_toolbar INDEX 1.
    ENDFORM.                    " FORM_TOOLBAR
    *&      Module  PF-STATUS  OUTPUT
    *       text
    MODULE pf-status OUTPUT.
      SET PF-STATUS 'Z7CCSTAT'.
    ENDMODULE.                 " PF-STATUS  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
          LEAVE PROGRAM.
        WHEN 'CANCEL'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  BUILD_CATALOG1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_catalog1 .
      s_fieldcat-col_pos = '1'.
      s_fieldcat-fieldname = 'MATNR'.
      s_fieldcat-scrtext_m = 'MATERIAL'.
      APPEND s_fieldcat TO t_fieldcat1.
      s_fieldcat-col_pos = '2'.
      s_fieldcat-fieldname = 'MTART'.
      s_fieldcat-scrtext_m = 'MATERL TYPE'.
      APPEND s_fieldcat TO t_fieldcat1.
      s_fieldcat-col_pos = '3'.
      s_fieldcat-fieldname = 'MEINS'.
      s_fieldcat-scrtext_m = 'UOM'.
      APPEND s_fieldcat TO t_fieldcat1.
    ENDFORM.                    " BUILD_CATALOG1

  • 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

  • Multiple checkbox selection in ALV and updating internal table

    Dear Expert,
    Can anyone tell me how to handle the multiple checkbox selection in ALV Grid report and then updating the internal table.
    I tried the option but it works only when i select only 1 row in ALV.
                    DO L_LINES TIMES.
                      read table icoas index rs_selfield-tabindex.
                      if sy-subrc = 0.
                        ICOAS-NOCHK = 'X'.
                        modify ICOAS INDEX rs_selfield-tabindex TRANSPORTING NOCHK.
                      ENDIF.
                    ENDDO.
    Requires help....
    Regards & Thanx,
    Bhupathi.

    Hi,
    Use this method to capture the check box event. Write this once you create your grid using CREATE OBJECT grid1.
    DATA:      GRID1 TYPE REF TO CL_GUI_ALV_GRID,
    CALL METHOD grid1->register_edit_event
      EXPORTING
        i_event_id = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED
      EXCEPTIONS
        ERROR      = 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.
      LOOP AT T_GRIDDETAILS INTO WA_GRIDDETAILS.
        IF WA_GRIDDETAILS-CHECKBOX = 'X'.
                  "Do your operation
        ENDIF.
        CLEAR WA_GRIDDETAILS.
      ENDLOOP.

  • Header row in ALV Grid, based on the data in the table

    Hi All,
    I have a requirement wherein, based on the data in the table used for ALV, i need to add rows as sort of header in the ALV display.
    For e.g. my table has
    Appl No.  Item  Material  Desc.           Cost                 -> Column Heading
    1             10     400        Excavation    10.00               -> Data
    1             20     400        Footing         10.00
    2             10     400        Excavation    10.00
    2             20     400        Footing         10.00
    For every new Appl No., i need to add a row, or sort of header specifying the appl no. details. means
    Appl No.  Item  Material  Desc.           Cost
    Appli. No. 1                   Date: 01/01/1009                   -> my requirement
    1             10     400        Excavation    10.00
    1             20     400        Footing         10.00
    Appli. No. 2                   Date: 02/01/1009
    2             10     400        Excavation    10.00
    2             20     400        Footing         10.00
    Is this possible in ALV my any means? Currently i m using normal ALV Grid
    Regards,
    Janaki

    Hi..
         Try like this... I think u have Application number and date in ur table ... First get the total table data into internal table.. and to add the row
         *Declare the var1 as 0 and var2.
    loop at internal table
         *var1 = var1 +1
    when application number =var1
             concatenate : 'Appli. No.' (table- appli no field) 'Date:'  (table-date field) into var2.
    perform display(some name)
         *endloop.
         *form display...
              alv display part.. first give that var2 like eg.. wa_alv-field= 'var2'.
    end form.
        Hope this will help u .....
    Regards,
    Abaper

  • The mechanism of Delete Row and Unto in program BCALV_GRID_EDIT

    Hi Experts,
        Users need to Delete/Insert/Change a row in OO ALV report and the row can be Undo when the undo button is press. I find the example program in my system and finally get a program BCALV_GRID_EDIT. Most functions in this program  meet my requirement. But I want to know what is the mechanism of the Delete/Insert and Undo function. For example, if I have delete a row in the screen, and then I press the undo button, the deleted row will be restored in the screen. But I want to know where(Internal table or soemwhere) the deleted row is stored after I press the Delete Row button, and where I can retrieve the deleted row after I press the Undo button. Please help~~
    Thanks in advance.
    Best regards
    Joe

    Hi
    1. first remove the ENDSELECT..use INTO table itab or INTO CORRESPONDING fields, Since you are joining the  more tables this will take lot of time.
    2. You are just using two fields from LIKP as selection screen  fields to fetch the so much data.
    see the table linkings apartfrom KUNNR between the tables
    LIKP-VBELN = LIPS-VBELN
    LIPS-VGBEL = VBAK-VBELN and  LIPS-VGPOS = VBAP-POSNR
    and
    VBRP-AUBEL = VBAK-VBELN and VBRP-AUPOS = VBAP-POSNR and
    VBRP-VGBEL = LIKP-VBELN  and VBRP-VGPOS = LIPS-POSNR
    use the above links and code again.
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • 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