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: 

LVC_FIELDCATALOG_MERGE with internal table

eyal_alsheikh
Active Participant
0 Kudos

Hi,

Can I use Function Module LVC_FIELDCATALOG_MERGE to get the fieldcatalog of the global internal table in my program instead of dictionary table.

Using parameter i_internal_tabname instead of i_structure_name doesn't work.

Thanks,

Eyal.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

This fm doesn't work by internal table, you have to pass only dictionary table, but you can use REUSE_ALV_FIELDCATALOG_MERGE:

TYPE-POOL SLIS:

DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

LT_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

GT_LVC_FIELDCAT TYPE LVC_T_FCAT,

LT_LVC_FIELDCAT TYPE LVC_S_FCAT.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = GT_REPID

I_INTERNAL_TABNAME = 'ITAB'

I_INCLNAME = GT_REPID

CHANGING

CT_FIELDCAT = GT_FIELDCAT.

LOOP AT GT_FIELDCAT INTO LT_FIELDCAT.

MOVE-CORRESPONDING LT_FIELDCAT TO LT_LVC_FIELDCAT.

APPEND LT_LVC_FIELDCAT TO GT_LVC_FIELDCAT.

ENDLOOP.

Max

7 REPLIES 7

Former Member
0 Kudos

Hi

This fm doesn't work by internal table, you have to pass only dictionary table, but you can use REUSE_ALV_FIELDCATALOG_MERGE:

TYPE-POOL SLIS:

DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

LT_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

GT_LVC_FIELDCAT TYPE LVC_T_FCAT,

LT_LVC_FIELDCAT TYPE LVC_S_FCAT.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = GT_REPID

I_INTERNAL_TABNAME = 'ITAB'

I_INCLNAME = GT_REPID

CHANGING

CT_FIELDCAT = GT_FIELDCAT.

LOOP AT GT_FIELDCAT INTO LT_FIELDCAT.

MOVE-CORRESPONDING LT_FIELDCAT TO LT_LVC_FIELDCAT.

APPEND LT_LVC_FIELDCAT TO GT_LVC_FIELDCAT.

ENDLOOP.

Max

Former Member
0 Kudos

Eyal,

I don't think you can do that ?

can you paste the code you have for the call method with the NAME OF THE STRUCTURE?

Former Member
0 Kudos

Check this

In PBO,


*   Building the field catalog
    PERFORM f9001_build_field_cat TABLES i_fieldcat
                            USING 'ZCSA_MARKETIING_EXPENSE_OUTPUT'

FORM f9001_build_field_cat TABLES   p_fieldcat STRUCTURE lvc_s_fcat
                      USING value(p_structure).

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
            i_structure_name       = p_structure
       CHANGING
            ct_fieldcat            = p_fieldcat[]
       EXCEPTIONS
            inconsistent_interface = 1
            program_error          = 2
            OTHERS                 = 3.
  IF sy-subrc <> 0.
    MESSAGE i013 WITH text-e05."Error in ALV field catalogue creation
    LEAVE LIST-PROCESSING.
  ENDIF.

ENDFORM.                    " f9001_build_field_cat

U can create a structure or example pass MARA then it will take the structure of MARA.

eyal_alsheikh
Active Participant
0 Kudos

Hi,

In the function module attribute SAP wrote:

Create field catalog from dictionary structure or <b>internal table</b>

So maybe there is a way,

Thanks,

Eyal.

0 Kudos

you can do that . check the following code sample.

 move: sy-repid to wf_repid  ,
        'INT_OUTPUT' to int_tab_name . 
* INT_OUTPUT is the name of the internal table (use upper case)

  call function 'REUSE_ALV_FIELDCATALOG_MERGE'
   exporting
     i_program_name              = wf_repid
     i_internal_tabname          = int_tab_name
*   I_STRUCTURE_NAME             =
*   I_CLIENT_NEVER_DISPLAY       = 'X'
    i_inclname                   = wf_repid
    i_bypassing_buffer           = 'X'
*   I_BUFFER_ACTIVE              =
    changing
      ct_fieldcat                  = wf_fld_cat[]
   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.

Regards

Raja

0 Kudos

Hi Eyal,

If you check this function module code the parameter I_INTERNAL_TABNAME is not used anywhere. So it would be better to use 'REUSE_ALV_FIELDCATALOG_MERGE'.

Cheers

Vinod

0 Kudos

If I check the function code of

'REUSE_ALV_FIELDCATALOG_MERGE'

if ( i_structure_name is initial )

and ( i_internal_tabname ne space ).

" called with internal table

"( not supported, see documentation)

It seems it is not supported