#1
|
|||
|
|||
ALV’s jerárquicos y “TOP_OF_PAGE”
Hola Compañer@s:
Cuando hago un ALV, utilizo el parámetro “TOP_OF_PAGE” de “REUSE_ALV_GRID_DISPLAY” para sacar en cabecera líneas con información que me interesa, por ejemplo título del informe y parámetros con los que ejecuto. En los ALV JERÁRQUICO, utilizo “REUSE_ALV_HIERSEQ_LIST_DISPLAY” pero esta no tiene el parámetro “TOP_OF_PAGE”, luego no se como puedo hacer lo mismo. ¿Alguien puede echarme una mano? Muchas gracias |
#2
|
|||
|
|||
Como parametro de esa funcion tenes IT_EVENTS, donde uno de los eventos es TOP_OF_PAGE.
te paso un codigo ejemplo de la subrutina FORM TABLA_EVENTOS_BUILD USING P_LT_EVENTS TYPE SLIS_T_EVENT. DATA: LS_EVENT TYPE SLIS_ALV_EVENT. * * I_LIST_TYPE para ALV DISPLAY = 0 * para ALV JERARQUICA = 1 * para ALV GRID = 2 CALL FUNCTION 'REUSE_ALV_EVENTS_GET' EXPORTING I_LIST_TYPE = 0 IMPORTING ET_EVENTS = P_LT_EVENTS. * Buscar evento TOP-OF-PAGE READ TABLE P_LT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE INTO LS_EVENT. IF SY-SUBRC = 0. * Asignar subrutina al evento TOP-OF-PAGE MOVE C_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM. APPEND LS_EVENT TO P_LT_EVENTS. ENDIF. * Buscar evento AT USER-COMMAND READ TABLE P_LT_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND INTO LS_EVENT. IF SY-SUBRC = 0. * Asignar subrutina al evento USER-COMMAND MOVE C_FORMNAME_CALLBACK_USER TO LS_EVENT-FORM. APPEND LS_EVENT TO P_LT_EVENTS. ENDIF. * Si es necesario, asignar otros eventos ENDFORM. "CONSTRUIR_TABLA_EVENTOS |
#3
|
|||
|
|||
Muchas gracias Lisandrolan.
He adaptado el código que me pasaste y no consigo que funcione. 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' me devuelve SY-SUBRC = 1 en cuanto le pongo el parámetro "it_events". Algo debo estar haciendo mal, pero no doy con ello. Te copio a ver si puedes ayudarme: DATA: p_lt_events TYPE slis_t_event. DATA: ls_event TYPE slis_alv_event. DATA: c_formname_top_of_page LIKE ls_event-form VALUE 'TOP_OF_PAGE'. CALL FUNCTION 'REUSE_ALV_EVENTS_GET' EXPORTING i_list_type = 0 IMPORTING et_events = p_lt_events. * Buscar evento TOP-OF-PAGE READ TABLE p_lt_events WITH KEY name = slis_ev_top_of_page INTO ls_event. IF sy-subrc = 0. * Asignar subrutina al evento TOP-OF-PAGE MOVE c_formname_top_of_page TO ls_event-form. APPEND ls_event TO p_lt_events. ENDIF. * FIN MAYO-2007 CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' EXPORTING is_layout = ls_layout it_fieldcat = lt_fieldcat[] it_sort = lt_sort[] i_save = 'A' is_variant = ls_variant i_tabname_header = 'GT_HEAD' i_tabname_item = 'GT_LINE' * MAYO-2007 it_events = p_lt_events * FIN MAYO-2007 is_keyinfo = ls_keyinfo TABLES t_outtab_header = gt_head[] t_outtab_item = gt_line[] EXCEPTIONS program_error = 1 OTHERS = 2. IF sy-subrc <> 0. |
#4
|
|||
|
|||
Creaste la subrutina TOP_OF_PAGE ???
|
#5
|
|||
|
|||
Si, la he copiado y pegado de un ALV normal donde funciona perfectamente:
FORM top_of_page. DATA: top_of_page TYPE slis_t_listheader WITH HEADER LINE. CLEAR top_of_page. top_of_page-typ = 'H'. top_of_page-info = 'SDFSDFSDFSDFSD'. APPEND top_of_page. CLEAR top_of_page. top_of_page-typ = 'S'. top_of_page-key = 'Variante'. top_of_page-info = p_vari. APPEND top_of_page. CLEAR top_of_page. top_of_page-typ = 'A'. APPEND top_of_page. CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING it_list_commentary = top_of_page[] * I_LOGO = * I_END_OF_LIST_GRID = . ENDFORM. Agradezco tu ayuda, un saludo. |
#6
|
|||
|
|||
fijate que en el parametro que le estas pasando a CALL FUNCTION 'REUSE_ALV_EVENTS_GET' es un 0 y deberia ser un 1
por otro lado, echale un vistazo al programa BCALV_TEST_HIERSEQ_LIST_EVENTS. quizas te pueda ser de ayuda. saludos |
#7
|
|||
|
|||
Uff, cierto debe ser 1 en vez de 0.
El programa ejemplo que me dices me parece buenísimo, lo miraré con cuidado y ya te contaré (ahora tengo cosas más urgentes). De verdad, muy agradecido. Un saludo. |
#8
|
|||
|
|||
Bueno ........ ya he conseguido que funcione. Si alguien copia el código que hemos puesto incluya tambien
"i_callback_program = g_repid" en la llamada "CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'" que era lo que faltaba y hacía que devolviese "sy-subrc = 1" De nuevo muchas gracias a Lisandrolan. |
#9
|
|||
|
|||
hola!
que tal! yo estoy tratando de hacer esto mismo, he seguido los pasos, pero no se bien donde llamar a los forms TOP_OF_PAGE y tabla_eventos_build, ojalá todavía anden por ak, para ver si me dan esta pequeña respuesta, yo por mientras sigo intentando
SALUDOS. |
Herramientas | Buscar en Tema |
Desplegado | |
|
|