|
#1
|
|||
|
|||
Problema con REUSE_ALV_COMMENTARY_WRITE
Buenas noches:
Tengo el problema con REUSE_ALV_COMMENTARY_WRITE no muestra la cabecera nose cual es el problema. REPORT ZALV02. INITIALIZATION. TABLES : spfli. DATA: BEGIN OF ti_tabla OCCURS 0, " crea una variable estructura carrid LIKE spfli-carrid, cityfrom LIKE spfli-cityfrom, distance LIKE spfli-distance, END OF ti_tabla. type-POOLS : slis. DATA: wa_layout TYPE slis_layout_alv. DATA: ti_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE. "tabla, con un registro por cada campo DATA: it_listheader TYPE slis_t_listheader, wa_listheader TYPE slis_listheader. START-OF-SELECTION. PERFORM carga. PERFORM layout. PERFORM armadosalida. end-of-SELECTION. PERFORM build_alv_header. PERFORM salida. *&---------------------------------------------------------------------* *& Form CARGA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM CARGA . SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE ti_tabla. ENDFORM. " CARGA *&---------------------------------------------------------------------* *& Form ARMADOSALIDA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM ARMADOSALIDA . CLEAR ti_fieldcat. ti_fieldcat-fieldname = 'CARRID'. ti_fieldcat-tabname = 'TI_TABLA'. ti_fieldcat-seltext_m = 'CARRID'. ti_FIELDCAT-EMPHASIZE = 'C710'. ti_fieldcat-col_pos = 2. APPEND ti_fieldcat. CLEAR ti_fieldcat. ti_fieldcat-fieldname = 'CITYFROM'. ti_fieldcat-tabname = 'TI_TABLA'. ti_fieldcat-seltext_s = 'CIUDAD'. " descripcion corta ti_fieldcat-seltext_l = 'CIUDAD GRANDE'. " descripcion larga ti_fieldcat-seltext_m = 'CIUDAD MED'. " descripcion media ti_fieldcat-outputlen = 8. ti_fieldcat-col_pos = 3. APPEND ti_fieldcat. CLEAR ti_fieldcat. ti_fieldcat-fieldname = 'DISTANCE'. " NOMBRE DEL CAMPO DE LA TI ti_fieldcat-tabname = 'TI_TABLA'. " NOMBRE DE LA TABLA INTERNA ti_fieldcat-seltext_l = 'DISTANCIAA'. " NOMBRE A MOSTRAR EN EL MENU ti_fieldcat-outputlen = 20. " longitud del campo ti_fieldcat-col_pos = 1. " posicion en que columna va estar APPEND ti_fieldcat. ENDFORM. " ARMADOSALIDA *&---------------------------------------------------------------------* *& Form SALIDA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM SALIDA . CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING * I_INTERFACE_CHECK = ' ' * I_BYPASSING_BUFFER = ' ' * I_BUFFER_ACTIVE = ' ' I_CALLBACK_PROGRAM = sy-repid * I_CALLBACK_PF_STATUS_SET = ' ' * I_CALLBACK_USER_COMMAND = ' ' I_CALLBACK_TOP_OF_PAGE = 'top_of_page' * I_CALLBACK_HTML_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_END_OF_LIST = ' ' * I_STRUCTURE_NAME = * I_BACKGROUND_ID = 'IMAGEN_PRUBA' " nombre de la imagen * I_GRID_TITLE = * I_GRID_SETTINGS = IS_LAYOUT = wa_layout IT_FIELDCAT = ti_fieldcat[] " nombre de tabla alv * IT_EXCLUDING = * IT_SPECIAL_GROUPS = * IT_SORT = * IT_FILTER = * IS_SEL_HIDE = * I_DEFAULT = 'X' * I_SAVE = ' ' * IS_VARIANT = * IT_EVENTS = * IT_EVENT_EXIT = * IS_PRINT = * IS_REPREP_ID = * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE = 0 * I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_LINE = 0 * I_HTML_HEIGHT_TOP = 0 * I_HTML_HEIGHT_END = 0 * IT_ALV_GRAPHICS = * IT_HYPERLINK = * IT_ADD_FIELDCAT = * IT_EXCEPT_QINFO = * IR_SALV_FULLSCREEN_ADAPTER = * IMPORTING * E_EXIT_CAUSED_BY_CALLER = * ES_EXIT_CAUSED_BY_USER = TABLES T_OUTTAB = ti_tabla " nombre de la taba interna EXCEPTIONS PROGRAM_ERROR = 1 OTHERS = 2 . IF SY-SUBRC <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDFORM. " SALIDA *&---------------------------------------------------------------------* *& Form LAYOUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM LAYOUT . wa_layout-zebra = 'X'. wa_layout-Lights_fieldname = '2'. wa_layout-Window_titlebar = 'Reporte ALV PRUEBA'. ENDFORM. " LAYOUT *&---------------------------------------------------------------------* *& Form BUILD_ALV_HEADER *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Form BUILD_ALV_HEADER *&---------------------------------------------------------------------* FORM build_alv_header . * Type H is used to display headers i.e. big font wa_listheader-typ = 'H'. wa_listheader-info ='Flight Details'. APPEND wa_listheader TO it_listheader. CLEAR wa_listheader. * Type S is used to display key and value pairs wa_listheader-typ = 'S'. wa_listheader-key = 'Date :' . CONCATENATE sy-datum+6(2) sy-datum+4(2) sy-datum(4) INTO wa_listheader-info SEPARATED BY '/'. APPEND wa_listheader TO it_listheader. CLEAR wa_listheader. * Type A is used to display italic font wa_listheader-typ = 'A'. wa_listheader-info ='SAP ALV Report'. APPEND wa_listheader TO it_listheader. CLEAR wa_listheader. ENDFORM. " BUILD_ALV_HEADER *&---------------------------------------------------------------------* *& Form top_of_page *&---------------------------------------------------------------------* FORM top_of_page. CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING it_list_commentary = it_listheader. ENDFORM. "top_of_page |
#2
|
|||
|
|||
Buenos dias, dentro del PERFORM build_alv_header. al finalizar tenes que hacer un PERFORM top_of_page.
saludos |
#3
|
|||
|
|||
Ahora me doy cuenta, en lo que vos copiaste, que no esta el evento, por eso no te anda.
Te lo paso completo: REPORT ZALV02. INITIALIZATION. TABLES : spfli. DATA: BEGIN OF ti_tabla OCCURS 0, " crea una variable estructura carrid LIKE spfli-carrid, cityfrom LIKE spfli-cityfrom, distance LIKE spfli-distance, END OF ti_tabla. type-POOLS : slis. DATA: wa_layout TYPE slis_layout_alv. DATA: ti_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE. "tabla, con un registro por cada campo DATA: it_listheader TYPE slis_t_listheader, wa_listheader TYPE slis_listheader, gt_events TYPE slis_t_event. CONSTANTS: g_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'. START-OF-SELECTION. PERFORM carga. PERFORM layout. PERFORM armadosalida. end-of-SELECTION. PERFORM eventtab_build CHANGING gt_events[]. PERFORM build_alv_header. PERFORM salida. *&---------------------------------------------------------------------* *& Form CARGA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM CARGA . SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE ti_tabla. ENDFORM. " CARGA *&---------------------------------------------------------------------* *& Form ARMADOSALIDA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM ARMADOSALIDA . CLEAR ti_fieldcat. ti_fieldcat-fieldname = 'CARRID'. ti_fieldcat-tabname = 'TI_TABLA'. ti_fieldcat-seltext_m = 'CARRID'. ti_FIELDCAT-EMPHASIZE = 'C710'. ti_fieldcat-col_pos = 2. APPEND ti_fieldcat. CLEAR ti_fieldcat. ti_fieldcat-fieldname = 'CITYFROM'. ti_fieldcat-tabname = 'TI_TABLA'. ti_fieldcat-seltext_s = 'CIUDAD'. " descripcion corta ti_fieldcat-seltext_l = 'CIUDAD GRANDE'. " descripcion larga ti_fieldcat-seltext_m = 'CIUDAD MED'. " descripcion media ti_fieldcat-outputlen = 8. ti_fieldcat-col_pos = 3. APPEND ti_fieldcat. CLEAR ti_fieldcat. ti_fieldcat-fieldname = 'DISTANCE'. " NOMBRE DEL CAMPO DE LA TI ti_fieldcat-tabname = 'TI_TABLA'. " NOMBRE DE LA TABLA INTERNA ti_fieldcat-seltext_l = 'DISTANCIAA'. " NOMBRE A MOSTRAR EN EL MENU ti_fieldcat-outputlen = 20. " longitud del campo ti_fieldcat-col_pos = 1. " posicion en que columna va estar APPEND ti_fieldcat. ENDFORM. " ARMADOSALIDA *&---------------------------------------------------------------------* *& Form SALIDA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM SALIDA . CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING * I_INTERFACE_CHECK = ' ' * I_BYPASSING_BUFFER = ' ' * I_BUFFER_ACTIVE = ' ' I_CALLBACK_PROGRAM = sy-repid * I_CALLBACK_PF_STATUS_SET = ' ' * I_CALLBACK_USER_COMMAND = ' ' I_CALLBACK_TOP_OF_PAGE = 'top_of_page' * I_CALLBACK_HTML_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_END_OF_LIST = ' ' * I_STRUCTURE_NAME = * I_BACKGROUND_ID = 'IMAGEN_PRUBA' " nombre de la imagen * I_GRID_TITLE = * I_GRID_SETTINGS = IS_LAYOUT = wa_layout IT_FIELDCAT = ti_fieldcat[] " nombre de tabla alv * IT_EXCLUDING = * IT_SPECIAL_GROUPS = * IT_SORT = * IT_FILTER = * IS_SEL_HIDE = * I_DEFAULT = 'X' * I_SAVE = ' ' * IS_VARIANT = it_events = gt_events[] * IT_EVENT_EXIT = * IS_PRINT = * IS_REPREP_ID = * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE = 0 * I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_LINE = 0 * I_HTML_HEIGHT_TOP = 0 * I_HTML_HEIGHT_END = 0 * IT_ALV_GRAPHICS = * IT_HYPERLINK = * IT_ADD_FIELDCAT = * IT_EXCEPT_QINFO = * IR_SALV_FULLSCREEN_ADAPTER = * IMPORTING * E_EXIT_CAUSED_BY_CALLER = * ES_EXIT_CAUSED_BY_USER = TABLES T_OUTTAB = ti_tabla " nombre de la taba interna EXCEPTIONS PROGRAM_ERROR = 1 OTHERS = 2 . IF SY-SUBRC <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDFORM. " SALIDA *&---------------------------------------------------------------------* *& Form LAYOUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM LAYOUT . wa_layout-zebra = 'X'. wa_layout-Lights_fieldname = '2'. wa_layout-Window_titlebar = 'Reporte ALV PRUEBA'. ENDFORM. " LAYOUT *&---------------------------------------------------------------------* *& Form BUILD_ALV_HEADER *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Form BUILD_ALV_HEADER *&---------------------------------------------------------------------* FORM build_alv_header . * Type H is used to display headers i.e. big font wa_listheader-typ = 'H'. wa_listheader-key = ''. wa_listheader-info ='Flight Details'. APPEND wa_listheader TO it_listheader. CLEAR wa_listheader. * Type S is used to display key and value pairs wa_listheader-typ = 'S'. wa_listheader-key = 'Date :' . CONCATENATE sy-datum+6(2) sy-datum+4(2) sy-datum(4) INTO wa_listheader-info SEPARATED BY '/'. APPEND wa_listheader TO it_listheader. CLEAR wa_listheader. * Type A is used to display italic font wa_listheader-typ = 'A'. wa_listheader-key = ''. wa_listheader-info ='SAP ALV Report'. APPEND wa_listheader TO it_listheader. CLEAR wa_listheader. PERFORM top_of_page. ENDFORM. " BUILD_ALV_HEADER *&---------------------------------------------------------------------* *& Form top_of_page *&---------------------------------------------------------------------* FORM top_of_page. CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE' EXPORTING it_list_commentary = it_listheader. ENDFORM. "top_of_page FORM eventtab_build USING rt_events TYPE slis_t_event. *"Registration of events to happen during list display DATA: ls_event TYPE slis_alv_event. * CALL FUNCTION 'REUSE_ALV_EVENTS_GET' EXPORTING i_list_type = 0 IMPORTING et_events = rt_events. READ TABLE rt_events WITH KEY name = slis_ev_top_of_page INTO ls_event. IF sy-subrc = 0. MOVE g_top_of_page TO ls_event-FORM. APPEND ls_event TO rt_events. ENDIF. ENDFORM. "EVENTTAB_BUILD |
#4
|
|||
|
|||
Ya me salió pero no entiendo eso del evento que pusiste puedes pasarme algún problema sencillo y/o material sobre ese tema para poder entenderlo |
#5
|
|||
|
|||
En esta tabla ( IT_EVENTS) se especificarán ante qué eventos la respuesta será de nuestro programa y no implementado por la función. Para obtener los eventos que pueden ser codificados por el programa, es decir, aquellos para los cuales la función nos devuelve el control, basta con ejecutar la función REUSE_ALV_EVENTS_GET, importando una tabla interna en el parámetro ET_EVENTS, definida como SLIS_ALV_EVENT, estructura que viene definida en el type-pool SLIS incluido al inicio del programa. Cuando se llame a la función que va a mostrar el report se le pasará esta tabla interna con el nombre de los eventos y el nombre de la subrutina donde irán implementados dichos eventos. De todos los eventos que podemos implementar en nuestro programa, los más utilizados o los más comunes son dos: ‘Top-of-page’ y ‘At user command’. |
Herramientas | Buscar en Tema |
Desplegado | |
|
|