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

How to get editable data into internal table

Former Member
0 Likes
782

Hi ABAPers,

I am displaying REUSE_ALV_GRID_DISPLAY report with one editable field and i have post button in report. Once i select post button i need to get editable data to internal table which i passed to REUSE_ALV_GRID_DISPLAY.

actually i am writing below code but data is not coming to internal table.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

i_callback_pf_status_set = 'PF-STATUS'

i_callback_user_command = 'USER_COMMAND '

it_fieldcat = t_field[]

i_default = 'X'

TABLES

t_outtab = <fs_display1>. "t_display

FORM user_command USING g_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

g_test1 = g_ucomm.

CASE g_ucomm.

WHEN 'POST'.

READ TABLE <fs_display1> ASSIGNING <fsw_display1> INDEX 1. "Just for testing index 1

IF sy-subrc = 0.

w_display = <fsw_display1>.

APPEND w_display TO t_display.

CLEAR : w_display.

ENDIF.

PERFORM v1.

PERFORM bapi_call.

ENDCASE.

ENDFORM. "USER_COMMAND

Please help me how to get.

Regards,

Raju.

4 REPLIES 4
Read only

Former Member
0 Likes
754

Assign the Function Code %REFRESH to the Post Button .When you click on the Button the data will be automatically saved to internal table.

You need not to handle it in the program.

Regards,

Gurpreet

Read only

Former Member
0 Likes
754

Hi,

wa_event-name = 'USER_COMMAND'.

wa_event-form = 'SAVE'.

APPEND wa_event TO it_event.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

it_fieldcat = it_fcat

it_excluding = it_exclude

it_events = it_event

it_sort = it_sort

i_save = 'X'

TABLES

t_outtab = it_ekko

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 save USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

IF r_ucomm = '&DATA_SAVE'.

break sapuser.

ENDIF.

ENDFORM. "save

Read only

Former Member
0 Likes
754

Hi,

Try the following:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'PF-STATUS'
i_callback_user_command = 'USER_COMMAND '
it_fieldcat = t_field[]
i_default = 'X'
TABLES
t_outtab = <fs_display1>. "t_display

FORM user_command USING g_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.

g_test1 = g_ucomm.

CASE g_ucomm.
WHEN 'POST'.

* 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.

READ TABLE <fs_display1> ASSIGNING <fsw_display1> INDEX 1. "Just for testing index 1
IF sy-subrc = 0.
w_display = <fsw_display1>.
APPEND w_display TO t_display.
CLEAR : w_display.
ENDIF.

PERFORM v1.
PERFORM bapi_call.
ENDCASE.
ENDFORM. "USER_COMMAND

Hope it helps.

Regards,

Gilberto Li

Read only

Former Member
0 Likes
754

Hi tyr this one

in sy-ucomm for posting you write following code

data : ref_grid type ref to gl_gui_alv_grid.

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 metohd ref_grid -> check_changed_data.

endif.

rs_selfield-refresh = 'X'.

Edited by: Paresh Gangani on Apr 2, 2009 7:59 AM