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 in Module Pool

Former Member
0 Likes
2,091

Hi Gurus,

I am displaying ALV on a module Pool Dialog screen as follows.


Data : v_alv_grid TYPE REF TO cl_gui_alv_grid.

CALL METHOD V_ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
        IS_LAYOUT                     = X_LAY
        I_SAVE                        = 'X'
      CHANGING
        IT_OUTTAB                     = T_CHECK
        IT_FIELDCATALOG               = T_FCAT
      EXCEPTIONS
        INVALID_PARAMETER_COMBINATION = 1
        PROGRAM_ERROR                 = 2
        TOO_MANY_LINES                = 3
        others                        = 4.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

The table "T_Check" has a check box field. When the user checks any check box on the ALV screen, how to get that value back into the program?

I am unable to read that check box.

Could you tell me what else I have to code?

1 ACCEPTED SOLUTION
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,259

Hi,

If using OO ALV, then use this code when you click SAVE button:-


CASE sy-ucomm.
  WHEN 'SAVE'.
* 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.

   " at this point your internal table is modified from alv output.

    " and then use refresh_table_display
    CALL METHOD ref_grid->refresh_table_display.
    " to refresh the data from internal table back to alv output.
 
ENDCASE.

Hope this helps you.

Regards,

Tarun

Hi,

If using OO ALV, then use this code when you click SAVE button:-


CASE sy-ucomm.
  WHEN 'SAVE'.
* 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.

   " at this point your internal table is modified from alv output.

    " and then use refresh_table_display
    CALL METHOD ref_grid->refresh_table_display.
    " to refresh the data from internal table back to alv output.
 
ENDCASE.

Hope this helps you.

Regards,

Tarun

4 REPLIES 4
Read only

Former Member
0 Likes
1,259

Hi,

This is the frequently asked question. Search the fourm for the solution.

Read only

Former Member
0 Likes
1,259

Dear

AT USER_command event .

u can modify your final internal table .this will retain your check box

rgds ankit

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,260

Hi,

If using OO ALV, then use this code when you click SAVE button:-


CASE sy-ucomm.
  WHEN 'SAVE'.
* 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.

   " at this point your internal table is modified from alv output.

    " and then use refresh_table_display
    CALL METHOD ref_grid->refresh_table_display.
    " to refresh the data from internal table back to alv output.
 
ENDCASE.

Hope this helps you.

Regards,

Tarun

Read only

Former Member
0 Likes
1,259

Hi,

Please do like this.


FORM user_command USING r_ucomm LIKE sy-ucomm
                        r_selfield TYPE slis_selfield.


  DATA: gd_repid LIKE sy-repid, "Exists
        ref_grid TYPE REF TO cl_gui_alv_grid.

 
  CASE r_ucomm.
    WHEN 'PROCESS'.

      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.

      LOOP AT it_error INTO w_error WHERE check = 'X'.
       
      ENDLOOP.
      r_selfield-refresh = 'X'. 
encase.

thanks ,

kat.