2008 May 23 8:37 AM
Hi,
I have craeted a report which displays the contents of the database table in ALV. on the application toolbar of that alv display, i've given a button to insert new record in that database table by calling a screen to enter new record. when i press that button and enter the details for new record , that record gets saved in database table but its not displaying in the ALV.
i need to press refrsh button manually.
Is there any way to refresh the ALV as soon as i press OK to save the record..
***make sure i m using Grid display.
No object oriented replies please.
Regards
Puja.
2008 May 23 8:43 AM
Hi,
if your grid is named grid1 you can do it in the end of pai by
CALL METHOD grid1->refresh_table_display.
regards
Walter Habich
2008 May 23 8:45 AM
Hi,
This is how you refresh the list after the user user command is executed.
set the field refresh of the rs_selfield to 'X'
rs_selfield-refresh = 'X'.
regards,
Advait
2008 May 23 8:47 AM
Hi,
Check this code...
code
REPORT ZTEST_ALV.
type-pools:slis.
DATA: GT_SFLIGHT TYPE TABLE OF SFLIGHT.
DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT type SLIS_FIELDCAT_ALV.
data: l_layout type SLIS_LAYOUT_ALV.
SELECT * FROM SFLIGHT INTO TABLE GT_SFLIGHT.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = sy-repid
I_STRUCTURE_NAME = 'SFLIGHT'
I_INCLNAME = sy-repid
CHANGING
CT_FIELDCAT = gt_fieldcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
perform alv_display.
&----
*& Form status
&----
text
-
form status USING P_EXTAB TYPE SLIS_T_EXTAB .
set pf-status 'AAA' excluding p_extab.
endform. "status
&----
*& Form USER_COMMAND
&----
text
-
-->P_UCOMM text
-->P_SELFIELD text
-
FORM USER_COMMAND USING P_UCOMM LIKE SY-UCOMM
P_SELFIELD TYPE SLIS_SELFIELD.
case p_ucomm.
when 'TEST'.
fieldcat-no_out = 'X'.
modify gt_fieldcat from fieldcat
transporting no_out where fieldname = 'PRICE'.
p_selfield-exit = 'X'.
perform alv_display.
endcase.
ENDFORM. "USER_COMMAND
&----
*& Form alv_display
&----
text
-
FORM alv_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IS_LAYOUT = l_layout
I_CALLBACK_PROGRAM = sy-repid
I_STRUCTURE_NAME = 'SFLIGHT'
I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = GT_FIELDCAT[]
TABLES
T_OUTTAB = GT_SFLIGHT.
ENDFORM. " alv_display[/code]
Regards,
Raj.
2008 May 23 8:51 AM
HI
call method refresh_table_display of class cl_gui_alv_grid.
The following method call is used to refresh the data displayed within an ALV object grid:
CALL method gd_tree->REFRESH_TABLE_DISPLAY.
CALL METHOD gd_tree->set_table_for_first_display
EXPORTING
is_layout = gd_layout
CHANGING
it_fieldcatalog = gd_fieldcat
it_sort = it_sortcat
it_outtab = it_report.
CALL method gd_tree->REFRESH_TABLE_DISPLAY.
CALL METHOD cl_gui_cfw=>flush.
I have copied one sample code ..even u can use this piece of code :
Content and Structure Change
Use
You are able to change the internal data table in various ways. Depending on which type of change you use, you have to proceed differently to make the change visible on the front end in the ALV output as well.
You are able to make the following changes:
· You change content or the sequence of the individual data records
Afterwards you need to refresh the ALV output
· You replace the entire data table
Refresh Display of the ALV Output
If you have changed single values, added rows or deleted rows in the data table of list-type ALV outputs, you need to complete these changes in the ALV output as well by refreshing the ALV display.
For Changes in the Tree Structure you do not have to refresh the display. In the other ALV tools, you do not have to refresh the ALV output when you make the following changes:
§ Changes to the Display of Columns
§ Changes Sequence of Columns in the ALV display
§ Changes to the DDIC Reference of Columns
By default, the ALV output automatically scrolls to the beginning. However, you are able to determine that the current display (position on the screen) not be changed.
You are able to refresh the ALV output in two ways:
· All settings for filters and sorting remain.
This setting can lead to newly inserted data records not being displayed because the filter setting hid exactly these data records.
· All settings for filters and sorting remain.
Features
For changes to content and structure, you are able to make the following settings:
· Refresh ALV output
· Swap the data table of the ALV output
Refresh ALV output
With the refresh, you ensure that the changed values are available on the front end as well.
Display type
ALV Tool
Classic ABAP list
Full screen
In the Container
Simple, two-dimensional table
Yes
Yes
Yes
Hierarchical-sequential list
Yes
Tree structure
No
No
Methods
Function
Class
Method
Refresh ALV output without deleting filter and sort settings
CL_SALV_TABLE
CL_SALV_HIERSEQ_TABLE
REFRESH
(Parameter REFRESH_MODE: SOFT)
Refresh ALV output and delete filter and sort settings
REFRESH
(Parameter REFRESH_MODE: FULL)
Change the Structure of the Data Table with SET_DATA
Depending on which ALV tool you are using, the parameters of the SET_DATA method are different:
If you assign a new structure with SET_DATA, all objects that referred to the previous structure will be deleted such as all sort objects in list-type ALV outputs or all node objects in tree structures.
Methods
Function
Class
Method
Change structure and data table
CL_SALV_TABLE
CL_SALV_HIERSEQ_TABLE
CL_SALV_TREE
CL_SALV_HIERSEQ_LEVEL
SET_DATA
Change the Structure of the Data Table with the SET_DATA Method
ALV Tool
Parameter
Remarks
Simple, two-dimensional table
T_TABLE
Table for structure and contents of the ALV output
Hierarchical-sequential list
(in CL_SALV_HIERSEQ_TABLE)
LEVEL
Hierarchy level whose structure you wish to change
T_TABLE
New table of hierarchy level
T_BINDING
List of up to five foreign-key relationships
(in CL_SALV_HIERSEQ_LEVEL)
VALUE
New table of hierarchy level
T_BINDING
List of up to five foreign-key relationships
Tree structure
T_TABLE
Initial table
Empty table, only sets the structure
2008 May 23 8:55 AM
Hi,
Check the below FM:
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
Kannaiah