MUNDOSAP

MUNDOSAP (foro/index.php)
-   Programación ABAP IV (foro/forumdisplay.php?f=4)
-   -   Como colocar encabezados en ALV OO (foro/showthread.php?t=61546)

Leonel Espitia Torres 25/02/12 16:26:17

Como colocar encabezados en ALV OO
 
Buenos dias compañeros abapers:
Tengo un ALV OO, necesito colocarle como encabezado los parametros del selection-screen, por favor me pueden ayudar con un ejemplo de como hacer esto?. Tengo entendido que es por eventos, pero no tengo claro el procedimiento.
Cord. Leonel

Marlon21 28/02/12 18:00:18

Ejemplito
 
*&---------------------------------------------------------------------*
*& Clases
*&---------------------------------------------------------------------*
CLASS lcl_events DEFINITION.
PUBLIC SECTION.

METHODS:
handle_top_of_page FOR EVENT top_of_page OF cl_gui_alv_grid IMPORTING e_dyndoc_id.

ENDCLASS. "lcl_events DEFINITION


data: o_dyndoc_id TYPE REF TO cl_dd_document,
dg_html_cntrl TYPE REF TO cl_gui_html_viewer,
go_parent_top TYPE REF TO cl_gui_container.





CLASS lcl_events IMPLEMENTATION.
METHOD handle_top_of_page.
PERFORM event_top_of_page USING o_dyndoc_id.
ENDMETHOD. "handle_top_of_page
ENDCLASS. "lcl_events IMPLEMENTATION



FORM event_top_of_page USING dg_dyndoc_id TYPE REF TO cl_dd_document.

DATA : dl_text(255) TYPE c,
dl_text2(255) TYPE c. "Text

* CALL METHOD dg_dyndoc_id->add_text
* EXPORTING
* text = 'PEDIDO NOTA CREDITO'
* sap_style = 'HEADING'.
*
*CALL METHOD dg_dyndoc_id->new_line.

CALL METHOD dg_dyndoc_id->add_text
EXPORTING
text = 'Organización de Ventas'
sap_emphasis = 'Strong'.

CALL METHOD dg_dyndoc_id->add_gap
EXPORTING
width = 2.

dl_text = p_vkorg.

CALL METHOD dg_dyndoc_id->add_text
EXPORTING
text = dl_text
sap_emphasis = 'Strong'.

CALL METHOD dg_dyndoc_id->new_line.

CALL METHOD dg_dyndoc_id->add_text
EXPORTING
text = 'Canal de Distribución'
sap_emphasis = 'Strong'.

CALL METHOD dg_dyndoc_id->add_gap
EXPORTING
width = 7.

dl_text = p_vtweg.

CALL METHOD dg_dyndoc_id->add_text
EXPORTING
text = dl_text
sap_emphasis = 'Strong'.


CALL METHOD dg_dyndoc_id->new_line.

CALL METHOD dg_dyndoc_id->add_text
EXPORTING
text = 'Sector'
sap_emphasis = 'Strong'.

CALL METHOD dg_dyndoc_id->add_gap
EXPORTING
width = 34.

dl_text = p_spart.

CALL METHOD dg_dyndoc_id->add_text
EXPORTING
text = dl_text
sap_emphasis = 'Strong'.

CALL METHOD dg_dyndoc_id->new_line.

CALL METHOD dg_dyndoc_id->add_text
EXPORTING
text = 'Oficina Ventas'
sap_emphasis = 'Strong'.

CALL METHOD dg_dyndoc_id->add_gap
EXPORTING
width = 19.

dl_text = p_vkbur.

CALL METHOD dg_dyndoc_id->add_text
EXPORTING
text = dl_text
sap_emphasis = 'Strong'.

PERFORM display.

ENDFORM. " EVENT_TOP_OF_PAGE

*&---------------------------------------------------------------------*
*& Form DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display .

IF dg_html_cntrl IS INITIAL.
CREATE OBJECT dg_html_cntrl
EXPORTING
parent = go_parent_top.
ENDIF.
CALL METHOD o_dyndoc_id->merge_document.
o_dyndoc_id->html_control = dg_html_cntrl.
* Display document
CALL METHOD o_dyndoc_id->display_document
EXPORTING
reuse_control = 'X'
parent = go_parent_top
EXCEPTIONS
html_display_error = 1.
ENDFORM. " DISPLAY



*Aqui se llama al ALV

MODULE act_data OUTPUT.


IF go_custom_container IS INITIAL.
CREATE OBJECT go_custom_container
EXPORTING
container_name = gv_container.

ENDIF.

*Top of Page
CREATE OBJECT o_dyndoc_id
EXPORTING
style = 'ALV_GRID'.

IF go_grid_data IS INITIAL.
CREATE OBJECT go_splitter
EXPORTING
parent = go_custom_container
rows = 2
columns = 1.

CALL METHOD go_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = go_parent_grid.

CREATE OBJECT go_grid_data
EXPORTING
i_parent = go_parent_grid.

*Top of Page
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_parent_top.

*Tamaño top of page
CALL METHOD go_splitter->set_row_height
EXPORTING
id = 1
height = 16.

CREATE OBJECT go_event_receiver.
SET HANDLER go_event_receiver->handle_double_click FOR go_grid_data.
SET HANDLER go_event_receiver->handle_data_changed FOR go_grid_data.
SET HANDLER go_event_receiver->handle_top_of_page FOR go_grid_data.

*Excluir Botonera del ALV
PERFORM exclude_button.

*Para desabilitar el campo editable
lv_color-stylefname = 'FIELD_STYLE'.

*Color a Fila
lv_color-info_fname = 'COLOR'.

wa_disvar_rcr-report = sy-repid.

CALL METHOD go_grid_data->set_table_for_first_display
EXPORTING
is_variant = wa_disvar_rcr
i_save = 'A'
i_default = 'A'
it_toolbar_excluding = gt_exclude
is_layout = lv_color
CHANGING
it_fieldcatalog = gt_fieldcat
it_outtab = gt_data[].


CALL METHOD go_grid_data->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.

CALL METHOD go_grid_data->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified
EXCEPTIONS
OTHERS = 2.


CALL METHOD o_dyndoc_id->initialize_document
EXPORTING
background_color = cl_dd_area=>col_textarea.

CALL METHOD go_grid_data->list_processing_events
EXPORTING
i_event_name = 'TOP_OF_PAGE'
i_dyndoc_id = o_dyndoc_id.

lucia7272 08/08/12 17:09:08



Hola! yo necesito hacer un encabezado para mi alv, todo lo manejo desde una clase en el edit_top_of_page me dijeron que debia concatenar estos campos que acontinuación muestro

Sociedad: T001-BUKRS – T001- BUTXT
Fecha de Contabilizacion: BKPF-BUDAT
Usuario: SY- UNAME
Fecha y Hora de ejecución: SY- DATUM SY- UZEIT
y que los metiera en una variable tipo string y luego hiciera un append pero la verdad no tengo ni idea de como hacerlo :confused:


Husos Horarios son GMT. La hora en este momento es 13:52:49.

www.mundosap.com 2006 - Spain
software crm, crm on demand, software call center, crm act, crm solutions, crm gratis, crm web