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 data not refreshed

Former Member
0 Likes
700

M using method set_table_for_first_display to display ALV on screen.

If i go back and enter some new values and again display the alv i see the previous values in the grid. Only Top of page gets refreshed. Hence the grid data is not getting refreshed.

For this i also used method refresh_table_display just after the method set_table_for_first_display but to of no avail.

PLZ HELP!

M using method set_table_for_first_display to display ALV on screen.

If i go back and enter some new values and again display the alv i see the previous values in the grid. Only Top of page gets refreshed. Hence the grid data is not getting refreshed.

For this i also used method refresh_table_display just after the method set_table_for_first_display but to of no avail.

PLZ HELP!

4 REPLIES 4
Read only

Former Member
0 Likes
668

Hi,

Clear and refresh the internal table which u hv used to display the data in ALV.

Hope this helps

Regds

Seema

Read only

Former Member
0 Likes
668

Hi,

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.

Regards,

Raj.

Read only

Former Member
0 Likes
668

hi,

you must be appending records in an internal table.

when you enter new values then that time you must not refreshing the internal table and appending the new values in the same..so your previous records will be there in table..

or you can take two internal table one for display purpose and another for new entries...

and then just do itab1 = itab2.

then call the method set_table........

Read only

Former Member
0 Likes
668

Hi,

after calling the method SET_TABLE_FOR_FIRST_DISPLAY

u r doing some operation on the internal table entries..??

if so updated the internal table with the same values

and then call the method REFRESH_TABLE_DISPLAY