Application Development 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: 

ALV and refresh list

Former Member
0 Kudos

The following is the part of my program to generate a list, and then go to 2nd page to do the update, add or delete. After I am done with the update, I press the "back" button at application tool bar, and it brings back the 1st page of list. But the list show the content before the update. Anyone can tell me how to refresh the list? or if you can show me how to add a refresh button at the bottom of the list will work too. Thank you in advance.

FORM SHOW_NEWRECD.

refresh: itab, i_zmytable, myitab.

DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

select * from zmytable into table itab

where fidocnum = ''.

*------- Field Catalogue

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = sy-repid

i_internal_tabname = 'ITAB'

i_inclname = sy-repid

CHANGING

ct_fieldcat = alvfc

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

*----


Display

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

it_fieldcat = alvfc

i_callback_program = sy-repid

i_callback_user_command = 'ITAB_USER_COMMAND'

i_screen_start_column = 10

i_screen_start_line = 5

i_screen_end_column = 115

i_screen_end_line = 25

TABLES

t_outtab = itab

EXCEPTIONS

program_error = 1

OTHERS = 2.

ENDFORM. "SHOW_NEWRECD

*----


  • CALL BACK FORM

*----


FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE

slis_selfield.

READ TABLE itab INDEX whatrow-tabindex.

*----


Select Data

select * from zmytable into table myitab

where field1 = itab-field1

and field2 = itab-field2

and field3 = itab-field3

and field4 = itab-field4

and SAKNR = itab-saknr.

      • Another testing using screen

call screen 500.

ENDFORM. "ITAB_user_command

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

If you are directly updating the DB in screen 500, it could b as easy as this. Re-reading the db into ITAB and refresh the grid.



form itab_user_command using whatcomm type sy-ucomm whatrow type
slis_selfield.

  read table itab index whatrow-tabindex.

*--------- Select Data
  select * from zmytable into table myitab
  where field1 = itab-field1
  and field2 = itab-field2
  and field3 = itab-field3
  and field4 = itab-field4
  and saknr = itab-saknr.

*** Another testing using screen
  call screen 500.

<b>
  select * from zmytable into table itab
            where fidocnum = ''.
  whatrow-refresh = 'X'.
  whatrow-col_stable  = 'X'.
  whatrow-row_stable = 'X'.</b>


endform. "ITAB_user_command

REgards,

Rich Heilman

3 REPLIES 3

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

If you are directly updating the DB in screen 500, it could b as easy as this. Re-reading the db into ITAB and refresh the grid.



form itab_user_command using whatcomm type sy-ucomm whatrow type
slis_selfield.

  read table itab index whatrow-tabindex.

*--------- Select Data
  select * from zmytable into table myitab
  where field1 = itab-field1
  and field2 = itab-field2
  and field3 = itab-field3
  and field4 = itab-field4
  and saknr = itab-saknr.

*** Another testing using screen
  call screen 500.

<b>
  select * from zmytable into table itab
            where fidocnum = ''.
  whatrow-refresh = 'X'.
  whatrow-col_stable  = 'X'.
  whatrow-row_stable = 'X'.</b>


endform. "ITAB_user_command

REgards,

Rich Heilman

0 Kudos

Don't believe it can be this simple, but yes, it workes for me. Thank you.

0 Kudos

Glad that it worked for you.

Regards,

Rich Heilman