Ver Mensaje Individual
  #4  
Viejo 15/11/11, 07:11:42
jtristan jtristan is offline
Senior Member
 
Fecha de Ingreso: oct 2007
Mensajes: 240
Hola,

encontré la solución en "An Easy Reference for ALV GRID CONTROL". Es fácil encontrarlo.

En el apartado sobre impresión tienes lo siguiente:

D.8. About printing
There are some events that you can utilize about printing. You simply write what is to be output in methods handling these events. Here is the list of events in this context.
print_end_of_list
Define output text to be printed at the end of the entire list
print_top_of_list
Define output text to be printed at the beginning of the entire list
print_end_of_page
Define output text to be printed at the end of each page
print_top_of_page
Define output text to be printed at the beginning of each page

To utilize one of the events above, let’s proceed with the standard procedure since we did not add this event in our general scheme at section D.1.
First add a handler method in your handler class definition as:

e.g. METHOD handle_print_top_of_list
FOR EVENT print_top_of_list OF cl_gui_alv_grid .
Then implement the method in the implementation part of your local class.
e.g. METHOD handle_print_top_of_list .
WRITE:/ 'Flights Made on ', sy-datum .
ENDMETHOD .

And register this method as the handler.
e.g.
SET HANDLER gr_event_handler->handle_print_top_of_list FOR gr_alvgrid .
The output of these events can be examined at the print preview or in the printing.

Es decir, te declaras una clase para controlar enventos.

CLASS lcl_event_receiver DEFINITION DEFERRED.
data: event_receiver type ref to lcl_event_receiver.

"Creas la definición y la implementación.

class lcl_event_receiver definition.

public section.
methods:

handle_print_top_of_list
for print_top_of_list of cl_gui_alv_grid.

private section.

endclass.

*** IMPLEMENTACIÓN ***
class lcl_event_receiver implementation.

method handle_print_top_of_list.

WRITE:/ 'Flights Made on ', sy-datum .
"aquí podrías escribir cualquier cosa que quieras a nivel de cabecera.

endmethod.

endclass.

Luego en el dynpro en el PBO ya creas el objeto

y le asignas el evento.

set handler event_receiver->handle_print_top_of_list for grid.

No sé si me he explicado muy bien.
Responder Con Cita