Application Development 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: 

Editing and Updating Fields of an ALV_GRID

Former Member
0 Kudos

Good Afternoon,

I've created a program that shows me the content of a table according to an authority check. The content is showed using the following function:


    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            i_callback_program       = gd_repid
            i_callback_pf_status_set = 'SET_PF_STATUS'
*              i_callback_top_of_page   = 'ESCREVE_TOP'
            i_callback_user_command  = 'USER_COMMAND'
*              i_grid_title           = outtext
            is_layout                = gd_layout
            it_fieldcat              = it_fieldcat[]
*              it_special_groups      = gd_tabgroup
*              IT_EVENTS              = GT_XEVENTS
*          i_save                   = 'X'
*              is_variant             = z_template

       TABLES
            t_outtab                = t_t001b
       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.

I have selected some fields to be editable, until now everything is fine.

What i'm not being able to do is... After editing one (or several) fields of the grid i want also to update the table. Updating the table is peanuts, the problem is that when i process USER_COMMAND i can't see the values i've updated in the screen anywhere, they-re still the old values.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

In the user command subroutine modify the parameter for the structure slis_selfield with the field

REFRESH = 'X'.

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE r_ucomm.

WHEN '&DEALL'.

  • Message for reselection of lines

IF itab_display-kalab LE 0.

MESSAGE i101.

EXIT.

To refresh...

rs_selfield-refresh = 'X'.

Regards,

Prakash.

4 REPLIES 4

messier31
Active Contributor
0 Kudos

Just check the link below to use USER_COMMAND

chek if you not miss any thing

http://www.sapfans.com/forums/viewtopic.php?t=11601

Former Member
0 Kudos

In the user command subroutine modify the parameter for the structure slis_selfield with the field

REFRESH = 'X'.

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE r_ucomm.

WHEN '&DEALL'.

  • Message for reselection of lines

IF itab_display-kalab LE 0.

MESSAGE i101.

EXIT.

To refresh...

rs_selfield-refresh = 'X'.

Regards,

Prakash.

Former Member
0 Kudos

I have never used REUSE_ALV_GRID_DISPLAY function module for such scenario but i have used OO ALV to get data realtime.

"

CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

IS_LAYOUT = GS_LAYOUT

IS_VARIANT = GS_VARIANT

I_SAVE = X_SAVE

IT_TOOLBAR_EXCLUDING = TEMP_UI

CHANGING

IT_FIELDCATALOG = ITAB_FIELDCAT[]

IT_OUTTAB = I_ORDER[]

IT_SORT = I_SORT[]."

I display ALV using above statement and whenever user clicks some button on the container, i use

"* refresh screen display with new data.

CALL METHOD GRID1->REFRESH_TABLE_DISPLAY.

"

method to get new data populated into internal table after this statement.

0 Kudos

Sorry

"CALL METHOD EVENT_RECEIVER->HANDLE_DATA_CHANGED" method to get new data into internal table.

In my scenario i had checkboxes on the ALV and editable fields too on each row. After calling above method, internal table automatically had "X" populated for checkboxes and data populated in editable fields.