Skip to Content
avatar image
-1
Former Member

REUSE_ALV_GRID_DISPLAY add new row to alv-grid

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

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

    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
    Add comment
    10|10000 characters needed characters exceeded

  • Mar 09, 2017 at 02:58 PM

    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)

    Add comment
    10|10000 characters needed 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

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

    Hi Team,

    Any inputs ?

    Regards,

    Balaji

    Add comment
    10|10000 characters needed characters exceeded