Skip to Content
-1

REUSE_ALV_GRID_DISPLAY add new row to alv-grid

Mar 09, 2017 at 01:00 PM

350

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
avatar image
Former Member Apr 10, 2017 at 10:13 AM
0

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
Share
10 |10000 characters needed characters left characters exceeded
Raymond Giuseppi
Mar 09, 2017 at 02:58 PM
0

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)

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

0
avatar image
Former Member Apr 10, 2017 at 09:52 AM
0

Hi Team,

Any inputs ?

Regards,

Balaji

Share
10 |10000 characters needed characters left characters exceeded