Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ERROR 'NO_FIELDCATALOUGE_AVAILABLE' in ALV GRID PROG

TABLES: sbook.
TYPE-POOLS: slis.
DATA: cc1 TYPE scrfname VALUE 'CC1'.




*&--------------------------------------------------------------------------------------------*
*& Defining the structures to be used in this programs                                        *
*&--------------------------------------------------------------------------------------------*

TYPES: BEGIN OF struct1,
carrid TYPE sbook-carrid,
connid TYPE sbook-connid,
fldate TYPE sbook-fldate,
bookid TYPE sbook-bookid,
lugweight TYPE sbook-luggweight,
wunit TYPE sbook-wunit,
END OF struct1.

*&--------------------------------------------------------------------------------------------*
*& Defining Internal Tables of the structure but without header line as specified in TS       *
*&--------------------------------------------------------------------------------------------*



*&--------------------------------------------------------------------------------------------*
*& Defining the class to read and fetch data from the internal table                          *
*&--------------------------------------------------------------------------------------------*
CLASS c1 DEFINITION.
  PUBLIC SECTION.
    METHODS: constructor,getdata IMPORTING sb_cid TYPE sbook-carrid sb_conid TYPE sbook-connid,
    writedata.

  PRIVATE SECTION.

    DATA: it_1 TYPE TABLE OF struct1.
    DATA: wa_1 TYPE struct1.

    DATA: cont1 TYPE REF TO cl_gui_custom_container,
    grid1 TYPE REF TO cl_gui_alv_grid.
ENDCLASS.                    "c1 DEFINITION


*&--------------------------------------------------------------------------------------------*
*& Implementing the class to read and fetch data from the internal table                      *
*&--------------------------------------------------------------------------------------------*

CLASS c1 IMPLEMENTATION.

*&--------------------------------------------------------------------------------------------*
*& Constructor method to initialize Cannot be called by class object it run automatically     *
*&--------------------------------------------------------------------------------------------*

  METHOD constructor.

    CREATE OBJECT cont1
      EXPORTING
*      PARENT                      =
        container_name              = 'CC1'
*      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
        .
    IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    CREATE OBJECT grid1
      EXPORTING
*    I_SHELLSTYLE      = 0
*    I_LIFETIME        =
        i_parent          = cont1
*    I_APPL_EVENTS     = space
*    I_PARENTDBG       =
*    I_APPLOGPARENT    =
*    I_GRAPHICSPARENT  =
*    I_NAME            =
*    I_FCAT_COMPLETE   = SPACE
  EXCEPTIONS
    error_cntl_create = 1
    error_cntl_init   = 2
    error_cntl_link   = 3
    error_dp_create   = 4
    OTHERS            = 5
        .
    IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    CALL METHOD grid1->set_table_for_first_display
      EXPORTING
*    I_BUFFER_ACTIVE               =
*    I_BYPASSING_BUFFER            =
*    I_CONSISTENCY_CHECK           =
        i_structure_name              = 'STRUCT1'
*    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_1
    it_fieldcatalog               = i_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.








  ENDMETHOD.                    "constructor

*&--------------------------------------------------------------------------------------------*
*& Method to read the internal table according to the user input into the parameters          *
*&--------------------------------------------------------------------------------------------*


  METHOD getdata.
    SELECT carrid connid fldate bookid luggweight wunit  FROM sbook INTO CORRESPONDING FIELDS OF wa_1 WHERE carrid = sb_cid AND connid = sb_conid.
      APPEND wa_1 TO it_1.
    ENDSELECT.



  ENDMETHOD.                    "getdata


*&--------------------------------------------------------------------------------------------*
*& Method to display the ALV grid list according to the criteria given by user                *
*&--------------------------------------------------------------------------------------------*

  METHOD writedata.
    CALL METHOD grid1->refresh_table_display
*      EXPORTING
*        IS_STABLE      =
*        I_SOFT_REFRESH =
*      EXCEPTIONS
*        FINISHED       = 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.


  ENDMETHOD.                    "writedata

ENDCLASS.                    "c1 IMPLEMENTATION


DATA: obj1 TYPE REF TO c1.

START-OF-SELECTION.
  CREATE OBJECT obj1.

  CALL SCREEN 100.



*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'PF1'.
*  SET TITLEBAR 'xxx'.


  CALL METHOD obj1->writedata.

ENDMODULE.                 " STATUS_0100  OUTPUT



*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.

  CASE sy-ucomm.
    WHEN 'EXIT' OR 'BACK' OR 'CANCEL'.
      LEAVE TO SCREEN 0.
  ENDCASE.

  CALL METHOD obj1->getdata
    EXPORTING
      sb_cid   = sbook-carrid
      sb_conid = sbook-connid.

ENDMODULE.                 " USER_COMMAND_0100  INPUT
Tags:
Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question