Mis primeras lineas de un ALV

Colapsar
X
 
  • Tiempo
  • Mostrar
Limpiar Todo
nuevos mensajes
  • Dany24
    Junior Member
    • abr
    • 10

    #1

    Mis primeras lineas de un ALV

    Hola, gracias por el apoyo esta algo complicado, pero nada imposible... estuve haciendo un ALV con ayuda de una buena persona de aqui mas o menos me guie... y llevo esto, ojala me puedan decir donde esta el error solo es mostrar los datos... gracias y linda semana a todos:

    *&---------------------------------------------------------------------*
    *& Report Z_REPORT
    *&
    *&---------------------------------------------------------------------*
    *&
    *&
    *&---------------------------------------------------------------------*

    report z_report.

    include z_report_top.
    include z_report_rut.

    start-of-selection.
    perform selecciona_informacion.
    if z_report[] is not initial.
    perform report.
    else.
    endif.


    *&---------------------------------------------------------------------*
    *& Include Z_REPORT_TOP
    *&--------------------------------------------------------------------*

    TYPE-POOLS: slis.

    form genera_titulos .

    data: I_fieldcat type slis_fieldcat_vbrk.
    data w_fieldcat like line of I_fieldcat.

    TABLES: vbrk.

    TYPES: BEGIN OF report,
    vbeln TYPE vbeln,
    fkart TYPE fkart,
    fktyp TYPE fktyp,
    vbtyp TYPE vbtyp,
    waers TYPE waerk,
    vkorg type vkorg,
    vtweg type vtweg,
    kalsm type kalms,
    knumv type knumv,
    vsbed type vsbed.
    types end of report.
    data it_report type standard table of t_report.
    data w_report like line of it_report.

    data vbrk like line of vbrk.

    *&---------------------------------------------------------------------*
    *& Include Z_REPORT_RUT
    *&---------------------------------------------------------------------*
    form procesa.
    select VBELN FKART FKTYP VBTYP WAERK VKORG VTWEG KALSM KNUMV VSBED
    into table vbkr
    from z_report.
    endform.


    Form report.
    data: l_fieldcat type slis_fieldcat_alv.
    data w_fieldcat like line of i_fieldcat.

    loop at i_fieldcat into w_fieldcat.
    case w_fieldcat-fieldname.

    when 'VBELN'.
    w_fieldcat-reptext_ddic = 'FACTURA'.
    when 'FKART'.
    w_fieldcat-reptext_ddic = 'CLASE FACTURA'.
    when 'FKTYP'.
    w_fieldcat-reptext_ddic = 'TIPO FACTURA'.
    when 'VBTYP'.
    w_fieldcat-reptext_ddic = 'TIPO DOC.COM.'.
    when 'WAERK'.
    w_fieldcat-reptext_ddic = 'MONEDA DOC.'.
    when 'VKORG'.
    w_fieldcat-reptext_ddic = 'ORGANIZ.VENTAS'.
    when 'VTWEG'.
    w_fieldcat-reptext_ddic = 'CANAL DISTRIB.'.
    when 'KALSM'.
    w_fieldcat-reptext_ddic = 'ESQUEMA CALCULO'.
    when 'KNUMV'.
    w_fieldcat-reptext_ddic = 'CONDICION DOC'.
    when 'VSBED'.
    w_fieldcat-reptext_ddic = 'CONDIC.EXPED.'.

    ENDCASE.

    modify i_fieldcat from w_fieldcat.
    endloop.

    Ah i me manda un error en esta parte... I_fieldcat
    Editado por última vez por Dany24; 24/04/2012, 22:01:35.
  • Dany24
    Junior Member
    • abr
    • 10

    #2
    Si alguien me pudiera explicar si esta bien lo que hice o esta mal se los agradeceria chicos, jejejeje gracias... quiero ver si entendi y porque me sale ese mensaje de error en i_fielcat... :P

    Comentario

    • hugoa77
      Senior Member
      • may
      • 130

      #3
      la verdad que veo varios problemas en el código (a mi parecer...)
      cual es el mensaje de error que te da? copialo completo para poder ayudarte...
      slds,

      Comentario

      • Conchis
        Junior Member
        • may
        • 4

        #4
        Hola,

        Este es parte de código que utilizo y a mi me funciona.

        TYPE-POOLS: slis.

        DATA : gt_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
        gs_layout TYPE slis_layout_alv.

        gt_fieldcat-fieldname = 'VBELN'.
        gt_fieldcat-ref_fieldname = 'VBELN'.
        gt_fieldcat-reptext_ddic = 'FACTURA'.
        gt_fieldcat-seltext_l = 'FACTURA'.
        gt_fieldcat-seltext_m = 'FACTURA'.
        gt_fieldcat-seltext_s = 'FACTURA'.
        gt_fieldcat-ddictxt(1) = 'L'.
        gt_fieldcat-ref_tabname = 'VBRK'.
        APPEND gt_fieldcat .
        CLEAR gt_fieldcat.

        Saludos.
        Conchis

        Comentario

        • Dany24
          Junior Member
          • abr
          • 10

          #5
          Hola...

          Originalmente publicado por hugoa77
          la verdad que veo varios problemas en el código (a mi parecer...)
          cual es el mensaje de error que te da? copialo completo para poder ayudarte...
          slds,
          Hola Hugito, mira le doy guardar y luego activar y me manda error y dice
          Error en sintaxis
          Descripción Linea Clase
          Include Z_REPORT_TOP 10 (botón rojo)
          "I_FIELDCAT" is not an internal table
          Include Z_REPORT_TOP 7 (BOTÓN AMARILLO)
          There should only be definitions in the TOP include (or nested includes
          within it). This means that all kinds of implementation (CLASS...
          IMPLEMENTATION, not meaningful. is not meaningful.

          *&---------------------------------------------------------------------*
          *& Report Z_REPORT
          *&
          *&---------------------------------------------------------------------*
          *&
          *&
          *&---------------------------------------------------------------------*

          report z_report.

          include z_report_top.
          include z_report_rut.

          start-of-selection.
          perform selecciona_informacion.
          if z_report[] is not initial.
          perform report.
          else.
          endif.

          Comentario

          • Dany24
            Junior Member
            • abr
            • 10

            #6
            Originalmente publicado por Conchis
            Hola,

            Este es parte de código que utilizo y a mi me funciona.

            TYPE-POOLS: slis.

            DATA : gt_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
            gs_layout TYPE slis_layout_alv.

            gt_fieldcat-fieldname = 'VBELN'.
            gt_fieldcat-ref_fieldname = 'VBELN'.
            gt_fieldcat-reptext_ddic = 'FACTURA'.
            gt_fieldcat-seltext_l = 'FACTURA'.
            gt_fieldcat-seltext_m = 'FACTURA'.
            gt_fieldcat-seltext_s = 'FACTURA'.
            gt_fieldcat-ddictxt(1) = 'L'.
            gt_fieldcat-ref_tabname = 'VBRK'.
            APPEND gt_fieldcat .
            CLEAR gt_fieldcat.

            Saludos.
            Hola si como le comentaba a Hugo, le doy en guardar y luego activar pero me sale error y bueno es una prueba pero me guié con el ejemplo que me mandaste y de otros programas de los consultores, pero son woow mounstruos de programas... me refiero que los admiro woow tanto codigo ojala pronto pueda estar haciendo algo como ustedes... el mensaje es este...


            Error en sintaxis
            Descripción Linea Clase
            Include Z_REPORT_TOP 10 (botón rojo)
            "I_FIELDCAT" is not an internal table
            Include Z_REPORT_TOP 7 (BOTÓN AMARILLO)
            There should only be definitions in the TOP include (or nested includes
            within it). This means that all kinds of implementation (CLASS...
            IMPLEMENTATION, not meaningful. is not meaningful.

            *&---------------------------------------------------------------------*
            *& Report Z_REPORT
            *&
            *&---------------------------------------------------------------------*
            *&
            *&
            *&---------------------------------------------------------------------*

            report z_report.

            include z_report_top.
            include z_report_rut.

            start-of-selection.
            perform selecciona_informacion.
            if z_report[] is not initial.
            perform report.
            else.
            endif.

            Comentario

            • Mauricio Hidalgo
              Senior Member
              • may
              • 481

              #7
              Respecto del mensaje original.

              Tienes declarado l_fieldcat como

              data: l_fieldcat type slis_fieldcat_alv

              deberia ser

              data: l_fieldcat type table of slis_fieldcat_alv

              Saludos

              Comentario

              • Dany24
                Junior Member
                • abr
                • 10

                #8
                Gracias

                Originalmente publicado por Mauricio Hidalgo
                Respecto del mensaje original.

                Tienes declarado l_fieldcat como

                data: l_fieldcat type slis_fieldcat_alv

                deberia ser

                data: l_fieldcat type table of slis_fieldcat_alv

                Saludos
                Gracias que amable eres Mau... lo checo... lindo dia.

                Comentario

                • hugoa77
                  Senior Member
                  • may
                  • 130

                  #9
                  hasta lo que escribiste ahora... tu codigo deberia quedar mas o menos asi...
                  REPORT YTEST.
                  include ytest_top.
                  include ytest_rut.

                  start-of-selection.
                  perform procesa.
                  perform report .
                  if it_report is not initial.
                  perform report.
                  else.
                  endif.

                  *&---------------------------------------------------------------------*
                  *& Include YTEST_TOP
                  *&---------------------------------------------------------------------*
                  TYPE-POOLS: slis.

                  *form genera_titulos .

                  data: I_fieldcat type slis_t_fieldcat_alv WITH HEADER LINE.
                  data w_fieldcat like line of I_fieldcat.

                  TABLES: vbrk.

                  TYPES: BEGIN OF t_report,
                  vbeln TYPE vbeln,
                  fkart TYPE fkart,
                  fktyp TYPE fktyp,
                  vbtyp TYPE vbtyp,
                  waers TYPE waerk,
                  vkorg type vkorg,
                  vtweg type vtweg,
                  kalsm type kalsm,
                  knumv type knumv,
                  vsbed type vsbed.
                  types end of t_report.
                  data it_report type standard table of t_report.
                  data w_report like line of it_report.

                  *data vbrk like line of vbrk.

                  *&---------------------------------------------------------------------*
                  *& Include YTEST_RUT
                  *&---------------------------------------------------------------------*
                  form procesa.
                  select VBELN FKART FKTYP VBTYP WAERK VKORG VTWEG KALSM KNUMV VSBED
                  from vbrk
                  into table it_report.
                  endform.


                  Form report.
                  data: l_fieldcat type slis_fieldcat_alv.
                  data w_fieldcat like line of i_fieldcat.

                  loop at i_fieldcat into w_fieldcat.
                  case w_fieldcat-fieldname.

                  when 'VBELN'.
                  w_fieldcat-reptext_ddic = 'FACTURA'.
                  when 'FKART'.
                  w_fieldcat-reptext_ddic = 'CLASE FACTURA'.
                  when 'FKTYP'.
                  w_fieldcat-reptext_ddic = 'TIPO FACTURA'.
                  when 'VBTYP'.
                  w_fieldcat-reptext_ddic = 'TIPO DOC.COM.'.
                  when 'WAERK'.
                  w_fieldcat-reptext_ddic = 'MONEDA DOC.'.
                  when 'VKORG'.
                  w_fieldcat-reptext_ddic = 'ORGANIZ.VENTAS'.
                  when 'VTWEG'.
                  w_fieldcat-reptext_ddic = 'CANAL DISTRIB.'.
                  when 'KALSM'.
                  w_fieldcat-reptext_ddic = 'ESQUEMA CALCULO'.
                  when 'KNUMV'.
                  w_fieldcat-reptext_ddic = 'CONDICION DOC'.
                  when 'VSBED'.
                  w_fieldcat-reptext_ddic = 'CONDIC.EXPED.'.

                  ENDCASE.

                  modify i_fieldcat from w_fieldcat.
                  endloop.
                  ENDFORM.

                  donde armas el catologo del ALV tendrias que tener mas o menos esta estructura:
                  i_fieldcat-seltext_l = ''. nombre del campo
                  i_fieldcat-fieldname = ''. campo de tu tabla interna "it_report"
                  i_fieldcat-outputlen = ''. opcional
                  i_fieldcat-just = ''. opcional
                  i_fieldcat-tabname = ''. tabla interna. en tu caso "it_report"
                  append i_fieldcat. clear i_fieldcat.

                  esto haces por cada campo que quieras mostrar en el ALV.

                  bueno... espero te sirva..
                  fijate que comente algunas lineas en otras cambie algunos datos de lugar y esas cosas... compara el tu codigo con el que te envío para que puedas ver las diferencias y saber lo que estaba mal...
                  slds

                  Comentario

                  • Dany24
                    Junior Member
                    • abr
                    • 10

                    #10
                    :d

                    Gracias que lindo eres y que amable por ayudarme... lo checare en este momento...

                    Comentario

                    • Dany24
                      Junior Member
                      • abr
                      • 10

                      #11
                      Saludos

                      Originalmente publicado por hugoa77
                      hasta lo que escribiste ahora... tu codigo deberia quedar mas o menos asi...
                      REPORT YTEST.
                      include ytest_top.
                      include ytest_rut.

                      start-of-selection.
                      perform procesa.
                      perform report .
                      if it_report is not initial.
                      perform report.
                      else.
                      endif.

                      *&---------------------------------------------------------------------*
                      *& Include YTEST_TOP
                      *&---------------------------------------------------------------------*
                      TYPE-POOLS: slis.

                      *form genera_titulos .

                      data: I_fieldcat type slis_t_fieldcat_alv WITH HEADER LINE.
                      data w_fieldcat like line of I_fieldcat.

                      TABLES: vbrk.

                      TYPES: BEGIN OF t_report,
                      vbeln TYPE vbeln,
                      fkart TYPE fkart,
                      fktyp TYPE fktyp,
                      vbtyp TYPE vbtyp,
                      waers TYPE waerk,
                      vkorg type vkorg,
                      vtweg type vtweg,
                      kalsm type kalsm,
                      knumv type knumv,
                      vsbed type vsbed.
                      types end of t_report.
                      data it_report type standard table of t_report.
                      data w_report like line of it_report.

                      *data vbrk like line of vbrk.

                      *&---------------------------------------------------------------------*
                      *& Include YTEST_RUT
                      *&---------------------------------------------------------------------*
                      form procesa.
                      select VBELN FKART FKTYP VBTYP WAERK VKORG VTWEG KALSM KNUMV VSBED
                      from vbrk
                      into table it_report.
                      endform.


                      Form report.
                      data: l_fieldcat type slis_fieldcat_alv.
                      data w_fieldcat like line of i_fieldcat.

                      loop at i_fieldcat into w_fieldcat.
                      case w_fieldcat-fieldname.

                      when 'VBELN'.
                      w_fieldcat-reptext_ddic = 'FACTURA'.
                      when 'FKART'.
                      w_fieldcat-reptext_ddic = 'CLASE FACTURA'.
                      when 'FKTYP'.
                      w_fieldcat-reptext_ddic = 'TIPO FACTURA'.
                      when 'VBTYP'.
                      w_fieldcat-reptext_ddic = 'TIPO DOC.COM.'.
                      when 'WAERK'.
                      w_fieldcat-reptext_ddic = 'MONEDA DOC.'.
                      when 'VKORG'.
                      w_fieldcat-reptext_ddic = 'ORGANIZ.VENTAS'.
                      when 'VTWEG'.
                      w_fieldcat-reptext_ddic = 'CANAL DISTRIB.'.
                      when 'KALSM'.
                      w_fieldcat-reptext_ddic = 'ESQUEMA CALCULO'.
                      when 'KNUMV'.
                      w_fieldcat-reptext_ddic = 'CONDICION DOC'.
                      when 'VSBED'.
                      w_fieldcat-reptext_ddic = 'CONDIC.EXPED.'.

                      ENDCASE.

                      modify i_fieldcat from w_fieldcat.
                      endloop.
                      ENDFORM.

                      donde armas el catologo del ALV tendrias que tener mas o menos esta estructura:
                      i_fieldcat-seltext_l = ''. nombre del campo
                      i_fieldcat-fieldname = ''. campo de tu tabla interna "it_report"
                      i_fieldcat-outputlen = ''. opcional
                      i_fieldcat-just = ''. opcional
                      i_fieldcat-tabname = ''. tabla interna. en tu caso "it_report"
                      append i_fieldcat. clear i_fieldcat.

                      esto haces por cada campo que quieras mostrar en el ALV.

                      bueno... espero te sirva..
                      fijate que comente algunas lineas en otras cambie algunos datos de lugar y esas cosas... compara el tu codigo con el que te envío para que puedas ver las diferencias y saber lo que estaba mal...
                      slds

                      Hola Hugito, perdón por tanta lata, compare tu código contra el mio y siii tenias razón... si habian muchas diferencias, jajajaja bastantes, pero aun asi me sigue saliendo el mensaje ese de error en linea 7 dice:

                      Error sintaxis
                      Descripción
                      Include Z_REPORT_TOP
                      "I_FIELDCAT" is not an internal table.

                      Comentario

                      Trabajando...