Application Development and Automation 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: 
Read only

What could be the problem

Former Member
996

Hi all,

I get the error :Exception condition "NO_FIELDCATALOG_AVAILABLE" raised.

What is the problem,the code is as follows:

Type-pools: slis.
tables: mara.
data: l_repid type sy-repid.
data: itab type standard table of Mara with header line.


Select * from mara into table itab where matnr ne ''.

perform alv_list.


FORM ALV_LIST.
  data : l_layout type SLIS_LAYOUT_ALV,
         l_fieldcat TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
          LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
         G_UCOMMAND TYPE SLIS_FORMNAME VALUE 'ALV_USER_COMMAND',
        g_status TYPE slis_formname VALUE 'F01_ALV_EVENT_PF_STATUS_SET'.

  l_repid = sy-repid.

  L_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
  L_LAYOUT-ZEBRA = 'X'.
*  VARIANT-VARIANT = PA_VARI.

  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
            I_PROGRAM_NAME     = l_repid
            I_INTERNAL_TABNAME = 'ITAB'
            I_INCLNAME         = l_repid
       CHANGING
            CT_FIELDCAT        = L_FIELDCAT[]
       EXCEPTIONS
            OTHERS             = 3.




    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            I_CALLBACK_PROGRAM = l_REPID
            IS_LAYOUT          = L_LAYOUT
            IT_FIELDCAT        = l_fieldcat[]
*            IT_SORT            = GT_SORT[]
*            I_CALLBACK_USER_COMMAND  = G_UCOMMAND
*            i_callback_pf_status_set = g_status
            I_SAVE             = 'A'
*            IS_VARIANT         = VARIANT
*            IT_EVENTS          = T_ALV_EVENTS
       TABLES
            T_OUTTAB           = ITAB
       EXCEPTIONS
            PROGRAM_ERROR      = 1
            OTHERS             = 2.
endform.

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
961

declare your itab as ..

data : begin of itab occurs 0.

include structure mara.

data : end of itab.

In ur case no need to use FM 'REUSE_ALV_FIELDCATALOG_MERGE'

u can directly pass the stucture name to FM 'REUSE_ALV_GRID_DISPLAY'. That means no nedd to build field catalog table.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = l_REPID

I_STRUCTURE_NAME = 'MARA'

IS_LAYOUT = L_LAYOUT

    • IT_FIELDCAT = l_fieldcat[]*

  • IT_SORT = GT_SORT[]

  • I_CALLBACK_USER_COMMAND = G_UCOMMAND

  • i_callback_pf_status_set = g_status

I_SAVE = 'A'

  • IS_VARIANT = VARIANT

  • IT_EVENTS = T_ALV_EVENTS

TABLES

T_OUTTAB = ITAB

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

7 REPLIES 7
Read only

Former Member
0 Likes
961

ITAB is not a DDIC recognised structure....

Read only

Former Member
961

hiii

check following code..

FORM f003_display .
  DATA:
    i_fieldcat     TYPE slis_t_fieldcat_alv,
    wa_fieldcat    LIKE LINE OF i_fieldcat,
    wa_layout      TYPE slis_layout_alv,  "Layout
    wa_variant     TYPE disvariant.

  wa_variant-report = sy-repid.

  wa_layout-colwidth_optimize = 'X'.
  wa_layout-zebra = 'X'.


  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
   EXPORTING
     i_program_name               = sy-repid
     i_internal_tabname           = 'I_OUTPUT'
   i_structure_name             = 'I_OUTPUT'
*   I_CLIENT_NEVER_DISPLAY       = 'X'
*   I_INCLNAME                   = sy-repid
*   I_BYPASSING_BUFFER           =
*   I_BUFFER_ACTIVE              =
    CHANGING
      ct_fieldcat                  = i_fieldcat
 EXCEPTIONS
   inconsistent_interface       = 1
   program_error                = 2
   OTHERS                       = 3
            .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.                               " IF sy-subrc <> 0.

  wa_fieldcat-tabname = 'I_OUTPUT'.    " company code
  wa_fieldcat-fieldname = 'BUKRS'.
  wa_fieldcat-ref_tabname = 'EKPO'.
  APPEND wa_fieldcat TO i_fieldcat.
  CLEAR  wa_fieldcat.

  wa_fieldcat-tabname = 'I_OUTPUT'.    " Profit center
  wa_fieldcat-fieldname = 'PRCTR'.
  wa_fieldcat-ref_tabname = 'MARC'.
  APPEND wa_fieldcat TO i_fieldcat.
  CLEAR  wa_fieldcat.


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
*     I_INTERFACE_CHECK                 = ' '
*     I_BYPASSING_BUFFER                = ' '
*     I_BUFFER_ACTIVE                   = ' '
     i_callback_program                = sy-repid
*     I_CALLBACK_PF_STATUS_SET          = ' '
*     I_CALLBACK_USER_COMMAND           = ' '
     I_CALLBACK_TOP_OF_PAGE            = 'F0020_TOP_OF_PAGE'
*     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*     I_CALLBACK_HTML_END_OF_LIST       = ' '
     i_structure_name                  = 'I_OUTPUT'
*     I_BACKGROUND_ID                   = ' '
*     I_GRID_TITLE                      =
*     I_GRID_SETTINGS                   =
*     IS_LAYOUT                       = wa_layout
     it_fieldcat           = i_fieldcat
*     IT_EXCLUDING                      =
*     IT_SPECIAL_GROUPS                 =
*     IT_SORT                           =
*     IT_FILTER                         =
*     IS_SEL_HIDE                       =
     i_default                         = 'X'
     i_save                            = 'X'
     is_variant                        = wa_variant
*     IT_EVENTS                         =
*     IT_EVENT_EXIT                     =
*     IS_PRINT                          =
*     IS_REPREP_ID                      =
*     I_SCREEN_START_COLUMN             = 0
*     I_SCREEN_START_LINE               = 0
*     I_SCREEN_END_COLUMN               = 0
*     I_SCREEN_END_LINE                 = 0
*     I_HTML_HEIGHT_TOP                 = 0
*     I_HTML_HEIGHT_END                 = 0
*     IT_ALV_GRAPHICS                   =
*     IT_HYPERLINK                      =
*     IT_ADD_FIELDCAT                   =
*     IT_EXCEPT_QINFO                   =
*     IR_SALV_FULLSCREEN_ADAPTER        =
*   IMPORTING
*     E_EXIT_CAUSED_BY_CALLER           =
*     ES_EXIT_CAUSED_BY_USER            =
    TABLES
      t_outtab               = i_output
   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.                               " IF sy-subrc <> 0.

<REMOVED BY MODERATOR>

thx

twinkal

Edited by: Alvaro Tejada Galindo on Jun 23, 2008 10:32 AM

Read only

ThomasZloch
Active Contributor
0 Likes
961

In the documentation for REUSE_ALV_FIELDCATALOG_MERGE it is mentioned that the structure used for the field catalog (ITAB) must be declared with LIKE or INCLUDE STRUCTURE.

It's usually better to use a DDIC-defined structure.

Thomas

Read only

Former Member
0 Likes
961

Put MARA in place of ITAB.....

OR

U can use

v_oref_table TYPE REF TO cl_salv_table,

CALL METHOD cl_salv_table=>factory

IMPORTING

r_salv_table = v_oref_table

CHANGING

t_table = i_ftab.

v_oref_table->display( ).

Read only

former_member194669
Active Contributor
0 Likes
961

Try this way

Your itab is of structure MARA then


  call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    exporting
      i_structure_name       = 'MARA'
      i_bypassing_buffer     = 'X'
    changing
      ct_fieldcat            = l_fieldcat
    exceptions
      inconsistent_interface = 1
      program_error          = 2
      others                 = 3.

Read only

Former Member
0 Likes
962

declare your itab as ..

data : begin of itab occurs 0.

include structure mara.

data : end of itab.

Read only

Former Member
0 Likes
961

In ur case no need to use FM 'REUSE_ALV_FIELDCATALOG_MERGE'

u can directly pass the stucture name to FM 'REUSE_ALV_GRID_DISPLAY'. That means no nedd to build field catalog table.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = l_REPID

I_STRUCTURE_NAME = 'MARA'

IS_LAYOUT = L_LAYOUT

    • IT_FIELDCAT = l_fieldcat[]*

  • IT_SORT = GT_SORT[]

  • I_CALLBACK_USER_COMMAND = G_UCOMMAND

  • i_callback_pf_status_set = g_status

I_SAVE = 'A'

  • IS_VARIANT = VARIANT

  • IT_EVENTS = T_ALV_EVENTS

TABLES

T_OUTTAB = ITAB

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.