2012 Mar 30 4:20 PM
Hi guys,
I developed a report using ALV and when I select an Item and press the button another ALV OO is started. So the details are displayed. But when I back and select another Item to show its details the ALV OO shows only the first details displayed before... I can't find the problem. I used the method to refresh the table when I leave the screen, but it didn't work.
So, can someone help me with any suggestion or know this problem and solved it before??
The code is attached.
Thanks!
Regards,
Marcos Fernando Dotta
2012 Mar 30 4:44 PM
Try flushing the ALV in PBO of second ALV using the method CALL METHOD cl_gui_cfw=>flush.
Or you can Free both ALV gird object and Container and recreate them all the time you call the 2nd ALV.
Regards,
Naimesh Patel
Hi guys,
I developed a report using ALV and when I select an Item and press the button another ALV OO is started. So the details are displayed. But when I back and select another Item to show its details the ALV OO shows only the first details displayed before... I can't find the problem. I used the method to refresh the table when I leave the screen, but it didn't work.
So, can someone help me with any suggestion or know this problem and solved it before??
The code is attached.
Thanks!
Regards,
Marcos Fernando Dotta
2012 Mar 30 4:44 PM
Try flushing the ALV in PBO of second ALV using the method CALL METHOD cl_gui_cfw=>flush.
Or you can Free both ALV gird object and Container and recreate them all the time you call the 2nd ALV.
Regards,
Naimesh Patel
2012 Mar 30 6:56 PM
Hi Namesh,
I tried with the method, but it didn't work. I already clear and free the objects, but it doesn't work too.
What could be the problem??
Thanks!!
Regards,
Marcos Fernando Dotta
2012 Apr 02 9:48 AM
Hi,
If you are using FREE abap statement for free the container and alv objects doesn't works.
You should use the methods FREE for each class before to close the second ALV and create the objects again all the times you call it...
CALL METHOD v_grid->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
others = 3.
CALL METHOD v_container->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
others = 3.
2012 Apr 03 11:19 AM
Hi,
Marcos Fernando Dotta wrote:
Hi Namesh,
I tried with the method, but it didn't work. I already clear and free the objects, but it doesn't work too.
What could be the problem??
Thanks!!
Regards,
Marcos Fernando Dotta
You first have to free the ressources used by your object before actually clearing it
Don't know if this can solve your issue but I would give this a try...
Regards,
Manu.
2012 Mar 31 4:35 AM
You may like to check this post. It may be helpful.
Or else post your program in .txt file so that we can try to find out the problem
2012 Apr 02 7:04 PM
I checked the code and it seems like there is no need for the OO-ABAP code to refresh the ALV display.
You already have an ALV Display with a FM Call for 'REUSE_ALV_GRID_DISPLAY' and then at the back button again the container and grid objects are being instantiated etc etc.
ALV Table Data can refreshed by just using these steps:
Step 1. Set slis_selfield-refresh = 'X' in the user_command module on REFRESH User Command (in your case BACK or whatever)
Step 2. Add this user command to the Callback function - ZF_ALV_USER_COMMAND
The report will get refreshed with the data on Back button.
Regards,
Shyam
2012 Apr 03 11:06 AM
Have you checked if you have cleared the internal table before using it the second time?
Have you tried refreshing in the following manner:
IF o_grid_item IS INITIAL.
CREATE OBJECT O_CONTAINER_ITEM
EXPORTING
CONTAINER_NAME = 'CONTAINER_ITEM'
REPID = sy-repid
DYNNR = sy-dynnr
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
others = 6
.
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 O_GRID_ITEM
EXPORTING
I_PARENT = o_container_item
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.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = 'TY_FINAL2'
CHANGING
CT_FIELDCAT = it_fieldcat2
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD O_GRID_ITEM->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'TY_FINAL2'
IS_LAYOUT = wa_layout
CHANGING
IT_OUTTAB = it_final2
IT_FIELDCATALOG = it_fieldcat2
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.
ELSE.
CALL METHOD O_GRID_ITEM->REFRESH_TABLE_DISPLAY
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
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.