Skip to Content
avatar image
Former Member

ALV fieldcatalog

Hi all,

I have a internal tables with 56 fields i want to display it in a ALV .I want to have the fieldcatalog for it.I dont to generate it manually.I tried to use function module 'LVC_FIELDCATALOG_MERGE' in that i passed my internal table and tried to get the field catalog.But i am not getting it.But if i pass 'SFLIGHT'.I am getting the fieldcat.Is it necessary to have a structure to be created in SE11 to get get the fieldcat using the function module.Does any know ???

regards

Ahasan

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • Best Answer
    Apr 19, 2006 at 02:15 PM

    Hi,

    try this way....

    DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
      EXPORTING
        I_PROGRAM_NAME         = SY-REPID
        I_INTERNAL_TABNAME     = 'ITAB'
        I_INCLNAME             = SY-REPID
      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.

    Regards

    vijay

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 19, 2006 at 02:09 PM

    Hi !!

    Thera are some problems with that function. If you can try to define fields in your internal table wit use of LIKE.

    BR, Jacek

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 19, 2006 at 02:12 PM

    pls show ur declaration of internal table and the code for FM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 19, 2006 at 02:14 PM

    Hi !!

    The function work excellent only with fields that have reference in Dictionary (SE11). Try to find references - and define fields:

    lv_field Like mara-matnr for example - or build your fieldcat manualy.

    BR, Jacek

    P>S Please reward helpful answers

    Message was edited by: Jacek S³owikowski

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 19, 2006 at 02:26 PM
    try this using subroutine
    
    PERFORM fieldcatalog_merge TABLES st_fieldcat_lvc itab.
    
    in that perform
    
    FORM fieldcatalog_merge TABLES p_fieldcatalog p_it_name.
    
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'P_IT_NAME'
        CHANGING
          ct_fieldcat      = p_fieldcatalog[].
    *
    ENDFORM.                    " fieldcatalog_merge
    
    I am not sure of this , i had seen in one program
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 19, 2006 at 02:33 PM

    There is no other way. Yo cona only defin it with LIKE or bouit whole fieldcat manually.

    BR, Jacek

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 19, 2006 at 02:14 PM

    hi,

    the data declarations for the fields of the internal table you are declaring should be of the type LIKE.

    regards,

    vidya

    Add comment
    10|10000 characters needed characters exceeded