Skip to Content

'REUSE_ALV_GRID_DISPLAY_LVC' – No field catalog

(Please bear with me – absolute newbie regarding SAP)

Hi All,

I am trying to convert a program from REUSE_ALV_GRID_DISPLAY to REUSE_ALV_GRID_DISPLAY_LVC , but keep getting a "NO_FIELDCATALOG_AVAILABLE"
error.

My program's most relevant lines are as follow:

TYPES :
  BEGIN OF gty_s_alv,
  n1, n2, etc
END OF gty_s_alv.

DATA: gt_alv  TYPE TABLE OF gty_s_alv WITH HEADER LINE,   
DATA: mt_fieldcat TYPE lvc_t_fcat.

  PERFORM get_data. "load data into gt_alv
  PERFORM build_fieldcat.
  PERFORM list_display.

*----------------------------------------------------
FORM BUILD_FIELDCAT.
  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
  EXPORTING
     i_structure_name  = 'GTY_S_ALV'
  CHANGING
     ct_fieldcat       = mt_fieldcat
  EXCEPTIONS
     inconsistent_interface  = 1
     program_error  = 2
     OTHERS  = 3.
ENDFORM.
*----------------------------------------------------
FORM list_display .
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
  EXPORTING
     i_structure_name = 'GTY_S_ALV'
     i_grid_title     = 'Program_Title'(001)
     it_fieldcat_lvc  = mt_fieldcat
  TABLES
     t_outtab  = gt_alv
  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.
ENDFORM.  " list_display

I keep getting a "No field catalog" exception (dump). Any ideas?

Thanks in advance,

Luis Rodriguez

Add comment
10|10000 characters needed characters exceeded

  • "I am trying to convert a program from REUSE_ALV_GRID_DISPLAY to REUSE_ALV_GRID_DISPLAY_LVC"

    You should rather be trying to use the ALV OO-Model :)

  • Suhas,

    I'm sure you are right. Nevertheless, this is an old system (with some quite old programs) and I thought that converting to the "LVC" version would imply less change in the code of existing programs.

    Thanks for your comment, appreciate it.

    Regards,

    Luis

  • Get RSS Feed

4 Answers

  • Best Answer
    Dec 30, 2016 at 02:28 PM

    The parameter i_structure_name takes the name of a dictionary table, view or structure as an actual parameter. Your structure gty_s_alv is defined globally in your program but not in the data dictionary.

    You have the following options:

    • Define your gty_s_alv structure as a global structure in the data dictionary (SE11). If you do not want to change the field catalog you should be able to call REUSE_ALV_GRID_DISPLAY_LVC directly providing the parameter i_structure_name there and not supplying it_fieldcat_lvc.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
        EXPORTING
           i_structure_name = 'YOUR_GLOBAL_DDIC_STRUCTURE'
           i_grid_title     = 'Program_Title'(001)
        TABLES
           t_outtab         = gt_alv
        EXCEPTIONS
           program_error    = 1
           OTHERS           = 2.
    • Build your field catalog "by hand" and supply it to it_fieldcat_lvc.
    • Use a different function module or one of the class based alv approaches that can handle "local" type definitions.
    Add comment
    10|10000 characters needed characters exceeded

  • Dec 29, 2016 at 11:02 PM

    You should use the debugger to make sure what happens. For instance, does LVC_FIELDCATALOG_MERGE return a field catalog?

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 30, 2016 at 01:48 PM

    Sandra,

    Thanks for your post. According to the debugger, mt_fieldcat is empty. That much I know. What I don't really get is WHY it is empty. I seem to be doing everything according to the examples I have seen on the web (I think :-) ) . The only thing I'm not sure about is the fact that my internal table (GT_ALV) has a header line. Could this be a factor?

    Thanks again,

    Luis

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 30, 2016 at 03:14 PM

    Fabian,

    Thanks for your answer.

    Let's say I would prefer not to create a new structure with SE11. In that case, you state that I "...should be able to call REUSE_ALV_GRID_DISPLAY_LVC directly providing the parameter i_structure_name there and not supplying it_fieldcat_lvc." Could you please enlighten me about how to do this?

    Thanks again,

    Luis

    Add comment
    10|10000 characters needed characters exceeded

    • Thanks.

      I will be signing off for the weekend in about an hour (and I suppose you will be doing that soon, if not already have) but, as a last point (not really important, I'll dig a little more in this code and continue next year :-) ) I'm getting the following error:

      "The field "GET_COLUMNS(" is unknown, but there is a field with the similar name "R_COLUMNS" . . . ."

      in this statement:


      mt_fieldcat = cl_salv_controller_metadata=>get_lvc_fieldcatalog(
      r_columns = go_alv->GET_COLUMNS( )
      R_AGGREGATIONS = GO_ALV->GET_AGGREGATIONS( )
      ).

      I can see the method GET_COLUMNS in cl_salv_table, so I don't really know why it appears.

      Again, don't worry too much. Thanks for all your help and go celebrate with family and friends...

      Best Regards,

      Luis