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: 

refresh alv grid

Former Member
0 Kudos

iam using a custom table to populate data in the alv grid, it is displaying

in the same prg iam appending some records in the custom table

after appending iam coming back to the initial screen and dispalying the changed data from the custom table in the same alv grid (custom table is the same evry where) ,

The custom table is having appended records but the olddata is coming in the alv.

please suggest.

Edited by: Saurabh on May 13, 2008 7:08 AM

6 REPLIES 6

Former Member
0 Kudos

Hi,

Check this code:

In your USER_COMMAND routine, add a line as follows

code

-


FORM USER_COMMAND *

-


........ *

-


FORM user_command USING ucomm LIKE sy-ucomm

selfield TYPE slis_selfield.

CASE ucomm.

WHEN 'THIS'.

PERFORM this.

WHEN 'THAT'.

PERFORM that.

WHEN OTHERS.

ENDCASE.

MOVE '&REFRESH' TO ucomm. <---- This is what you need

ENDFORM. " USER_COMMAND

[/code]

Regards,

Shiva

Former Member
0 Kudos

If you are using the Object Orientated approach then

CALL METHOD og_alv->refresh_table_display.

will do it.

where og_alv was used like this

CALL METHOD og_alv->set_table_for_first_display
    EXPORTING
      i_save                        = 'A'
      is_variant                    = x_variant
      is_layout                     = x_layout
    CHANGING
      it_outtab                     = it_data_1005
      it_fieldcatalog               = it_fcat
    EXCEPTIONS
      invalid_parameter_combination = 1
      program_error                 = 2
      too_many_lines                = 3
      OTHERS                        = 4.

If you are using the function module approach then

FORM user_command USING r_ucomm LIKE sy-ucomm
                  rs_selfield TYPE slis_selfield.
....
rs_selfield-refresh = c_true.
.....

Former Member
0 Kudos

can u paste the code where u have used set_table_for_first_display

Former Member
0 Kudos

REFRESH table METHOD is not working

Former Member
0 Kudos

i can not paste my code here but iam using exaclty the same structure as sample program by sap( which iam listing) while calling a method.

if need to refresh by grid what i need to do, do io need to add export parameter or import parameter

MODULE PBO OUTPUT.

SET PF-STATUS 'MAIN100'.

IF G_CUSTOM_CONTAINER IS INITIAL.

CREATE OBJECT G_CUSTOM_CONTAINER

EXPORTING CONTAINER_NAME = G_CONTAINER.

CREATE OBJECT GRID1

EXPORTING I_PARENT = G_CUSTOM_CONTAINER.

CALL METHOD GRID1-SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'

CHANGING IT_OUTTAB = GT_SFLIGHT.

ENDIF.

ENDMODULE.

0 Kudos

there u go..

u have used this method inside the if condition-if container is initial.

keep this method outside the if condiotion.

when u keep it inside the if cond.then this method is called only once..and after u update ur itab then the updated itab is not passed in the method as this if condition is not true the second time (reference already created).

hope this solves ur problem.