‎2010 Jul 07 6:32 AM
Hi,
I have used method "set_table_for_first_display" in ALV programming like below :
create object r_container
exporting
container_name = 'CCONTAINER'
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.
create object r_alv_grid
exporting
i_parent = r_container
exceptions
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5.
call method r_alv_grid->set_table_for_first_display
exporting
i_structure_name = 'ZCCPC_REPORT'
changing
it_outtab = it_zcrm_r3
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4.
however, everytime when i re-execute the program, the internal table "it_zcrm_r3" is not getting refreshed. It still contains the old data. I think after using "set_table_for_first_display" method, data is not getting refreshed and internal table still holds the data.
Can you please let me know how to refresh the contents after using method "set_table_for_first_display" ???
‎2010 Jul 07 6:35 AM
HI,
When you come out of the screen, free the container, grid and also the internal table from where you are
displaying the data.
Hope it helps.
Regards and Best wishes.
‎2010 Jul 07 6:35 AM
HI,
When you come out of the screen, free the container, grid and also the internal table from where you are
displaying the data.
Hope it helps.
Regards and Best wishes.
‎2010 Jul 07 6:45 AM
Hi,
Use the method REFRESH_TABLE_DISPLAY ,
With parameter i_soft_refresh = 'X', which specifies that only data contents are passed again , which keeps current filter and sort criteria.
You can also retain the scroll position by passing 'X' to ROW or COL fields of a structure using the global type LVC_S_STBL.
If you are changing the row structure , you cannot use this method , in this case again you need to call the SET_TABLE_FOR_FIRST_DISPLAY.
I hope it helps you .
With Regards,
Kiruba.
‎2010 Jul 07 6:45 AM
HI
as per your code you need to check if your alv is initial before creating object for your container
like
if cust_container is initial , then write your code
create object cust_container and
in else condition call method.
CALL METHOD MY_ALV1->REFRESH_TABLE_DISPLAY.
this will refresh your alv.
see below code.
IF CUST_CONTAINER1 IS INITIAL .
CREATE OBJECT CUST_CONTAINER1
EXPORTING
CONTAINER_NAME = 'CONTAINER2' .
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT MY_ALV1
EXPORTING
I_PARENT = CUST_CONTAINER1 .
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM FIELD_CATLOG1.
CALL METHOD MY_ALV1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'STR1'
I_SAVE = 'A'
CHANGING
IT_OUTTAB = ITAB1[]
IT_FIELDCATALOG = I_FCAT1[]
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ELSE .
CALL METHOD MY_ALV1->REFRESH_TABLE_DISPLAY
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF .
ENDMODULE. " STATUS_0101 OUTPUT
thanks
lalit gupta
‎2010 Jul 07 7:05 AM
Hello Santosh B ,
Probably you must have created the Grid and container objects in the PBO of your screen ....and they should be Ideally created only once through out the program just check if container is initial then create the container and same for the grid object ie. if grid is initial then create the grid and use method set_table_for_first_display(the method should be used only for first time display
Condition's apply ) and for rest use refresh for rest all... .....May be this is causing the old data to be displayed....
Hope it helps...
Thanks and regards,
Edited by: Anup Deshmukh on Jul 7, 2010 8:05 AM
Edited by: Anup Deshmukh on Jul 7, 2010 8:17 AM
‎2010 Jul 07 7:13 AM
Yes, you are right , I have created the Grid and container objects in the PBO of screen.
‎2010 Jul 07 7:19 AM
‎2010 Jul 07 7:24 AM