09-20-2006 12:24 AM
hi all,
i'm doing a purchase report in alv with objects, but when i create a object, i want to know how to destruct that object because it can't refresh the data so, i wanna destroy it before i use it. can any body help me?
09-20-2006 4:08 AM
Hi,
CALL METHOD custom_container1->free.
B.T.W..Did you use the refresh_table_display method for refreshing the table data..
Check the program BCALV_GRID_08 for grid display using OO..
Thanks
Naren
09-20-2006 12:25 AM
09-20-2006 12:50 AM
Hi Jose,
Make the reference of object to point to some other object. The destructor automatically destroys the object, no need to destroy the object.
Regards,
Azaz Ali.
09-20-2006 4:01 AM
09-20-2006 4:08 AM
Hi,
CALL METHOD custom_container1->free.
B.T.W..Did you use the refresh_table_display method for refreshing the table data..
Check the program BCALV_GRID_08 for grid display using OO..
Thanks
Naren
09-20-2006 3:58 PM
THANKS,
but i can't do it, it show me a raise error.
in the icon back of my second dynpro <- i put CALL METHOD go_custom_container->FREE.
So, when the first dynpro appears i can choose the center, the material or the accounting date, so it supposes that the object go_custom_container is free, but when i introduce other search show me a raise error.
I don'r know if the call method is ok in the back button or it could be other thing.
this is my code:
MODULE user_command_0002 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'BACK'.
CLEAR S_MATNR.
CLEAR S_BUDAT.
CLEAR S_WERKS.
CLEAR SY-UCOMM.
CLEAR GI_T_FILE.
REFRESH GI_T_FILE.
CALL METHOD go_custom_container->FREE.
LEAVE TO SCREEN 0001.
ENDCASE.
ENDMODULE. " USER_COMMAND_0002 INPUT
MODULE status_0002 OUTPUT.
SET PF-STATUS '0002'.
PERFORM load_data_into_grid.
IF go_custom_container IS INITIAL.
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'ZTFILE_OOA'
CHANGING it_outtab = GI_T_FILE.
CALL METHOD go_grid->set_toolbar_interactive.
ELSE.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'ZTFILE_OOA'
CHANGING it_outtab = GI_T_FILE.
CALL METHOD go_grid->set_toolbar_interactive.
CALL METHOD go_grid->refresh_table_display.
ENDIF.
ENDMODULE. " STATUS_0002 OUTPUT
09-20-2006 4:12 PM
Hello Jose
There is no need to destroy the container for the ALV grid.
Assuming that you have define a "custom control" element on your 2nd dynpro you could do the following:
(1) Create the custom container (CONTAINER_NAME = "...", REPID = syst-cprog, DYNNR = <your 2nd dynpro>) even before calling any screen.
(2) Create your ALV grid instance using the custom container instance as parent.
(3) Call method SET_TABLE_FOR_FIRST_DISPLAY with your itab (probably still empty, but does not matter).
Now you call your 1st dynpro and populate your itab in PAI before calling the 2nd dynpro.
(4) Also in PAI of the 1st dynpro you call REFRESH_TABLE_DISPLAY.
(5) In PBO of your 2nd dynpo you call CL_GUI_CFW=>FLUSH ton ensure that the current itab data are sent to the grid control at the frontend.
Regards
Uwe
09-20-2006 4:54 PM
hi Uwe,
thanks for the response, but i can't do to flush the new data.
(1) Create the custom container (CONTAINER_NAME = "...", REPID = syst-cprog, DYNNR = <your 2nd dynpro>) even before calling any screen.
in this i created a custom control to display my data where i have to put that code?
2) Create your ALV grid instance using the custom container instance as parent
what is the code? i don't know how :S
regards,
Jose Roberto
09-20-2006 6:35 PM
Hi,
DATA: cnt_1 TYPE REF TO counter,
cnt_2 TYPE REF TO counter1.
START-OF-SELECTION.
CREATE OBJECT: cnt_1.
MOVE cnt_1 TO cnt_2.
CLEAR cnt_1.
Regards,
Azaz.
09-20-2006 6:37 PM
try this...
<b>IF NOt go_custom_container is initial.</b>
CALL METHOD go_custom_container->FREE.
<b>endif.</b>
09-20-2006 9:09 PM
Hello Jose
Here is a litte sample program. The dynpro '100' contains no elements whatsoever:
*&---------------------------------------------------------------------*
*& Report ZUS_SDN_ALV_REPORT *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT zus_sdn_alv_report .
TABLES: mara.
DATA:
go_docking TYPE REF TO cl_gui_docking_container,
go_alvgrid TYPE REF TO cl_gui_alv_grid,
gt_mara TYPE STANDARD TABLE OF mara.
START-OF-SELECTION.
* (1.a) Create container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
* REPID =
* DYNNR =
* SIDE = DOCK_AT_LEFT
ratio = 90
EXCEPTIONS
OTHERS = 99.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* (1.b) Create ALV grid
CREATE OBJECT go_alvgrid
EXPORTING
i_parent = go_docking
EXCEPTIONS
OTHERS = 99.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* (2) Display itab
CALL METHOD go_alvgrid->set_table_for_first_display
EXPORTING
i_structure_name = 'MARA'
CHANGING
it_outtab = gt_mara " still empty !!!
EXCEPTIONS
OTHERS = 99.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* (3) Link docking container to target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-cprog
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 99.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* (4) Select some data (in your case: during PAI of 1st dynpro)
SELECT * FROM mara INTO TABLE gt_mara
UP TO 10 ROWS.
* (5) Refresh table display: at PAI of 1st dynpro
* before calling 2nd dynpro
CALL METHOD go_alvgrid->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 99.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* (6) Call dynpro (in your case: 2nd dynpro)
CALL SCREEN '100'.
END-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS '0100'.
SET TITLEBAR '0100'.
** Flushing (not necessary)
* CALL METHOD cl_gui_cfw=>flush.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
SET SCREEN 0. LEAVE SCREEN.
ENDMODULE. " USER_COMMAND_0100 INPUT
The container and grid instance can be created before calling any dynpro.
Data selection and refresh of table display occurs at PAI of your 1st dynpro. Flushing appears to be unnecessary.
If you want or have to use a custom container instead of the docking container then you have to place a custom control on your 2nd dynpro and call the LINK method with the container name.
Regards
Uwe
09-20-2006 8:30 AM
use METHOD Refresh_Table_Display.
and make sure the table you passed in METHOD Set_Table_for_First_display still exists ( ie. global variable ) if ever you passed this table to a subroutine (in which the set_table_for_first_display is invoked), make sure you set the parameter as reference.
Hope this helps..