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 grid ispaly

Former Member
0 Likes
958

Hi all,

I have a internal table with one field displayed as checkbox.

and i declared a status for the report with my own buttons(three buttons)

but after the grid displayed,when i untick/tick any one of the checkboxes,

and then when i press any one of the buttons the internal table is not modified.

but when i use list display the table getting modified with tick/untick

what shall i do to solve this..

when i tick/untick any checkbox and press any button the table should be modified.

thanks

SAI

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
928

Call the method CHECK_CHANGED_DATA of the grid in the PAI and then your table will be updated.

If you are using function module to display the grid, use the following method to synchronize the grid and table.

Data ref1 type ref to cl_gui_alv_grid.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

E_GRID = ref1.

call method ref1->check_changed_data.

Regards,

Ravi

Note - Please mark all the helpful answers

Message was edited by:

Ravikumar Allampallam

Hi all,

I have a internal table with one field displayed as checkbox.

and i declared a status for the report with my own buttons(three buttons)

but after the grid displayed,when i untick/tick any one of the checkboxes,

and then when i press any one of the buttons the internal table is not modified.

but when i use list display the table getting modified with tick/untick

what shall i do to solve this..

when i tick/untick any checkbox and press any button the table should be modified.

thanks

SAI

7 REPLIES 7
Read only

Former Member
0 Likes
929

Call the method CHECK_CHANGED_DATA of the grid in the PAI and then your table will be updated.

If you are using function module to display the grid, use the following method to synchronize the grid and table.

Data ref1 type ref to cl_gui_alv_grid.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

E_GRID = ref1.

call method ref1->check_changed_data.

Regards,

Ravi

Note - Please mark all the helpful answers

Message was edited by:

Ravikumar Allampallam

Read only

0 Likes
928

i never worked with methods

how to call a method in the program

just like a FM?

Read only

0 Likes
928

See the following code

Data ref1 type ref to cl_gui_alv_grid.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

E_GRID = ref1.

call method ref1->check_changed_data.

regards,

Ravi

Note - Please close the thread if the issue is resolved

Read only

Former Member
0 Likes
928

Hi

sai ram

check this

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = W_REPID

I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

FORM USER_COMMAND USING P_UCOMM TYPE SY-UCOMM

P_SELFLD TYPE SLIS_SELFIELD.

case p_ucomm.

when 'SAVE'.

Data ref1 type ref to cl_gui_alv_grid.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

E_GRID = ref1.

call method ref1->check_changed_data.

modify ztable from table itab.

endcase.

ENDFORM.

-charitha

Read only

Former Member
0 Likes
928

Hi,

this can be done , using the method mentioned by Ravi.

Check the sample code.

REPORT  ztest                            .


TABLES : sflight.

TYPE-POOLS: slis.


DATA : w_repid LIKE sy-repid.

w_repid = sy-repid.

DATA : BEGIN OF it_sflight OCCURS 0,
       checkbox(1),
       carrid LIKE sflight-carrid,
       END OF it_sflight.


*layout

DATA: wa_layout           TYPE lvc_s_layo.
*field catalog
DATA: it_fieldcatalog TYPE lvc_t_fcat,

      wa_fieldcatalog TYPE lvc_s_fcat.



START-OF-SELECTION.

  SELECT carrid FROM sflight INTO CORRESPONDING FIELDS OF TABLE
it_sflight.



END-OF-SELECTION.


  CLEAR it_fieldcatalog.
  REFRESH it_fieldcatalog.



  wa_fieldcatalog-fieldname = 'CHECKBOX'.
  wa_fieldcatalog-tabname  = 'IT_SFLIGHT'.
  wa_fieldcatalog-outputlen = '3'.
  wa_fieldcatalog-col_pos = '1'.
  wa_fieldcatalog-seltext   = 'Chk'.
  wa_fieldcatalog-checkbox = 'X'.
  wa_fieldcatalog-edit = 'X'.
  APPEND  wa_fieldcatalog TO it_fieldcatalog.
  CLEAR  wa_fieldcatalog.



  wa_fieldcatalog-fieldname = 'CARRID'.
    wa_fieldcatalog-tabname  = 'IT_SFLIGHT'.
  wa_fieldcatalog-outputlen = '10'.
  wa_fieldcatalog-col_pos = '2'.
  wa_fieldcatalog-seltext   = 'Carrid'.
  APPEND  wa_fieldcatalog TO it_fieldcatalog.
  CLEAR  wa_fieldcatalog.





*  wa_layout-box_fname = 'CHECKBOX'.
  wa_layout-no_rowmark = 'X'.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
      i_callback_program      = w_repid
      is_layout_lvc           = wa_layout
      i_callback_user_command = 'USER_COMMAND'
      it_fieldcat_lvc         = it_fieldcatalog
    TABLES
      t_outtab                = it_sflight
    EXCEPTIONS
      program_error           = 1
      OTHERS                  = 2.



*&---------------------------------------------------------------------*
*&      Form  USER_COMMAND
*&---------------------------------------------------------------------*


FORM user_command USING p_ucomm TYPE sy-ucomm
                      p_selfld TYPE slis_selfield.

 DATA:  REF_GRID TYPE REF TO CL_GUI_ALV_GRID. "new

*then insert the following code in your USER_COMMAND routine...

  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 p_ucomm.
    WHEN '&DATA_SAVE'.
      LOOP AT it_sflight WHERE checkbox = 'X'.
        DELETE it_sflight INDEX sy-tabix.
      ENDLOOP.
      p_selfld-refresh = 'X'.

  ENDCASE.
ENDFORM.                    "user_command

Regards

Vijay

Read only

Former Member
0 Likes
928

HI ,

Check programs with balv

Regards,

Laxmi.

Read only

Former Member
0 Likes
928

thnak you all