Anuncio

Colapsar
No hay anuncio todavía.

Cabecera en ALV

Colapsar
X
 
  • Filtrar
  • Tiempo
  • Mostrar
Limpiar Todo
nuevos mensajes

  • Cabecera en ALV

    Alguien podría ayudarme con como poner una cabecera en el ALV?

    hasta ahora hice esto pero la cabecera me aparece en blanco, porque puede ser?
    Código:
    perform alv_events.
    
    * Función ALV
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program     = vl_repid
          is_layout              = w_layout
    *      i_callback_top_of_page = 'FRM_TOP_OF_PAGE'
          it_fieldcat            = t_fieldcat[]
    *      i_default              = 'X'
          i_save                 = 'A'
          is_variant             = w_variant
          it_events              = gt_events        "Añado los eventos al ALV
        TABLES
          t_outtab               = it_bsik[]
        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.
    
    FORM alv_events.
      DATA: ls_event TYPE slis_alv_event.
    
      CLEAR gt_events.
      REFRESH gt_events.
    
      CLEAR ls_event.
      ls_event-name = slis_ev_top_of_page.     "Evento de principio de pagina
      ls_event-form = 'FRM_TOP_OF_PAGE'.       "Subrutina que muestra la cab.
      APPEND ls_event TO gt_events.            "Lo añado a la variable global
    
    
    ENDFORM.                    "alv_events
    
    FORM frm_top_of_page.
    
      DATA: header TYPE slis_t_listheader,
         wa TYPE slis_listheader,
         vl_fecha(10) TYPE c,
         vl_hora(8) TYPE c.
    
    * Formatear fecha y hora
      WRITE sy-datum TO vl_fecha.
      WRITE sy-uzeit TO vl_hora.
    
    * Datos de cabecera
      wa-typ = 'H'.
      wa-info = 'Retenciones'.
      APPEND wa TO header.
      wa-typ = 'S'.
      wa-key  = 'Fecha de Ejecución:'.
      wa-info = vl_fecha.
      APPEND wa TO header.
      wa-typ = 'S'.
      wa-key  = 'Hora de Ejecución:'.
      wa-info = vl_hora.
      APPEND wa TO header.
      wa-typ = 'S'.
      wa-key  = 'Usuario:'.
      wa-info = sy-uname.
      APPEND wa TO header.
    
    
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = header.
    *      i_logo             = 'ZLOGO'.

  • #2
    Originalmente publicado por rulo Ver Mensaje
    Alguien podría ayudarme con como poner una cabecera en el ALV?

    hasta ahora hice esto pero la cabecera me aparece en blanco, porque puede ser?
    Código:
    perform alv_events.
    
    * Función ALV
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program     = vl_repid
          is_layout              = w_layout
    *      i_callback_top_of_page = 'FRM_TOP_OF_PAGE'
          it_fieldcat            = t_fieldcat[]
    *      i_default              = 'X'
          i_save                 = 'A'
          is_variant             = w_variant
          it_events              = gt_events        "Añado los eventos al ALV
        TABLES
          t_outtab               = it_bsik[]
        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.
    
    FORM alv_events.
      DATA: ls_event TYPE slis_alv_event.
    
      CLEAR gt_events.
      REFRESH gt_events.
    
      CLEAR ls_event.
      ls_event-name = slis_ev_top_of_page.     "Evento de principio de pagina
      ls_event-form = 'FRM_TOP_OF_PAGE'.       "Subrutina que muestra la cab.
      APPEND ls_event TO gt_events.            "Lo añado a la variable global
    
    
    ENDFORM.                    "alv_events
    
    FORM frm_top_of_page.
    
      DATA: header TYPE slis_t_listheader,
         wa TYPE slis_listheader,
         vl_fecha(10) TYPE c,
         vl_hora(8) TYPE c.
    
    * Formatear fecha y hora
      WRITE sy-datum TO vl_fecha.
      WRITE sy-uzeit TO vl_hora.
    
    * Datos de cabecera
      wa-typ = 'H'.
      wa-info = 'Retenciones'.
      APPEND wa TO header.
      wa-typ = 'S'.
      wa-key  = 'Fecha de Ejecución:'.
      wa-info = vl_fecha.
      APPEND wa TO header.
      wa-typ = 'S'.
      wa-key  = 'Hora de Ejecución:'.
      wa-info = vl_hora.
      APPEND wa TO header.
      wa-typ = 'S'.
      wa-key  = 'Usuario:'.
      wa-info = sy-uname.
      APPEND wa TO header.
    
    
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = header.
    *      i_logo             = 'ZLOGO'.

    Pues en principio parece todo correcto....

    Pon un break en el código don de creas la cabecera a ver si pasa por ahí.
    "Soy el señor Lobo, arreglo problemas"
    http://sapymas.blogspot.com/

    Comentario


    • #3
      Hola,

      Si lo que quieres es que te salga el TOP_OF_PAGE porque no pruebas a pasarle el nombre de tu ruitna a la funcion por el parametro correspondiente (lo que tienes comentado).

      ¿ Pasa por la rutina para recuperar los eventos? no sé puede q ese sea el problema. Debuguea como te dicen arriba para comprobarlo.

      Un saludo y suerte,

      Comentario


      • #4
        Originalmente publicado por ArturoGR Ver Mensaje
        Hola,

        Si lo que quieres es que te salga el TOP_OF_PAGE porque no pruebas a pasarle el nombre de tu ruitna a la funcion por el parametro correspondiente (lo que tienes comentado).

        ¿ Pasa por la rutina para recuperar los eventos? no sé puede q ese sea el problema. Debuguea como te dicen arriba para comprobarlo.

        Un saludo y suerte,
        Arturo tiene razón, si no quitas el comentario no puede mostrarte el top_of_page.
        "Soy el señor Lobo, arreglo problemas"
        http://sapymas.blogspot.com/

        Comentario


        • #5
          Podes checar este fragmento de codigo te servira ..
          *************************************************
          *&---------------------------------------------------------------------*
          *& Form call_alv
          *&---------------------------------------------------------------------*
          * Mostrando el reporte en ALV
          *----------------------------------------------------------------------*
          form call_alv.

          call function 'REUSE_ALV_GRID_DISPLAY'
          exporting
          i_callback_program = gs_repid
          * i_callback_pf_status_set = gc_status
          i_callback_user_command = gc_usrcmd
          is_layout = gs_layout
          it_fieldcat = gtd_fieldcat[]
          i_save = gs_save
          is_variant = gs_variant
          it_events = gt_events[]
          is_print = gs_print
          tables
          t_outtab = ti_repo
          exceptions
          program_error = 1
          others = 2.

          if sy-subrc <> 0.
          message e301.
          endif.

          endform. " call_alv

          *&--------------------------------------------------------------------*
          *& Form top_of_page
          *&--------------------------------------------------------------------*
          * Titulo de cabecera en ALV
          *---------------------------------------------------------------------*
          form top_of_page.

          data: ltd_report_header type slis_t_listheader,
          lwa_line type line of slis_t_listheader.

          data: help_time(8) type c.

          * Título principal
          clear ls_titulo.
          ls_titulo = 'Libro Caja y Bancos - Movimientos de la Cuenta Corriente'.
          lwa_line-typ = 'H' .
          move ls_titulo to lwa_line-info .
          append lwa_line to ltd_report_header.
          clear lwa_line.

          * Fecha y hora
          write sy-timlo to help_time using edit mask '__:__:__'.

          lwa_line-typ = 'S' .
          lwa_line-key = 'Fecha'.

          concatenate sy-datum+6(2) '.'
          sy-datum+4(2) '.'
          sy-datum(4) '/'
          help_time into lwa_line-info.
          append lwa_line to ltd_report_header.
          clear lwa_line.

          * Periodo elegido en pantalla de selección
          lwa_line-typ = 'S'.
          lwa_line-key = text-t08.
          concatenate p_monat '/' p_gjahr
          into lwa_line-info separated by space.
          append lwa_line to ltd_report_header.
          clear lwa_line.

          * RUC de la sociedad elegida
          lwa_line-typ = 'S' .
          lwa_line-key = text-t09.
          concatenate c_ruc ' ' into lwa_line-info separated by space.
          append lwa_line to ltd_report_header.
          clear lwa_line.

          * Nombre de la sociedad elegida
          lwa_line-typ = 'S' .
          lwa_line-key = text-t07.
          concatenate c_nom ' ' into lwa_line-info separated by space.
          append lwa_line to ltd_report_header.
          clear lwa_line.

          call function 'REUSE_ALV_COMMENTARY_WRITE'
          exporting
          it_list_commentary = ltd_report_header
          i_logo = 'LOGO_FER_PRINCIPAL'.

          endform. "top_of_page

          ************************************************** ***

          si no entiendes me pasas tu correo y te envio todo el codigo

          Saludos...........
          ________________
          Percy Flores Sotelo
          Consultor SAP / ABAP
          www.bizpartner.biz
          BizPartner - Perú
          511-988990501
          511-997334876

          ---
          Serás del tamaño de tus pensamientos, no te permitas fracasar.

          Comentario


          • #6
            TOP_OF_PAGE en ALV Grid OO

            Estoy teniendo el mismo problema, pero en ALV Grid OO

            He estado revisando el evento TOP_OF_PAGE y también el evento PRINT_TOP_OF_PAGE de la clase CL_GUI_ALV_GRID.

            Los he registrado como cualquier otro evento, pero no logro capturarlo.

            Cuando se utiliza la funcion REUSE_ALV_GRID_DISPLAY no hay problema porque directamente indico el nombre del form que se ejecuta para mostrar la cabecera en HTML.
            Alguien sabe hacer la misma operación con objetos...

            Gracias anticipadas...
            Miguel Ángel Garcés Ramírez

            Comentario


            • #7
              Originalmente publicado por mgarces Ver Mensaje
              Estoy teniendo el mismo problema, pero en ALV Grid OO

              He estado revisando el evento TOP_OF_PAGE y también el evento PRINT_TOP_OF_PAGE de la clase CL_GUI_ALV_GRID.

              Los he registrado como cualquier otro evento, pero no logro capturarlo.

              Cuando se utiliza la funcion REUSE_ALV_GRID_DISPLAY no hay problema porque directamente indico el nombre del form que se ejecuta para mostrar la cabecera en HTML.
              Alguien sabe hacer la misma operación con objetos...

              Gracias anticipadas...
              Ya pude resolver el problema del TOP_OF_PAGE en el ALV Grid OO...
              Para los que estén interesados, la solución está en el sgte.código.

              PERFORM set_layout CHANGING gs_layout . " Seteo del Layout

              FORM SET_LAYOUT CHANGING PS_LAYOUT TYPE lvc_s_layo.
              ps_layout-grid_title = 'TUTITULO' . " Aqui colocas tu titulo
              ENDFORM. " SET_LAYOUT

              y al momento de hacer la llamada al ALV OO se lo pasas...
              CALL METHOD gr_alvgrid->set_table_for_first_display
              EXPORTING
              is_layout = gs_layout

              Saludos...
              Editado por última vez por koken; 02/03/2013, 17:47:18.
              Miguel Ángel Garcés Ramírez

              Comentario

              Trabajando...
              X