‎2010 Jun 10 9:45 AM
I have an ALV for which I have diffent views for which diffent data and columns are displayed accordingly
but it is showing only first view data even after clickin on diffent views although values change in internal table and field catalog....What might be the prob
I hav refreshed the display also before
IF NOT go_esy_cust IS INITIAL.
CALL METHOD go_esy_grid->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2.
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.
IF go_esy_cust IS INITIAL.
CREATE OBJECT go_esy_cust
EXPORTING
container_name = k_cc_alv.
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.
Create grid object
CREATE OBJECT go_esy_grid
EXPORTING
i_parent = go_esy_cust
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Display the final table
CALL METHOD go_esy_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
i_save = k_x
CHANGING
it_outtab = gi_final_effect
it_fieldcatalog = gi_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Edited by: Karan Chopra on Jun 10, 2010 2:28 PM
‎2010 Jun 10 9:50 AM
Hi Karan,
try to free the grid using free method look at this sample code
PERFORM free.
*Creating object of container
CREATE OBJECT c_container1
EXPORTING
container_name = 'CONTAINER1'.
*Creating object of alv
CREATE OBJECT c_alv1
EXPORTING
i_parent = c_container1.
wa_layout1-zebra = 'X'.
CALL METHOD c_alv1->set_table_for_first_display
EXPORTING
is_layout = wa_layout1
CHANGING
it_outtab = <dyn_table3>
it_fieldcatalog = it_fieldcat2.
FORM free .
IF c_alv1 IS NOT INITIAL.
CALL METHOD c_alv1->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
FREE c_alv1.
ENDIF.
ENDIF.
IF c_container1 IS NOT INITIAL.
CALL METHOD c_container1->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
FREE c_container1.
ENDIF.
ENDIF.
ENDFORM.
‎2010 Jun 10 9:50 AM
Hi Karan,
try to free the grid using free method look at this sample code
PERFORM free.
*Creating object of container
CREATE OBJECT c_container1
EXPORTING
container_name = 'CONTAINER1'.
*Creating object of alv
CREATE OBJECT c_alv1
EXPORTING
i_parent = c_container1.
wa_layout1-zebra = 'X'.
CALL METHOD c_alv1->set_table_for_first_display
EXPORTING
is_layout = wa_layout1
CHANGING
it_outtab = <dyn_table3>
it_fieldcatalog = it_fieldcat2.
FORM free .
IF c_alv1 IS NOT INITIAL.
CALL METHOD c_alv1->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
FREE c_alv1.
ENDIF.
ENDIF.
IF c_container1 IS NOT INITIAL.
CALL METHOD c_container1->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
FREE c_container1.
ENDIF.
ENDIF.
ENDFORM.
‎2010 Jun 10 10:13 AM
‎2010 Jun 10 10:22 AM
Can u tell me why is free used to free container Y didnt it worked with refresh table display
‎2010 Jun 14 11:36 AM
Hi Karan,
free method removes the object instance. And when new instance is created it consist of fresh data .
Tats the simple logic ..