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: 

Must i_structure_name for LVC_FIELDCATALOG_MERGE be pre-defined in dict?

Former Member
0 Kudos

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?

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
0 Kudos

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.

4 REPLIES 4

former_member194669
Active Contributor
0 Kudos

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.

former_member188685
Active Contributor
0 Kudos

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

former_member188685
Active Contributor
0 Kudos

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.

former_member181923
Active Participant
0 Kudos

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