Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ERROR 'NO_FIELDCATALOUGE_AVAILABLE' in ALV GRID PROG

Former Member
0 Kudos
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
1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Jagrut,

If your output format (structure of internal table) i.e. STRUCT1 in your case is a DDIC structure then you dont have to pass the fieldcat table.

Else you have to fill the table with the fields you need in the output. Its the output format.

Check sample program BCALV_FIELDCAT_TEST.

Hope it helps.

Lokesh

PS. please reward helpful posts

Message was edited by:

Lokesh Aggarwal

9 REPLIES 9

rainer_hbenthal
Active Contributor
0 Kudos

And where did you fill the field catalog.

Former Member
0 Kudos

i have not used field catalouge

0 Kudos

if u r not using fieldcatalog then y r u passing

it_fieldcatalog = i_fieldcatalog into set_table_for_first_display?

if u want to use structure, not fiedlcat, just comment that line or else build a fieldcat and comment

i_structure = 'STRUCT1'.

Former Member
0 Kudos

Please fill the field catalog table .

rainer_hbenthal
Active Contributor
0 Kudos

Thats why you are getting this error.

former_member386202
Active Contributor
0 Kudos

Hi,

Fill fieldcatalog first using FM "LVC_FIELDCATALOG_MERGE".

Regards,

Prashant

Former Member
0 Kudos

Hi Jagrut,

If your output format (structure of internal table) i.e. STRUCT1 in your case is a DDIC structure then you dont have to pass the fieldcat table.

Else you have to fill the table with the fields you need in the output. Its the output format.

Check sample program BCALV_FIELDCAT_TEST.

Hope it helps.

Lokesh

PS. please reward helpful posts

Message was edited by:

Lokesh Aggarwal

Former Member
0 Kudos

hi jagrut,

everything is fine.but

i think u need to check the tables which are using and u have to check the naming standards which your using for the coding.And also the error clearly specifies that no fieldcatalog is available.i.e., check all the fields.

Former Member
0 Kudos

Hi Jagrut,

First of all, you are using ALV with OOPS.

So in ALV with OOPS, there is no need of field catalog,

Just comment ur command which u r using in calling Method

"<b>CALL METHOD grid1->set_table_for_first_display</b>" and comment the

<b>CHANGING</b>

<b> it_fieldcatalog = i_fieldcatalog</b>

Your program will work fine..

Becaz in Alv with OOPS, u r using <b>ALV Container</b> which contains ur<b> ALV GRID</b>. So there is no need of field catalog.

Rewards if ur problem solved.

Regards

Sachin Gupta