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

Regarding changing data in Editable ALV Grid

Former Member
0 Likes
2,249

hi all,

I am displaying report some columns are editable. For getting data in editable columns i am using the method

IF NOT grid IS INITIAL.

CALL METHOD grid->check_changed_data .

ENDIF.

First time whatever i am editing i am getting in final O / P.

Second time when i entered the data and i am using the same method but this time i am not getting whatever i am chaging.

i am thinking that CALL METHOD grid->check_changed_data Grid is refreshing or some changes are happening.

How can i set grid to initial position.

Please suggest.

Regards

Rami Reddy

hi all,

I am displaying report some columns are editable. For getting data in editable columns i am using the method

IF NOT grid IS INITIAL.

CALL METHOD grid->check_changed_data .

ENDIF.

First time whatever i am editing i am getting in final O / P.

Second time when i entered the data and i am using the same method but this time i am not getting whatever i am chaging.

i am thinking that CALL METHOD grid->check_changed_data Grid is refreshing or some changes are happening.

How can i set grid to initial position.

Please suggest.

Regards

Rami Reddy

6 REPLIES 6
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,272

Hi,

Take a button with function code 'MODIFY' on which data needs to be modified in the alv output as well as internal table.

Use this code, its working:-


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
*     I_INTERFACE_CHECK                 = ' '
*     I_BYPASSING_BUFFER                = ' '
*     I_BUFFER_ACTIVE                   = ' '
     i_callback_program                = v_rep_id       " report id
     i_callback_pf_status_set          = 'PF'           " for PF-STATUS
     i_callback_user_command           = 'USER_COMMAND' " for User-Command
*     I_CALLBACK_TOP_OF_PAGE            = ' '
*     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*     I_CALLBACK_HTML_END_OF_LIST       = ' '
*     I_STRUCTURE_NAME                  =
*     I_BACKGROUND_ID                   = ' '
*     I_GRID_TITLE                      =
*     I_GRID_SETTINGS                   =
     is_layout                         = wa_layout      " for layout
     it_fieldcat                       = it_field       " field catalog
*     IT_EXCLUDING                      =
*     IT_SPECIAL_GROUPS                 =
     it_sort                           = it_sort        " sort info
*     IT_FILTER                         =
*     IS_SEL_HIDE                       =
*     I_DEFAULT                         = 'X'
*     i_save                            = 'A'
*     is_variant                        = wa_variant     " variant name
*     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
*     I_HTML_HEIGHT_TOP                 = 0
*     I_HTML_HEIGHT_END                 = 0
*     IT_ALV_GRAPHICS                   =
*     IT_HYPERLINK                      =
*     IT_ADD_FIELDCAT                   =
*     IT_EXCEPT_QINFO                   =
*     IR_SALV_FULLSCREEN_ADAPTER        =
*   IMPORTING
*     E_EXIT_CAUSED_BY_CALLER           =
*     ES_EXIT_CAUSED_BY_USER            =
    TABLES
      t_outtab                          = it_final      " internal table
   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
*&---------------------------------------------------------------------*
*       SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
*       AND EXECUTE THE APPROPIATE CODE
*----------------------------------------------------------------------*
*      -->LV_OKCODE   used to capture the function code
*                     of the user-defined push-buttons
*      -->L_SELFIELD   text
*----------------------------------------------------------------------*
FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
 
* assign the function code to variable v_okcode
  lv_okcode = sy-ucomm.
 
* handle the code execution based on the function code encountered
  CASE lv_okcode.
 
* when the function code is MODIFY (STORE button) then save data
    WHEN 'MODIFY'.
 
* to reflect the data changed into internal table
      DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
 
      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.
      ENDIF.
 
" at this point your data in internal table is changed
 
* refresh the ALV Grid output from internal table
      l_selfield-refresh = c_check.
 
ENDFORM.                    "USER_COMMAND

Hope this helps you.

Regards,

Tarun

Read only

0 Likes
1,272

Tarun, you are great. This solution getting me changed data into my internal table. Thanks.

Read only

Former Member
0 Likes
1,272

Hi Tarun,

I am using the class CL_GUI_ALV_GRID along with CL_GUI_CUSTOM_CONTAINER to display an ALV grid in a custom control container in a module-pool screen. The method CHECK_CHANGED_DATA captures the changed data (after clicking on the SAVE button) the first time. But it fails to capture from then on.

Please let me know what the problem is and how it can be solved.

Regards,

Sreekanth Reddy.

Read only

Former Member
0 Likes
1,272

Hi,

I am able to solve this issue using CALL METHOD G_CUSTOM_CONTAINER_I->free( ) in the user_command module of the second screen before calling the first screen.

module USER_COMMAND_1001 input.

ok_code = sy-ucomm.

CLEAR sy-ucomm.

IF ok_code = 'SAVE'.

PERFORM user_command_1001.

CALL METHOD G_CUSTOM_CONTAINER_I->free( ).

CALL SCREEN 1000.

ELSEIF ok_code EQ 'BACK' OR ok_code EQ 'EXIT' OR ok_code EQ 'CANC'.

LEAVE TO SCREEN 0.

ENDIF.

endmodule. " USER_COMMAND_1001 INPUT

Edited by: Sreekanth Reddy B on Jun 23, 2011 7:47 AM

Read only

Former Member
0 Likes
1,272

hello reddy,

can u explain me explicitly,so that i can answer you.

with regards,

sumanth reddy.

Read only

0 Likes
1,272

Hi,

Did you get this problem solved, actually I am facing the same problem and stuck badly. Please suggest how to solve this issue. Thanks a lot.

Ashish