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

Refresh table in alvgrid display

Former Member
0 Likes
12,842

hi,

Is there any method/function to refresh the alvgrid display.

thanks,

padmasri.

hi,

Is there any method/function to refresh the alvgrid display.

thanks,

padmasri.

6 REPLIES 6
Read only

ashok_kumar24116
Contributor
0 Likes
3,899

Hi Padmasri,

<b>Good Check the following example - Very Important

Herewith i am sending the sample coding for the REFRESH ALV REPORT.

&----


*& Report YMS_REFRESHALV *

*& *

&----


*& *

*& *

&----


REPORT YMS_REFRESHALV .

TABLES :T247.

TYPE-POOLS SLIS. "Type definitions for alv report

DATA: IT_FIELDCAT TYPE LVC_T_FCAT,

WA_FIELDCAT TYPE LVC_S_FCAT.

DATA: WA_LAYOUT TYPE LVC_S_LAYO.

DATA : BEGIN OF IT_FINAL OCCURS 0,

CHECK(1),

CELLTAB TYPE LVC_T_STYL, " Switch between display/change

MNR LIKE T247-MNR,

LTX LIKE T247-LTX,

END OF IT_FINAL.

DATA : WA_FINAL LIKE IT_FINAL.

DATA : W_REPID LIKE SY-REPID.

W_REPID = SY-REPID.

REFRESH IT_FINAL.

SELECT MNR LTX

FROM T247

INTO CORRESPONDING FIELDS OF TABLE IT_FINAL

WHERE SPRAS EQ 'E'.

WA_FIELDCAT-FIELDNAME = 'CHECK'.

WA_FIELDCAT-TABNAME = 'IT_FINAL'.

WA_FIELDCAT-CHECKBOX = 'X'.

WA_FIELDCAT-EDIT = 'X'..

WA_FIELDCAT-OUTPUTLEN = '3'.

WA_FIELDCAT-COL_POS = '1'.

APPEND WA_FIELDCAT TO IT_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-FIELDNAME = 'MNR'.

WA_FIELDCAT-TABNAME = 'IT_FINAL'.

WA_FIELDCAT-OUTPUTLEN = '8'.

WA_FIELDCAT-COL_POS = '2'.

WA_FIELDCAT-REPTEXT = 'Month'.

APPEND WA_FIELDCAT TO IT_FIELDCAT.

CLEAR WA_FIELDCAT.

WA_FIELDCAT-FIELDNAME = 'LTX'.

WA_FIELDCAT-TABNAME = 'IT_FINAL'.

WA_FIELDCAT-OUTPUTLEN = '20'.

WA_FIELDCAT-COL_POS = '3'.

WA_FIELDCAT-REPTEXT = 'Month Desc'.

APPEND WA_FIELDCAT TO IT_FIELDCAT.

CLEAR WA_FIELDCAT.

DATA: WA_CELLTAB TYPE LVC_S_STYL,

IT_CELLTAB TYPE LVC_T_STYL,

L_INDEX TYPE I.

CLEAR : WA_CELLTAB,WA_FINAL,IT_CELLTAB.

REFRESH IT_CELLTAB.

*Initialize the celltab table

LOOP AT IT_FINAL INTO WA_FINAL.

L_INDEX = SY-TABIX.

WA_CELLTAB-FIELDNAME = 'CHECK'.

WA_CELLTAB-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED.

INSERT WA_CELLTAB INTO TABLE IT_CELLTAB.

INSERT LINES OF IT_CELLTAB INTO TABLE WA_FINAL-CELLTAB.

MODIFY IT_FINAL FROM WA_FINAL INDEX L_INDEX.

ENDLOOP.

*Make the first five 5 rows as disabled

CLEAR L_INDEX.

LOOP AT IT_FINAL INTO WA_FINAL.

L_INDEX = SY-TABIX.

IF SY-TABIX LE 5.

LOOP AT WA_FINAL-CELLTAB INTO WA_CELLTAB.

IF WA_CELLTAB-FIELDNAME EQ 'CHECK' .

WA_CELLTAB-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.

MODIFY WA_FINAL-CELLTAB FROM WA_CELLTAB.

MODIFY IT_FINAL INDEX L_INDEX FROM WA_FINAL TRANSPORTING CELLTAB.

ENDIF.

ENDLOOP.

ENDIF.

ENDLOOP.

WA_LAYOUT-BOX_FNAME = 'CHECK'.

WA_LAYOUT-NO_ROWMARK = 'X'.

WA_LAYOUT-STYLEFNAME = 'CELLTAB'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'

EXPORTING

I_CALLBACK_PROGRAM = W_REPID

I_GRID_TITLE = 'GRID DISPLAY'

IS_LAYOUT_LVC = WA_LAYOUT

IT_FIELDCAT_LVC = IT_FIELDCAT

TABLES

T_OUTTAB = IT_FINAL

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.</b>

Good Luck and thanks

AK

Read only

Former Member
0 Likes
3,899

hi

good

refresh_table_display

CALL METHOD <ref.var. to CL_GUI_ALV_GRID>->refresh_table_display

EXPORTING

IS_STABLE = <structure of type LVC_S_STBL >

I_SOFT_REFRESH = <variable of type CHAR01 >.

http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b5531ed30911d2b467006094192fe3/content.htm

thanks

mrutyun^

Read only

Former Member
0 Likes
3,899

H Padma,

If you are implementing the ALV with REUSE* Function Modules, What you need to do for Refresh is : Just make the flag eq 'X' for the field IS_SELFIELD-REFRESH = 'X" in the Event User_command subtoutine. But make sure that before executing this statement, your internal table must be updated with New data. Then only the Refresh functionality will work otherwise you can see the effect.

I hope i make you clear.

Warm Regards,

Vijay

Read only

abhijitzope
Active Participant
0 Likes
3,899

Hi,

if you are using cl_gui_alv_grid class to display alv then REFRESH_TABLE_DISPLAY method is available.

Regards,

Abhijit

Read only

Former Member
0 Likes
3,899

Hi Padmasri,

Use this class method to refresh table

cl_gui_alv_grid-->REFRESH_TABLE_DISPLAY

Reward points if helpful.

Regards,

Hemant

Read only

Former Member
0 Likes
3,899

Hi,

In ALV, to refresh the table you have to call the method "refresh_table_display".

It has the syntax very similar to creating the table.

It has two parameters. In the first one, you can mention if you want to refresh only the data (the icons are not refreshed)

or

if you want to refresh only the icons around the grid (the data is not refreshed - this option is mostly not used in day to day applications).

the synatx is :-

call method grid (name of grid )->refresh_table_display

exporting

IS_STABLE = <STRUCT OF TYPE LVC_S_STBL> (THIS IS FOR DATA REFRESHING)

I_SOFT_REFRESH = <VARIABLE OF CHAR 01> (THIS IS FOR ICON REFRESHING).

Hope this helps.

reward if helpful.

regards,

Sipra