11-15-2006 11:37 AM
I made an alv report and i am trying to refresh the data that i changed.
I use the "FUNCTION 'REUSE_ALV_GRID_DISPLAY" .
I don't know where and to use the proper function.
I believe at the "At user command" events i must use it but i don't know how .
If someone can help or has an example....
P.S. I know that already there is a post aboyt alv but i can;t find the solution ...
Thanks
Dimpant
11-15-2006 11:43 AM
This is a simple alv program.
TABLES : spfli.
DATA IT_spfli LIKE TABLE OF spfli.
SELECT-OPTIONS s_connid FOR spfli-connid.
SELECT * FROM SPFLI INTO TABLE IT_spfli WHERE connid = s_connid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'SPFLI'
TABLES
T_OUTTAB = IT_SPFLI.
Message was edited by:
Kalpanashri Rajendran
Message was edited by:
Kalpanashri Rajendran
11-15-2006 11:43 AM
This is a simple alv program.
TABLES : spfli.
DATA IT_spfli LIKE TABLE OF spfli.
SELECT-OPTIONS s_connid FOR spfli-connid.
SELECT * FROM SPFLI INTO TABLE IT_spfli WHERE connid = s_connid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'SPFLI'
TABLES
T_OUTTAB = IT_SPFLI.
Message was edited by:
Kalpanashri Rajendran
Message was edited by:
Kalpanashri Rajendran
11-15-2006 11:44 AM
Hi,
ALV report can not recognize AT USER-COMMAND.
YOu need pass events table to t eh above FM using the below logic:
*..To get Events list
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = it_events.
read table it_events with key name = slis_ev_top_of_page
into x_event.
if sy-subrc = 0.
move 'TOP_OF_PAGE' to x_event-form.
append x_event to it_events.
endif.
read table it_events with key name = slis_ev_user_command
into x_event.
if sy-subrc = 0.
move 'USER_COMMAND' to x_event-form.
append x_event to it_events.
endif.
YOu just need to assign RS_SELFIELD-refresh = 'X'. in your subroutine USER_COMMAND.
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
*..Refresh ALV Report
RS_SELFIELD-refresh = 'X'.
endform. "USER_COMMAND
Thanks
Ramakrishna
11-15-2006 11:46 AM
Hi Dimitris,
Proceed on the following lines.
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 '<FCODE for Refresh button>'.
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
endcase.
ENDFORM.
11-15-2006 12:23 PM
It doesn't work ....
See an example of my code..
----
FORM alv_start_viewer *
----
FORM ALV_START_VIEWER.
DATA: PGM LIKE SY-REPID.
PGM = SY-REPID.
GTITLE = PGM.
G_VARIANT-REPORT = G_REPID.
G_VARIANT-USERNAME = SY-UNAME.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = 'X'
I_CALLBACK_PROGRAM = PGM
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'AT_USER_COMMAND'
IS_LAYOUT = LAYOUT
IT_FIELDCAT = FIELDCAT
IT_SORT = SORTCAT
IS_VARIANT = G_VARIANT
I_SAVE = 'A'
IT_EVENTS = EVENTCAT[]
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM. "alv_start_viewer
.........
.........
FORM SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
FREE: RT_EXTAB .
SET PF-STATUS 'ZST9' EXCLUDING RT_EXTAB .
.....
.....
FORM AT_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD. "#EC CALLED
DATA : ANS.
DATA : LIN TYPE I,
IS_OBJECT LIKE BORIDENT.
CASE R_UCOMM.
WHEN '&IC1'.
CASE RS_SELFIELD-FIELDNAME .
WHEN 'VBELN'.
RS_SELFIELD-REFRESH = 'X'.
SET PARAMETER ID 'AUN' FIELD RS_SELFIELD-VALUE.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
WHEN 'KUNNR'.
RS_SELFIELD-REFRESH = 'X'.
SET PARAMETER ID 'KUN' FIELD RS_SELFIELD-VALUE.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
WHEN '&REFRESH'.
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.
WHEN OTHERS .
ENDCASE. " RS_SELFIELD-FIELDNAME .
11-15-2006 12:29 PM
Hi,
What i think is all these function modules are a bit clumsy.
So i prefer creating a alv grid object.
For this you can simply follow following steps
1. create a object of cl_gui_alv_grid.
2. then add ths object to a custom controller.
3. then fill the catalog and layout internal table.
then all you need to do is call different methods on this object like
set_table_for_first_display -- for first display.
refresh_table_display -- for refreshing data on ALV grid.
and there are a lot more helpful functions.
Hope this helps.
Forum points if it helps