‎2010 Jun 03 4:37 PM
Hi,
I am trying to use ALV using oops concept, but the report is not displaying the ALV grid.
{please let me know if there are any error.
Edited by: Arunsri on Jun 3, 2010 5:42 PM
Edited by: Rob Burbank on Jun 3, 2010 11:57 AM
‎2010 Jun 04 9:28 AM
Hi all,
Thanks for you replies. I am trying to display ALV in a report. Once the user enters the value in the selection screen and execute it should display the ALV.
When i try to display the ALV using REUSE_ALV_GRID_DISPLAY it is working fine.
Since i am learning to create it using OO concept i wanted to bring that using OO.
Since it is a report program, no screens or modules are involved.
Thanks,
sri
‎2010 Jun 03 4:48 PM
data : alv_container type ref to cl_gui_docking_container.
data : alv_grid type ref to cl_gui_alv_grid.
data : layout type lvc_s_layo.
data : variant type disvariant.
check alv_container is initial.
CREATE OBJECT alv_container
EXPORTING
* parent =
repid = sy-repid
dynnr = sy-dynnr
side = alv_container->dock_at_left
* extension = 1550
* style =
* lifetime = lifetime_default
* caption =
* metric = 0
* ratio = '95'
* no_autodef_progid_dynnr =
* name =
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.
*- Make the docking container as parent to the grid
CREATE OBJECT alv_grid
EXPORTING
i_parent = alv_container
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.
* layout-zebra = 'X'.
PERFORM build_fieldcat.
variant-report = sy-repid.
*- Call grid for display
CALL METHOD alv_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'WT_TEST'
is_variant = variant
i_save = 'A'
* is_layout = layout
CHANGING
it_outtab = WT_TEST
it_fieldcatalog = wt_fcat_log
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.
‎2010 Jun 03 7:30 PM
I think you are not placing your code in PBO, do you? You need that to show your alv once the screen/selection screen is being prepared for display. Only then it will work. So you need the logic
MODULE pbo OUTPUT.
check alv_container is initial.
"create container
...
"create ALV
...
"dispaly ALV
ENDMODULE.
For selection screen of course you need to use AT SELECTION-SCREEN OUTPUT instead.
Regards
Marcin
‎2010 Jun 04 6:31 AM
You check Tcode: DWDM where same codes of control frame work are available.
You have to create a screen and write the code for showing alv in PBO.
‎2010 Jun 04 9:28 AM
Hi all,
Thanks for you replies. I am trying to display ALV in a report. Once the user enters the value in the selection screen and execute it should display the ALV.
When i try to display the ALV using REUSE_ALV_GRID_DISPLAY it is working fine.
Since i am learning to create it using OO concept i wanted to bring that using OO.
Since it is a report program, no screens or modules are involved.
Thanks,
sri
‎2010 Jun 04 9:45 AM
Hello Arunsri,
If you are using OO method to display alv then you need to define screen in screen painter which will have custom container control on it.
Once you are done with selection of data into internal table then you need to call that screen using
CALL SCREEN <scr_number>.
This will trigger PBO module of screen where you need to check if instance for grid and container are already created or not.
If not then you need to create then,
So, instead of cl_gui_docking_container you need to use cl_gui_custom_container and you need to pass name which is defined for the custom container in screen painter. Once custom container is ready pass this as container pass this to create alv_grid and the data table and it will display screen with the alv grid.
Hope this resolves you issue.
For more details please refer to SAP help for [ ALV using OO | http://help.sap.com/saphelp_47x200/helpdata/en/52/5f0607e02d11d2b47d006094192fe3/frameset.htm ]
Thanks,
-Augustin.
‎2010 Jun 04 9:53 AM
You must create a screen for OOPS ALV. Just create a screen and call it in START-OF-SELECTION. As you are using docking container, no need to create a custom container in the screen. In PBO, you can write the code for ALV display.
‎2010 Jun 04 10:03 AM