Application Development 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: 

placing header in grid display....

Former Member
0 Kudos
92

Hi all,

I need to place the details of select options on the top of page.

Iam using grid with classes.

pls suggest any method for that..

and also how to get average for a column.

Regards,

Anil kumar y.

11 REPLIES 11

0 Kudos
64

Hi,

Use the event PRINT_TOP_OF_PAGE.

regards,

Sruendar Reddy.

Former Member
0 Kudos
64

Hi Anil,

Check with these

Regards!

former_member342013
Contributor
0 Kudos
64

Hi Anil

R u using Smart Forms or normal Report?

0 Kudos
64

smitha its a normal report

how to get average for a column.

0 Kudos
64

Hi,

You can get avarage for a column by passing DO_SUM = 'C' for field cataolg internal table.

--Naveen Inuganti

0 Kudos
64

Hi,

Refer for top of page in grid using oops:-

For average use in field catalog:-


  wa_fieldcat-do_sum = 'C'.
  append wa_fieldcat to it_fieldcat.

Hope this helps you.

Regards,

Tarun

0 Kudos
64

yes Naveen I got the average.

Requrement is that we have three columns,

we got the total by do_sum = 'X' ,for first two colums and the third one is

percentage of the second in first.

ex : o/p is

5 2.5 50

10 2.5 25

-


15 5 33

how to get 33 there.

pls help me out

Thanks,

Anil.

Former Member
0 Kudos
64

Hi,

---> You can do this by ALV List display.

---> It is not possible through the ALV Grid Display.

Thanks,

Neelima.

Former Member

former_member242255
Active Contributor
0 Kudos
64

naveen_inuganti2
Active Contributor
0 Kudos
64

Hi,

Follow these steps,

1. Declare one local class, with two methods,

class lcl_event_handler definition .
  public section.
*   Event Handler for Top of page
    methods: top_of_page for event top_of_page of cl_gui_alv_grid  importing e_dyndoc_id,
             display,
  endclass.

3. Declare these Objects,

data: g_handler type ref to lcl_event_handler,
           o_dyndoc_id type ref to cl_dd_document, 
           o_html_cntrl type ref to cl_gui_html_viewer,
           go_parent_top type ref to cl_gui_container,
            go_grid type ref to cl_gui_alv_grid,

2. In the class inplimentation, impliment these two methods,

2.1: 1 st method:

class lcl_event_handler implementation.
  method top_of_page.

  call method o_dyndoc_id->add_gap
    exporting
      width = 99.   <----99th position of the top of page

  dl_text = 'Make your text'.   <----here you can concatenate any variable also
  call method o_dyndoc_id->add_text
    exporting
      text         = dl_text


   call method o_dyndoc_id->new_line.   <----to add new line in the top of page
  call method g_handler->display.  <---call the display method
 
  endmethod.

2.2: 2nd method:

method display.

*  *  Creating html control
    if o_html_cntrl is initial.
      create object o_html_cntrl
        exporting
          parent = go_parent_top.
    endif.
    call method o_dyndoc_id->merge_document.
    o_dyndoc_id->html_control = o_html_cntrl.
* Display document
    call method o_dyndoc_id->display_document
      exporting
        reuse_control      = 'X'
        parent             = go_parent_top
      exceptions
        html_display_error = 1.
    if sy-subrc ne 0.
      message i041 with 'Error in displaying top-of-page'(037)
                         space
                         space
                         space.
    endif. 
      sap_emphasis = cl_dd_area=>heading.

endmethod.     
endclass.     <-----end class implimetation.

4. before calling the method set tabel for first dsiplay,

set handler g_handler->top_of_page for go_grid.

--Naveen Inuganti