Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Display text data above the Alv grid using object oriented concepts

Former Member
0 Likes
2,212

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)?

4 REPLIES 4
Read only

Former Member
0 Likes
1,375

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'.

Read only

0 Likes
1,375

Hi Gary.

Thank you.

We did with custom container.Can we do it with cl_gui_alv_grid(like top_of_page,commeantayr write)?

Read only

Former Member
0 Likes
1,375

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

Read only

former_member242255
Active Contributor
0 Likes
1,375

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.