‎2009 Jun 23 8:31 AM
Hi Gurus...
I have created an object oriented alv grid report.
I want to place some text data above the grid.
(In Alv list reports we can display using commentary write,top_of_page events but i'm unable to create in Alv grid)
Can u help me....
How to display text data in a container(using class cl_gui_container)?
‎2009 Jun 23 11:03 AM
HI,
You will have to create a container and embed the information within it.
For e.g: create a custom container with name ALV_TOP
and make use of CL_DD_DOCUMENT
and then
data : g_alvgrid_top TYPE REF TO cl_dd_document.
*--create object and data for Top of Page summary
IF g_alvgrid_top IS INITIAL.
CREATE OBJECT g_alvgrid_top
EXPORTING
background_color =
g_alvgrid_top->col_background_level2.
*-- Total No of Records
CONCATENATE text-021 "'Total No of Records uploaded :'
l_total
INTO l_text
SEPARATED BY space.
CALL METHOD g_alvgrid_top->add_text
EXPORTING
text = l_text
sap_fontsize = g_alvgrid_top->medium
sap_color = g_alvgrid_top->list_key_inv
sap_emphasis = g_alvgrid_top->strong.
*-- No of Records successfully processed
CONCATENATE text-022 " 'No of Records processed successfully :'
l_valid
INTO l_text
SEPARATED BY space.
*-- Adding Line
CALL METHOD g_alvgrid_top->new_line.
CALL METHOD g_alvgrid_top->add_text
EXPORTING
text = l_text
sap_fontsize = g_alvgrid_top->medium
sap_color = g_alvgrid_top->list_positive_inv
sap_emphasis = g_alvgrid_top->strong.
*-- No of Records in error
CLEAR: l_text.
CONCATENATE text-023 "'No of Records in Error :'
l_error
INTO l_text
SEPARATED BY space.
*-- Adding Line
CALL METHOD g_alvgrid_top->new_line.
CALL METHOD g_alvgrid_top->add_text
EXPORTING
text = l_text
sap_fontsize = g_alvgrid_top->medium
sap_color = g_alvgrid_top->list_negative_inv
sap_emphasis = g_alvgrid_top->strong.
CALL METHOD g_alvgrid_top->display_document
EXPORTING
container = 'ALV_TOP'.
‎2009 Jun 23 1:52 PM
Hi Gary.
Thank you.
We did with custom container.Can we do it with cl_gui_alv_grid(like top_of_page,commeantayr write)?
‎2009 Jun 23 11:06 AM
Hi,
On the ALV GRID object it is not possible.
Create one more container and you can use a text editor object (CL_GUI_TEXTEDIT) to display your text.
Regards,
Ankur Parab
‎2009 Jun 23 12:59 PM
You can in the following way by using the docking container and splitting the container.
CREATE OBJECT wf_my_container
EXPORTING dynnr = '100'
extension = 290
side = cl_gui_docking_container=>dock_at_top.
Create Splitter container object in container
CREATE OBJECT wf_splitter
EXPORTING
parent = wf_my_container
rows = 2
columns = 1.
Assigning container 1 to splitter container
CALL METHOD wf_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = wf_container_1.
Assigning height to row
CALL METHOD wf_splitter->set_row_height
EXPORTING
id = '1'
height = 32.
Assigning container 2 in splitter container
CALL METHOD wf_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = wf_container_2.
CREATE OBJECT wf_grid
EXPORTING i_parent = wf_container_2.