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

Alv report edit and save functionality

vishnu_vardhan20
Explorer
0 Likes
1,983

Hi friends...

i have an issue..when i am editing the report after execution...the requirement was it must save the changed the value...but the save functionality was not working

in my report..plase help me...

thanks in advance

9 REPLIES 9
Read only

Former Member
0 Likes
1,324

hi

what is the value in sy-ucomm when you press save button?

is it same as that fo r_ucomm?

regards

vaibhav

Read only

vishnu_vardhan20
Explorer
0 Likes
1,324

HI VAIBHAV..

SY-UCOMM VALUE IS &SAVE_DATA..BUT WHEN I CHANGED THE SY-UCOMM NOT WORKING

Read only

0 Likes
1,324

hi

do one thing change r_ucomm with sy-ucomm and thenn check .

regards

vaibhav

Read only

vishnu_vardhan20
Explorer
0 Likes
1,324

just now i changed the code  ztable as internal table(ty_output)...but it is not working

Read only

0 Likes
1,324
Read only

0 Likes
1,324

Vishnu,

Please use CALL METHOD ref_grid>refresh_table_display to refresh the changed data on to the screen. Also, try this code after check_changed_data.

  save_ok = ok_code.

  CLEAR ok_code.

  CASE sy-ucomm.

    WHEN 'SAVE'.

         

Please let me know if this helps.

Thanks,

Sreekanth

Read only

Former Member
0 Likes
1,324

Hi Vishnu,

     one thing i want to know wether you are trying to save the edited data in the database or else you want to save it locally into internal table.

I observed that in your code you commented the important code that is needed for saving functionality

*  CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

*

*   IMPORTING

**     ET_EXCLUDING                     =

**     E_REPID                          =

**     E_CALLBACK_PROGRAM               =

**     E_CALLBACK_ROUTINE               =

*     e_grid                           = g_grid.

*  CALL METHOD g_grid->check_changed_data

*    IMPORTING

*      e_valid = is_valid.

the above logic is key for your code. for saving functionality process these logic in PAI module.

Hope this may helps you....

Read only

0 Likes
1,324

Hi ,

     Please refer to below link

<link to blocked site removed by moderator>

Thanks,

Raghunadh.K

Message was edited by: Thomas Zloch

Read only

basarozgur_kahraman
Contributor
0 Likes
1,324

Hi Vishnu,

Change your call ALV as below and add status and user_command routines. Don't forget to set SAVE button on STATUS.

PERFORM build_events TABLES _it_event.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

     EXPORTING

          i_callback_program       = sy-repid

                i_callback_pf_status_set = 'STATUS'

          i_callback_user_command  = 'USER_COMMAND'

          it_fieldcat              = it_fieldcat

            it_events                = it_event[]

     TABLES

          t_outtab                 = itab

     EXCEPTIONS

          program_error            = 1

          OTHERS                   = 2.

FORM build_events  TABLES   p_it_event TYPE slis_t_event.

  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

    EXPORTING

      i_list_type     = 0

    IMPORTING

      et_events       = p_it_event[]

    EXCEPTIONS

      list_type_wrong = 1

      OTHERS          = 2.

  CLEAR p_it_event.

  p_it_event-name = slis_ev_data_changed.

  p_it_event-form = 'DATA_CHANGED'.

  APPEND p_it_event.

ENDFORM.                    " BUILD_EVENTS


FORM status USING p_extab TYPE slis_t_extab.

  "Set the Button using the staus

  "Copy the Standard status from the program SAPLKKBL status

  " STANDARD using SE41, and use that here.

  "Pf status

  SET PF-STATUS 'STANDARD' EXCLUDING p_extab.

ENDFORM. " STATUS

FORM alv_user_command USING p_ucomm    LIKE sy-ucomm

                                            p_selfield TYPE slis_selfield.


  DATA: _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.

CALL METHOD _ref_grid->check_changed_data.


  CASE p_ucomm.

*   Double-Click

    WHEN '&IC1'.

    WHEN '&DATA_SAVE'.

    WHEN 'SAVE'.        

      PERFORM  save_changes.

  ENDCASE.


*  CALL METHOD _ref_grid->refresh_table_display.

*  CALL METHOD _ref_grid1->refresh_table_display

*    EXPORTING

*      is_stable = lvc_s_stbl.

  p_selfield-refresh = 'X'.

ENDFORM.                    "alv_user_command