2008 May 13 6:08 AM
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
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
2008 May 13 6:15 AM
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
2008 May 13 6:20 AM
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.
.....
2008 May 13 7:23 AM
can u paste the code where u have used set_table_for_first_display
2008 May 13 7:37 AM
2008 May 13 7:45 AM
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.
2008 May 13 7:54 AM
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.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |