cancel
Showing results for 
Search instead for 
Did you mean: 

ALV fieldcatalog

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member188685
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi,

Is there no other Way.

Regards

Ahsan

Former Member
0 Kudos

Hi,

By creating a structure it becomes easy for you modify the catalog in case you have to modify your report at a later point of time.

The changes to the strcuture will automatically reflect in the field catalog as well as the internal table as you can use the same structure for creating the internal table as well.

Are you going to ALV Controls / REUSE functions?

1. If you are using REUSE functions, you can try creating the field catalog using the REUSE_ALV_FIELDCATALOG_MERGE with the internal table, but it is having some problems.

2. If you are using controls, you cannot use the field catalog used by the REUSE function as the TYPE of the field catalog is different.

Given all that, even if you are successful, its recommended to go for a structure in SE11 and use that, else create it manually - but then again doesn't make sense as the no. of fields is on the higher side.

Regards,

Ravi

Note : Please mark the helpful answers

Former Member
0 Kudos

hI,

Thanks

Ahasan

Answers (6)

Answers (6)

Former Member
0 Kudos

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

BR, Jacek

Former Member
0 Kudos
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
Former Member
0 Kudos

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

Former Member
0 Kudos

hi,

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

regards,

vidya

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

All my fields are defined as

eg

planner TYPE char30, etc

regards

Ahasan