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: 

REUSE_ALV_GRID_DISPLAY add new row to alv-grid

former_member392866
Active Participant
0 Kudos

Hello,

I wrote an application which calls REUSE_ALV_GRID_DISPLAY to display the content of

an internal table. I created a field catalogue which makes the fields of the last column editable.

Now I have to create a new Button. If a user clicks on it, a new row shall be added to the

alv_grid. Only for the new row, each field shall be editable.

I haven't found a possibility to solve this problem yet.

Can you help me?

Regards,

Balaji P

1 ACCEPTED SOLUTION

former_member392866
Active Participant
0 Kudos

Got solution.. below code FYI .. Thank you team.

FORM user_command USING r_ucomm LIKE sy-ucomm

  rs_selfield TYPE slis_selfield.
  DATA: gd_repid LIKE sy-repid,
  ref_grid TYPE REF TO cl_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 METHOD ref_grid->check_changed_data .
  ENDIF.
  CASE r_ucomm.
  WHEN 'SAVE'.
  "Here you will get the data(along with modified rows/data)
  "Filter the modified rows and update to DB using BAPI/BDC
  "Accordingly
  ENDCASE.
  rs_selfield-refresh = 'X'.
ENDFORM. "USER_COMMAND
4 REPLIES 4

raymond_giuseppi
Active Contributor
0 Kudos

Did you perform some search on usage of an itab of type TYPE LVC_T_STYL in the output table to manage attributes like input allowed at cell level with each record containing a style like CL_GUI_ALV_GRID=>MC_STYLE_DISABLED / ENABLED depending on some values, you give the itab name in the layout parametrer (field stylefname).

BUT you MUST at least convert your code to use a less outdated FM like REUSE_ALV_GRID_DISPLAY_LVC or much better convert to class CL_GUI_ALV_GRID. (or, playful, play with the occurence of CL_GUI_ALV_GRID hidden behind the old FM)

0 Kudos

Hi Raymond,

i have converted my code to REUSE_ALV_GRID_DISPLAY_LVC and i can able to add one row .

But i can't catch that modified data after clicking Validate button in Application toolbar .

I need functionality like the standard function code of &DATA_SAVE .

Please help me how to capture modified data .

Regards,

Balaji

former_member392866
Active Participant
0 Kudos

Hi Team,

Any inputs ?

Regards,

Balaji

former_member392866
Active Participant
0 Kudos

Got solution.. below code FYI .. Thank you team.

FORM user_command USING r_ucomm LIKE sy-ucomm

  rs_selfield TYPE slis_selfield.
  DATA: gd_repid LIKE sy-repid,
  ref_grid TYPE REF TO cl_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 METHOD ref_grid->check_changed_data .
  ENDIF.
  CASE r_ucomm.
  WHEN 'SAVE'.
  "Here you will get the data(along with modified rows/data)
  "Filter the modified rows and update to DB using BAPI/BDC
  "Accordingly
  ENDCASE.
  rs_selfield-refresh = 'X'.
ENDFORM. "USER_COMMAND