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

NEED to refresh table while using REUSE_ALV_GRID _DISPLAY

Former Member
0 Likes
903

wee needto refresh the alv table, here depending on the button we need to refresh the display.But here the program uses a function module and not a OOPS concept. We need to dynamically add or remove lines from the table. ne guidance on how this can be done. Ne little code will also be helpful.

Thanks.

wee needto refresh the alv table, here depending on the button we need to refresh the display.But here the program uses a function module and not a OOPS concept. We need to dynamically add or remove lines from the table. ne guidance on how this can be done. Ne little code will also be helpful.

Thanks.

5 REPLIES 5
Read only

Former Member
0 Likes
868

say SAVE is ur UCOMM

when 'SAVE'.

*here write code to save data

SUBMIT <REORT NAME> " to refresh ALv

Read only

santosh_fhalke
Participant
0 Likes
868

hi,

what u can do is, keep a button with some events declared in status.

like u set in set pf-status 'statusname'.

Then in that event capturing u can put ur refreshing of data and again refilling of data. And after refilling the data into dat table call display function again.

Keep display function module in some subroutine so dat u can call it ne time u need.

Hope it answers ur question.

bye.

Santosh.

Read only

Former Member
0 Likes
868

Referr this link

http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_editable.htm

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

  • Now your internal table will have the data that is seen in the editable alv.

Read only

0 Likes
868

Judith:

This is exactly what I was looking for - I only wish I found it sooner!!

Thank you!!

Read only

Former Member
0 Likes
868

Hi Surya,

when using the function module "REUSE_ALV_GRID_DISPLAY", you have a exporting parameter called "I_CALLBACK_USER_COMMAND". This is the name of a form in your report to handle all the buttons clicked. To create your own buttons just create a GUI-Status and provide the exporting parameter "I_CALLBACK_PF_STATUS_SET" with a form in your report that sets the status.

Inside your user_command-Form you can update all the records of your internal table. To make ALV refresh the display just provide the field st_selfield-refresh with 'X'.

EXAMPLE:

=========

FORM USER_COMMAND USING RC_UCOMM LIKE SY-UCOMM

ST_SELFIELD TYPE SLIS_SELFIELD.

case rc_ucomm.

  • check which button has been pressed

  • Refresh internal table

select... into itab...

endcase.

  • Make sure, that the updated internal table itab is displayed

st_selfield-refresh = 'X'.

ENDFORM.

FORM PF_STATUS_SET USING RT_EXTAB TYPE SLIS_T_EXTAB.

SET PF-STATUS 'ALV'. " EXCLUDING RT_EXTAB.

ENDFORM.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = 'ZPXYZ'

I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET'

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'

.....

...

Regards

CHRIS