Anuncio

Colapsar
No hay anuncio todavía.

error: stamente is not accessible

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

  • error: stamente is not accessible

    Hola buenas estoy haciendo unas pruebas para iniciarme en este mundo de abap y resulta que me dice este error de stament is not accesible en las lineas de que he subrayado en negrita y no se cual puede ser el problema , alguna ayuda gracias


    DATA: IT_SFLIGHT TYPE TABLE OF SFLIGHT,
    HE_SFILGHT LIKE LINE OF it_sflight.

    DATA: IT_TABLA TYPE LVC_T_FCAT,
    HE_TABLA LIKE LINE OF IT_TABLA.

    DATA: CONTENEDOR TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
    ALV TYPE REF TO CL_GUI_ALV_GRID.

    * ESTO MEJORA LA ESTETICA DE LA TABLA

    DATA: LAYOUT TYPE LVC_S_LAYO.

    *CREAMOS LOS OBJETOS

    create object contenedor
    exporting
    container_name = 'CONTENEDOR DE TABLAS'.
    * style =
    * lifetime = lifetime_default
    * repid =
    * dynnr =
    * no_autodef_progid_dynnr =
    * exceptions
    * cntl_error = 1
    * cntl_system_error = 2
    * create_error = 3
    * lifetime_error = 4
    * lifetime_dynpro_dynpro_link = 5
    * others = 6


    create object alvexporting* i_shellstyle = 0
    * i_lifetime =
    i_parent = CONTENEDOR.

    LAYOUT-ZEBRA = 'X'.LAYOUT-SEL_MODE = 'C'.
    *CARGAMOS LAS TABLAS CON LOS CAMPOS DESEADOS

    HE_TABLA-FIELDNAME = 'CARRID'.HE_TABLA-REF_TABLE = 'SFLIGHT'.APPEND HE_TABLA TO IT_TABLA.
    CLEAR HE_TABLA.

    HE_TABLA-FIELDNAME = 'CONNID'.
    HE_TABLA-REF_TABLE = 'SFLIGHT'.
    APPEND HE_TABLA TO IT_TABLA.
    CLEAR HE_TABLA.

    HE_TABLA-FIELDNAME = 'FLDATE'.
    HE_TABLA-REF_TABLE = 'SFLIGHT'.
    APPEND HE_TABLE TO IT_TABLA.
    CLEAR HE_TABLA.

    HE_TABLA-FIELDNAME = 'PRICE'.
    HE_TABLA-REF_TABLE = 'SFLIGHT'.
    APPEND HE_TABLE TO IT_TABLA.
    CLEAR HE_TABLA.

    HE_TABLA-FIELDNAME = 'CURRENCY'.
    HE_TABLA-REF_TABLE = 'SFLIGHT'.
    ÀPPEND HE_TABLE TO IT_TABLA.
    CLEAR HE_TABLA.

    SELECT * FROM SFLIGHT INTO TABLE IT_SFLIGHT.

    call method alv->set_table_for_first_display
    * exporting
    * i_buffer_active =
    * i_bypassing_buffer =
    * i_consistency_check =
    * i_structure_name =
    * is_variant =
    * i_save =
    * i_default = 'X'
    * is_layout =
    * is_print =
    * it_special_groups =
    * it_toolbar_excluding =
    * it_hyperlink =
    * it_alv_graphics =
    * it_except_qinfo =
    * ir_salv_adapter =
    changing
    it_outtab =
    * it_fieldcatalog =
    * it_sort =
    * it_filter =
    * exceptions
    * invalid_parameter_combination = 1
    * program_error = 2
    * too_many_lines = 3
    * others = 4
    .
    if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.






    *&---------------------------------------------------------------------*
    *& Module PBO_SFLIGHT OUTPUT
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    module PBO_SFLIGHT output.
    SET PF-STATUS PBO_SFLIGHT.





    endmodule. " PBO_SFLIGHT OUTPUT
    *&---------------------------------------------------------------------*
    *& Module PAI_SFLIGHT INPUT
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    module PAI_SFLIGHT input.


    SA_CODE = OK_CODE.
    CLEAR OK_CODE.

    CASE SA_CODE.
    WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.
    LEAVE PROGRAM.
    ENDCASE.



    endmodule. " PAI_SFLIGHT INPUT

  • #2
    akiestudio,

    Te detallo abajo tu ejemplo de como queda el código para que compile:

    Código:
    *&---------------------------------------------------------------------*
    *& Report  YGEPE
    *&---------------------------------------------------------------------*
    
    REPORT  YGEPE.
    
    *Variables
    DATA: IT_SFLIGHT TYPE TABLE OF SFLIGHT,
          HE_SFILGHT LIKE LINE OF it_sflight,
    
          IT_TABLA TYPE LVC_T_FCAT,
          HE_TABLA LIKE LINE OF IT_TABLA,
    
          CONTENEDOR TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
          ALV TYPE REF TO CL_GUI_ALV_GRID,
    
    *     ESTO MEJORA LA ESTETICA DE LA TABLA
    
          LAYOUT TYPE LVC_S_LAYO,
    
    *     Para rescatar los acciones del usuario (eventos).
          OK_CODE type sy-ucomm.
    
    *CREAMOS LOS OBJETOS
    create object contenedor
      exporting
        container_name = 'CONTENEDOR_TABLAS'
    *   style =
    *   lifetime = lifetime_default
    *   repid =
    *   dynnr =
    *   no_autodef_progid_dynnr =
      exceptions
        cntl_error = 1
        cntl_system_error = 2
        create_error = 3
        lifetime_error = 4
        lifetime_dynpro_dynpro_link = 5
        others = 6 .
    
    create object alv
      exporting
    *   i_shellstyle = 0
    *   i_lifetime =
        i_parent = CONTENEDOR.
    
    * Layout - Visualización de la tabla ALV.
    LAYOUT-ZEBRA = 'X'.
    LAYOUT-SEL_MODE = 'C'.
    
    * CARGAMOS LAS TABLAS CON LOS CAMPOS DESEADOS
    HE_TABLA-FIELDNAME = 'CARRID'.
    HE_TABLA-REF_TABLE = 'SFLIGHT'.
    APPEND HE_TABLA TO IT_TABLA.
    CLEAR HE_TABLA.
    
    HE_TABLA-FIELDNAME = 'CONNID'.
    HE_TABLA-REF_TABLE = 'SFLIGHT'.
    APPEND HE_TABLA TO IT_TABLA.
    CLEAR HE_TABLA.
    
    HE_TABLA-FIELDNAME = 'FLDATE'.
    HE_TABLA-REF_TABLE = 'SFLIGHT'.
    APPEND HE_TABLa TO IT_TABLA.
    CLEAR HE_TABLA.
    
    HE_TABLA-FIELDNAME = 'PRICE'.
    HE_TABLA-REF_TABLE = 'SFLIGHT'.
    APPEND HE_TABLa TO IT_TABLA.
    CLEAR HE_TABLA.
    
    HE_TABLA-FIELDNAME = 'CURRENCY'.
    HE_TABLA-REF_TABLE = 'SFLIGHT'.
    APPEND HE_TABLa TO IT_TABLA.
    CLEAR HE_TABLA.
    
    SELECT *
      FROM SFLIGHT
        INTO TABLE IT_SFLIGHT.
    
    call method alv->set_table_for_first_display
     exporting
    * i_buffer_active =
    * i_bypassing_buffer =
    * i_consistency_check =
    * i_structure_name =
    * is_variant =
    * i_save =
    * i_default = 'X'
     is_layout = LAYOUT
    * is_print =
    * it_special_groups =
    * it_toolbar_excluding =
    * it_hyperlink =
    * it_alv_graphics =
    * it_except_qinfo =
    * ir_salv_adapter =
    changing
      it_outtab =  IT_SFLIGHT
      it_fieldcatalog = IT_TABLA
    * it_sort =
    * it_filter =
     exceptions
     invalid_parameter_combination = 1
     program_error = 2
     too_many_lines = 3
     others = 4 .
    
    if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    
    *&---------------------------------------------------------------------*
    *& Module PBO_SFLIGHT OUTPUT
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    module PBO_SFLIGHT output.
    
      SET PF-STATUS 'PBO_SFLIGHT'.
    
    endmodule. " PBO_SFLIGHT OUTPUT
    *&---------------------------------------------------------------------*
    *& Module PAI_SFLIGHT INPUT
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    module PAI_SFLIGHT input.
    
      OK_CODE = sy-ucomm.
    
      CASE ok_CODE.
        WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
    
    endmodule. " PAI_SFLIGHT INPUT
    Fijate el código y cualquier cosa me preguntas.

    Saludos!
    Gera.-

    Comentario


    • #3
      muchas gracias por la ayuda , ya esta todo correcto , pero me surge la duda ahora ,como puedo hacer para que los campos de la tablas ,se queden fijos y se adapten al tamaño de mi alv, muchas gracias

      Comentario


      • #4
        Para que el filedcat lo tome de una tabla tenes que usar la función REUSE_ALV_FIELDCATALOG_MERGE.

        Fijate y cualquier cosa me decis.

        Saludos!
        Gera.-

        Comentario


        • #5
          muchas gracias por todo , he intentado usar esa funcion y la verdad he mirado ejemplos por internet , pero no conisgo hacer lo que quiero con ella , puedes explicarme como funcionaria en mi caso , muchas gracias

          Comentario


          • #6
            akiestudio, te pongo un ejemplo para que veas.

            Código:
            *&---------------------------------------------------------------------*
            *& Report  YYYYYYYYYYY
            *&---------------------------------------------------------------------*
            REPORT  yyyyyyyyyyy.
            
            TYPE-POOLS: slis.
            
            * Variables
              DATA: t_bkpf TYPE TABLE OF bkpf,
                    l_structure_name TYPE dd02l-tabname,
                    wa_layout TYPE slis_layout_alv,
                    t_fieldcat TYPE slis_t_fieldcat_alv.
            
            START-OF-SELECTION.
            
            * Buscar datos. Trae los primeros 10 registros de la tabla BKPF.
              SELECT *
                FROM bkpf
                  UP TO 10 ROWS
                    INTO TABLE t_bkpf.
            
            * Asigo BKPF.
              MOVE 'BKPF' TO l_structure_name.
            
            * Arma el Fieldcat.
              CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
               EXPORTING
                 i_program_name               = sy-repid
            *     i_internal_tabname           = wa_internal_tabname
                  i_structure_name             = l_structure_name
                CHANGING
                  ct_fieldcat                  = t_fieldcat
               EXCEPTIONS
                 inconsistent_interface       = 1
                 program_error                = 2
                 OTHERS                       = 3.
            
            * Muestra ALV.
              CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
               EXPORTING
                 i_callback_program                = sy-repid
                 is_layout                         = wa_layout
                 it_fieldcat                       = t_fieldcat
                TABLES
                  t_outtab                          = t_bkpf
                EXCEPTIONS
                  program_error                     = 1
                  OTHERS                            = 2.
            Cualquier cosa avisame.

            Saludos!
            Gera.-

            Comentario

            Trabajando...
            X