Skip to Content
author's profile photo Former Member
Former Member

ALV grid oo delete rows and update to table

Hi all

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

thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Feb 24, 2009 at 11:24 AM

    There are a few sample reports starting with BCALVEDIT. Here you can get a good idea on how to do this. Within the same event where row is deleted from ALV, also do the deletion from db table. But remember, if there are any dependecies from your db table (referential integrity), use the standard FM / BAPI's for this. If it is a custom table, without any reference keys, you can just use the DELETE statement.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 25, 2009 at 08:47 PM

    Hello Tom

    I would recommend to keep two "images" of your list data, e.g.:

    GT_OUTTAB_PBO (data before any changes)
    GT_OUTTAB (PAI data = after changes)

    Before you display your editable ALV list both itabs contains the same records. GT_OUTTAB is displayed and can be modified.

    When the user pushes the SAVE button you need to make a final call to go_grid->check_changed_data( ) to fetch the latest data from the ALV control and then you need to compare GT_OUTTAB vs. GT_OUTTAB_PBO.

    A possible approach has been described in my Wiki posting:

    [Comparing Two Internal Tables - A Generic Approach|https://wiki.sdn.sap.com/wiki/display/Snippets/ComparingTwoInternalTables-AGeneric+Approach]

    Regards

    Uwe

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 26, 2009 at 04:11 AM

    Hi,

    This wiki written by me can help you to update.

    https://www.sdn.sap.com/irj/scn/wiki?path=/pages/viewpage.action&pageid=68190995

    Thanks,

    Krishna...

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 26, 2009 at 04:38 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.