D&D Behavior for Special Rows/Cells 

Purpose

You can use this process to define a Drag & Drop behavior for special rows or cells of the grid control. Each row or cell can have its own Drag & Drop behavior.

Process Flow

  1. Define the layout structure of type LVC_S_LAYO .
  2. Add a Drag & Drop table of type LVC_T_DRDR to your output table, as shown in the example below:
  3. DATA: BEGIN OF GT_OUTTAB OCCURS 0.
            INCLUDE STRUCTURE <DDIC-Struktur>.

    DATA:   CT TYPE LVC_T_DRDR. "Table for d&d cell behaviour

    DATA: END OF GT_OUTTAB.

  4. Define your Drag & Drop behavior and get its handle with method get_handle of class cl_dragdrop .
  5. Select your data and copy it in the output table.
  6. Read one row of the output table at a time in a loop. A row of the Drag & Drop table has two fields. Assign values to these fields as follows (see also the graphic in the next section):
  1. Assign the name of the internal table to field s_dragdrop-fieldname of the layout structure (in our case 'CT', see step 2).
  2. Pass the layout structure and the output table with method set_table_for_first_display.

You can also subsequently pass the layout structure with the Drag & Drop behavior using method set_frontend_layout. The ALV Grid Control refreshes this table when method refresh_table_display is called. The instance of the ALV Grid Control and the associated output table must have the same lifetime.

Example

The following graphic shows an output table where cells b1 and c 1 have different Drag & Drop behaviors and the entire second row has the same Drag & Drop behavior as cell c 1: