Skip to Content

ALV field Catalog error

I tried to build the field catalog as below but it is erroring saying it_fieldcat allows certain data types and ls_fieldcatalog uses a different data type

TYPE-POOLS: slis.

.

data ls_fieldcatalog type SLIS_T_FIELDCAT_ALV

with header line.

DATA: i_repid type sy-repid.

i_repid = sy-repid.

ls_fieldcatalog-fieldname = 'Co Code'.

ls_fieldcatalog-inttype = 'C'.

ls_fieldcatalog-col_pos = '0'.

APPEND ls_fieldcatalog to ls_fieldcatalog.

clear ls_fieldcatalog.

ls_fieldcatalog-fieldname = 'Document No'.

ls_fieldcatalog-inttype = 'N'.

ls_fieldcatalog-col_pos = '1'.

APPEND ls_fieldcatalog to ls_fieldcatalog.

clear ls_fieldcatalog.

ls_fieldcatalog-fieldname = 'GL Account'.

ls_fieldcatalog-inttype = 'N'.

ls_fieldcatalog-col_pos = '2'.

APPEND ls_fieldcatalog to ls_fieldcatalog.

clear ls_fieldcatalog.

ls_fieldcatalog-fieldname = 'Posting Date'.

ls_fieldcatalog-inttype = 'D'.

ls_fieldcatalog-col_pos = '3'.

APPEND ls_fieldcatalog to ls_fieldcatalog.

clear ls_fieldcatalog.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = i_repid

IT_FIELDCAT = ls_fieldcatalog

I_SAVE = 'A'

TABLES

t_outtab = it_tab

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2

.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 22, 2010 at 04:09 AM

    it_fieldcatalog is internal table type whereas the parameter u r passing ls_fieldcatalog is a structure, it should be declared as a table type u need to use ls_fieldcatalog[] and the error will b removed.

    Edited by: vijetasap on Jun 22, 2010 6:09 AM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 22, 2010 at 04:46 AM

    Hi,

    Do not create the field catalog internal table with header line, use the explicit work area.

    data: ls_fieldcatalog type SLIS_T_FIELDCAT_ALV,     " Internal table for field catlog
             lw_fieldcatalog  like line of ls_fieldcatalog .         " Workarea for Fiel catlog
    

    Now use this work are to append the record to ls_fieldcatalog. and pass the internal table ls_fieldcatalog to the parameter IT_FIELDCAT of the FM.

    Regards

    DKS

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 22, 2010 at 05:14 AM

    Hi,

    You have to make two corrections in your code.

    1. First of all ls_fieldcatalaog is a table with headerline. So inorder to pass the body of the fieldcatalog you have to pass ls_fieldcatalaog[] in the function module. ie, you have to use the square brackets.

    2. While defining the fieldcatalog you have to give the name of the field in the internal table for the paramater ls_fieldcatalog-fieldname. For eg, company code will be defined as bukrs then type 'BUKRS' in ls_fieldcatalog-fieldname.

    Hope it will be okay. Good luck.

    Thanking you,

    Jerry Jerome

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 22, 2010 at 05:40 AM

    Hi ,

    Just follow the suggetsions given in above tread . It will resolve your query that is :

    a. Do not make use of header line , creat eexplicite work area and mak euse of ls_fieldcatalaog[] in the function module an append statement.

    b. The reason for the error you are getting is because you have made use of N , D , C data types and passed in fieldname This is not correct mak euse of eg KUNNR , VBELN there according to your data .

    Regards,

    Uma Dave

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 22, 2010 at 05:42 AM

    Hi ,

    Please Have a look below:

    a. Do not make use of header line , creat eexplicite work area and mak euse of ls_fieldcatalaog[] in the function module an append statement.

    b. The reason for the error you are getting is because you have made use of N , D , C data types and passed in fieldname This is not correct make use of eg KUNNR , VBELN there according to your data .

    Hope this is helpful.

    Regards,

    Uma Dave

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 22, 2010 at 07:55 AM

    Hi

    I must see your code and search SDN after posting .

    Thank

    Regards

    I.Muthukumar.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 22, 2010 at 08:01 AM

    Please fined the below code

    data ls_fieldcatalog type SLIS_FIELDCAT_ALV

    lt_fieldcatlog type SLIS_T_FIELDCAT_ALV

    DATA: i_repid type sy-repid.

    i_repid = sy-repid.

    ls_fieldcatalog-fieldname = 'Co Code'.

    ls_fieldcatalog-inttype = 'C'.

    ls_fieldcatalog-col_pos = '0'.

    APPEND ls_fieldcatalog to lt_fieldcatalog.

    clear ls_fieldcatalog.

    ls_fieldcatalog-fieldname = 'Document No'.

    ls_fieldcatalog-inttype = 'N'.

    ls_fieldcatalog-col_pos = '1'.

    APPEND ls_fieldcatalog to lt_fieldcatalog.

    clear ls_fieldcatalog.

    ls_fieldcatalog-fieldname = 'GL Account'.

    ls_fieldcatalog-inttype = 'N'.

    ls_fieldcatalog-col_pos = '2'.

    APPEND ls_fieldcatalog to lt_fieldcatalog.

    clear ls_fieldcatalog.

    ls_fieldcatalog-fieldname = 'Posting Date'.

    ls_fieldcatalog-inttype = 'D'.

    ls_fieldcatalog-col_pos = '3'.

    APPEND ls_fieldcatalog to lt_fieldcatalog.

    clear ls_fieldcatalog.

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    I_CALLBACK_PROGRAM = i_repid

    IT_FIELDCAT = lt_fieldcatalog

    I_SAVE = 'A'

    TABLES

    t_outtab = it_tab

    EXCEPTIONS

    PROGRAM_ERROR = 1

    OTHERS = 2

    Add comment
    10|10000 characters needed characters exceeded