Skip to Content
avatar image
Former Member

Must i_structure_name for LVC_FIELDCATALOG_MERGE be pre-defined in dict?

When I've used lvc_fieldcatalog_merge in the past, I've always set i_structure_name to a literal - the name of a structure that I've defined in Data Dictionary.

If I declare a structure type in the "TOP" of an X function group, can I set i_structure_name to the name of this type ????

Or does i_structure_name have to be the name of a pre-defined dictionary structure?

Thanks for whatever time you can afford to spend considering this matter?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    Jul 24, 2008 at 06:51 PM

    As per my knowledge fm LVC_FIELDCATALOG_MERGE only support with structures declared in the Data Dictionary level.

    But if you want to pass the internal table declared in the TOP or X fun group then you need to work around way

    1. First call CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' and get the field catalog table from this fm and pass it to

    2. CALL FUNCTION 'LVC_TRANSFER_FROM_SLIS' and get the field catalog from this and pass to set_table_for_first_display

    PS : There is importing parameter in fm LVC_FIELDCATALOG_MERGE ie I_INTERNAL_TABNAME i tried to pass internal table declared in the TOP thru this but somehow it is not working.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 24, 2008 at 07:10 PM

    check the sample code..

    REPORT  ZTEST_FIELDCATLOG.
    type-pools: slis.
    DATA: it_fieldcat type SLIS_T_FIELDCAT_ALV,
         it_lvcfcat type lvc_t_fcat.
    include ztest_top.
    
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
     EXPORTING
       I_PROGRAM_NAME               = sy-repid
       I_INTERNAL_TABNAME           = 'IT_DATA'
       I_INCLNAME                   = 'ZTEST_TOP'
      CHANGING
        ct_fieldcat                  = it_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.
    
    
    CALL FUNCTION 'LVC_TRANSFER_FROM_SLIS'
      EXPORTING
        it_fieldcat_alv       = it_fieldcat
    *   IT_SORT_ALV           =
    *   IT_FILTER_ALV         =
    *   IS_LAYOUT_ALV         =
     IMPORTING
       ET_FIELDCAT_LVC       = it_lvcfcat
    *   ET_SORT_LVC           =
    *   ET_FILTER_LVC         =
    *   ES_LAYOUT_LVC         =
      tables
        it_data               = it_data
    * EXCEPTIONS
    *   IT_DATA_MISSING       = 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.
    
    BREAK-POINT.

    Top include

    *&---------------------------------------------------------------------*
    *&  Include           ZTEST_TOP
    *&---------------------------------------------------------------------*
    
    data: begin of it_data occurs 0,
            vbeln like vbak-vbeln,
            matnr like mara-matnr,
          end of it_data.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 24, 2008 at 06:54 PM

    It should be Defined in the Data Dictionary Level. Other wise it will Fail.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 24, 2008 at 07:17 PM

    aRs/Vijay -

    Thanks to both for confirming what I thought was the case. (I am also aware of the work-around you both mentioned.)

    Only reason I raised it is that at this site, there is a standard which says don't put anything in dictionary if it's only used by one object.

    So before I violated that standard, I wanted to make sure that I was correct about the function requiring the dictionary name. The site agrees that it's not worth using the work-around to avoid violating the standard.

    Thanks again to both.

    djh

    Add comment
    10|10000 characters needed characters exceeded