Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ALV - Editable

Former Member
0 Likes
628

Hi,

I have created an ALV, where one column of Amt is editable.

Now consider i have 4 rows and I am editing 2 rows, i want to know how many rows are edited with some flag or something.

Can anybody help me regarding this.

Regards.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
593

Hi.,

FIELDCATALOG-EDIT = 'X'.

4 REPLIES 4
Read only

Former Member
0 Likes
593

Hi,

in this cas u need to create one more internal table with the same data selected and need to compare the data from the table from ALV. Ex :



IT_MAT1[] = IT_MAT.

"in the USER_COMMAND routine use this

 DATA: GD_REPID LIKE SY-REPID,
  REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
 
  DATA: L_VALID TYPE C.
 
*Code to reflect the changes done in the internal table
 
  IF REF_GRID IS INITIAL.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
      IMPORTING
        E_GRID = REF_GRID.
  ENDIF.
 
  IF NOT REF_GRID IS INITIAL.
 
    CALL METHOD REF_GRID->CHECK_CHANGED_DATA
      IMPORTING
        E_VALID = L_VALID.
 
  ENDIF.
 
LOOP AT IT_MAT."IT_MAT is the internal table from ALV

READ TABLE IT_MAT1 WITH KEY MATNR IT_MAT-MATNR.

IF SY-SUBRC = 0.

IF IT_MAT-MTAKL <> IT_MAT1-MTAKL.

"KEEP FLAG HERE ARE ANY MESSAGE

ENDIF.
. " Check for all fields and set the flag
.
.
ENDLOOP.

Read only

Former Member
0 Likes
593

Hi,

If you want to make the whole ALV editable, call method set_ready_for_input of ALV class with parameter set to '1'

If you want to make some rows of the ALV editable->

In the example program BCALV_EDIT_2 there is a subroutine named fill_celltab. In this subroutine, the internal table attached to each row of the output table is filled which shows which fields of this row is editable. If you enter a row to this internal table without a fieldname, then the edit status of the entire row is affected.

Hope it helps.

Regards

Rajesh Kumar

Read only

Former Member
0 Likes
593

Hi,

This may help u...


DATA:   event_receiver TYPE REF TO lcl_event_receiver.

*----------------------------------------------------------------------*
*       CLASS lcl_event_receiver DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_receiver DEFINITION.

  PUBLIC SECTION.
    METHODS:
    handle_data_changed
         FOR EVENT data_changed OF cl_gui_alv_grid
             IMPORTING er_data_changed sender.              "#EC NEEDED

ENDCLASS.                    "lcl_event_receiver DEFINITION

*----------------------------------------------------------------------*
*       CLASS lcl_event_receiver IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
METHOD handle_data_changed.
    DATA: ls_good TYPE lvc_s_modi.
    LOOP AT er_data_changed->mt_good_cells INTO ls_good.
      CASE ls_good-fieldname.
...........
      ENDCASE.
    ENDLOOP.
ENDMETHOD.                    "handle_data_change

    CALL METHOD gr_alvgrid->set_table_for_first_display
      EXPORTING
        i_save                        = 'A'
        i_default                     = 'X'
        is_variant                    = gs_variant
        is_layout                     = gs_layout
        it_toolbar_excluding          = lt_exclude
      CHANGING
        it_outtab                     = it_rfqi[]
        it_fieldcatalog               = gt_fieldcat[]
      EXCEPTIONS
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        OTHERS                        = 4.

    CALL METHOD gr_alvgrid->register_edit_event
      EXPORTING
        i_event_id = cl_gui_alv_grid=>mc_evt_enter.

    CALL METHOD gr_alvgrid->register_edit_event
      EXPORTING
        i_event_id = cl_gui_alv_grid=>mc_evt_modified.

SET HANDLER event_receiver->handle_data_changed FOR gr_alvgrid.

Read only

Former Member
0 Likes
594

Hi.,

FIELDCATALOG-EDIT = 'X'.