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: 

fieldcatalog not found in alv

Former Member
0 Kudos

Hi friends

can any one tell me why the field catalog is not found in the below program

can any bdy correct it

code :

TYPE-POOLS: slis.

TABLES :

scarr.

DATA :

it_scarr TYPE STANDARD TABLE OF scarr,

GT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV.

DATA :

wa_scarr TYPE scarr,

WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

SELECT-OPTIONS :

s_carrid FOR scarr-carrid.

START-OF-SELECTION.

PERFORM get_data_scarr.

END-OF-SELECTION.

perform fill_fieldcat.

PERFORM list_display.

&----


*& Form GET_DATA_SCARR

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM get_data_scarr .

SELECT *

INTO TABLE it_scarr

FROM scarr

WHERE carrid IN s_carrid.

IF sy-subrc NE 0.

MESSAGE i000(zsat) WITH 'No Data Found For Selection'.

LEAVE LIST-PROCESSING.

ENDIF.

ENDFORM. " GET_DATA_SCARR

&----


*& Form FILL_FIELDCAT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form FILL_FIELDCAT .

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = 'SY-REPID'

I_INTERNAL_TABNAME = 'IT_SCARR'

CHANGING

ct_fieldcat = GT_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.

endform. " FILL_FIELDCAT

&----


*& Form LIST_DISPLAY

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM list_display .

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

IT_FIELDCAT = GT_FIELDCAT

TABLES

t_outtab = IT_SCARR[]

EXCEPTIONS

PROGRAM_ERROR = 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.

ENDFORM. " LIST_DISPLAY

1 ACCEPTED SOLUTION

Former Member
0 Kudos

HI,

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID ">> Donot pass the SY-REPID in single Quotes or hard code the program name in single Quotes
I_INTERNAL_TABNAME = 'IT_SCARR'
CHANGING
ct_fieldcat = GT_FIELDCAT[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS

= 3

20 REPLIES 20

Former Member
0 Kudos

hi,

MADE THE FOLLOWING CHANGES, IT WILL WORK.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = 'SY-REPID'

I_STRUCTURE_TABNAME = 'SCARR'

CHANGING

ct_fieldcat = GT_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.

Former Member
0 Kudos

I just made a quick guess Is it_scarr that you are passing is case sensitive?

Former Member
0 Kudos

HI,

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID ">> Donot pass the SY-REPID in single Quotes or hard code the program name in single Quotes
I_INTERNAL_TABNAME = 'IT_SCARR'
CHANGING
ct_fieldcat = GT_FIELDCAT[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS

= 3

Former Member
0 Kudos

Hello priyanka ,

Even I had the same problem use the following .


CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
  I_INCLNAME                   =  sy-repid.  '' this is also required..*but NO SINGLE QUOTES.

One more piece of advice ....

dont use sy-repid Its a very bad practice

do it this way.............


data: g_repid like sy-repid.
g_repid = sy-repid.

Your final code must be like


data: g_repid like sy-repid.  " in the beginning 
g_repid = sy-repid.


CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = g_repid
I_INTERNAL_TABNAME = 'IT_SCARR'
  I_INCLNAME                   =  g_repid
CHANGING
ct_fieldcat = GT_FIELDCAT[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3

Try these two and revert back if u have any issues

Comradely,

KSibi

Edited by: sibi k kanagaraj on Apr 30, 2009 5:32 PM

Edited by: sibi k kanagaraj on Apr 30, 2009 5:33 PM

0 Kudos

i tried all thye above answers

but still its not working

regards

priyanka

0 Kudos

it_scarr TYPE STANDARD TABLE OF scarr,'''''

I did not note this

it must be LIKE...

so it must be


it_scarr LIKE STANDARD TABLE OF scarr,

Remember : if you are using the ALV merge then TYPE must not be there like must be there.

Now try and let me know

Comradely,

K.Sibi

0 Kudos

Try by removing IT_SCARR[] this square brackets in reuse_alv_list_display

former_member156446
Active Contributor
0 Kudos
DATA :
it_scarr LIKE STANDARD TABLE OF scarr,  "like<<

it should be some thing to do with the merge, and the structure you are passing to get the field catalog.

0 Kudos

even if i use like also iam afcing the same problem

can any one execute the code and correct it.

regards

priyanka

0 Kudos

HI,

Try this way..it will work

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name         = 'ZKA51151_TEST'
      I_STRUCTURE_NAME       = 'SCARR'   " >> Pass this
*      i_internal_tabname     = 'IT_SCARR'   " Comment this 
    CHANGING
      ct_fieldcat            = gt_fieldcat[]
    EXCEPTIONS
      inconsistent_interface = 1
      program_error          = 2
      OTHERS                 = 3.
  IF sy-subrc EQ 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Former Member
0 Kudos

Hi copy and paste this code.

&----


*& Report ZTEST_DEMO

*&

&----


*&

*&

&----


REPORT ZTEST_DEMO.

TYPE-POOLS: slis.

TABLES :

scarr.

DATA :

it_scarr TYPE STANDARD TABLE OF scarr,

GT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV.

DATA :

wa_scarr TYPE scarr,

WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

SELECT-OPTIONS :

s_carrid FOR scarr-carrid.

START-OF-SELECTION.

PERFORM get_data_scarr.

END-OF-SELECTION.

perform fill_fieldcat.

PERFORM list_display.

*&----


*& Form GET_DATA_SCARR

*&----


  • text

*----


  • --> p1 text

  • <-- p2 text

*----


FORM get_data_scarr .

SELECT *

INTO TABLE it_scarr

FROM scarr

WHERE carrid IN s_carrid.

IF sy-subrc NE 0.

MESSAGE i000(zsat) WITH 'No Data Found For Selection'.

LEAVE LIST-PROCESSING.

ENDIF.

ENDFORM. " GET_DATA_SCARR

*&----


*& Form FILL_FIELDCAT

*&----


  • text

*----


  • --> p1 text

  • <-- p2 text

*----


form FILL_FIELDCAT .

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = 'SY-REPID'

*I_INTERNAL_TABNAME = 'IT_SCARR'

I_STRUCTURE_NAME = 'SCARR'

CHANGING

ct_fieldcat = GT_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.

endform. " FILL_FIELDCAT

*&----


*& Form LIST_DISPLAY

*&----


  • text

*----


  • --> p1 text

  • <-- p2 text

*----


FORM list_display .

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

IT_FIELDCAT = GT_FIELDCAT

TABLES

t_outtab = IT_SCARR[]

EXCEPTIONS

PROGRAM_ERROR = 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.

ENDFORM. " LIST_DISPLAY

Regards

0 Kudos

if i pass the structure name then it will automatically fill the field catalog for all the fields of the structure.

in such case no need of function module REUSE_ALV_FIELDCATALOG_MERGE

but i want to fill tthe field catalog using merge function module .

can any one tell me without the structure name also we can fill the field catalog by just passing the internal table , program name

but here iam just misiing some thing else also which iam not able to track it

can any one help me

Regards

Priyanka.

0 Kudos

hi,

Declare ur internal table like below

DATA : BEGIN OF it_scarr OCCURS 0,
       carrid LIKE scarr-carrid,
       carrname LIKE scarr-carrname,
       currcode LIKE scarr-currcode,
       url LIKE scarr-url,
       END OF it_scarr.

Function module

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name         = sy-repid
      i_internal_tabname     = 'IT_SCARR'
      i_inclname             = sy-repid
    CHANGING
      ct_fieldcat            = gt_fieldcat[]
    EXCEPTIONS
      inconsistent_interface = 1
      program_error          = 2
      OTHERS                 = 3.
  IF sy-subrc NE 0.
    EXIT.
  ENDIF.

Select Query

SELECT carrid
         carrname
         currcode
         url
  INTO TABLE it_scarr
  FROM scarr
  WHERE carrid IN s_carrid.

Hope it helps u .

Thanks & Regards

0 Kudos

still same issue.

Regards

Priyanka

0 Kudos

Hi,

Refer to this link..http://docs.google.com/Doc?id=dfv2hmgs_13ctqpr4g8&hl=en

I have declared the internal table used the Fieldcatalog merge FM and it is working properly

0 Kudos

I think it has something to do the way your int table is declared.

If you declare the int table with ref to a type, the field cat will be empty. Ex -

types: begin of my_typ,

matnr like mara-matnr,

end of my_typ.

data: itab type standard table of my_typ.

This will not work!!!

But if you declare the int table like so -

data: begin of itab occurs 0,

matnr like mara-matnr,

end of itab.

In this case the field cat will be populated.

In your case, declare your int table using data: begin of iscarr ...,

Let me know, since I am having similar issues.

0 Kudos

I made two changes to your code and it works!

1. Define it_scarr table as follows -

*it_scarr TYPE STANDARD TABLE OF scarr,

data: begin of it_scarr occurs 0.

include structure scarr.

data: end of it_scarr.

2. The FM should be as follows -

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = SY-REPID "This is not in quotes

i_internal_tabname = 'IT_SCARR'

i_inclname = sy-repid "This is not in quotes

CHANGING

ct_fieldcat = gt_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.

ENDFORM. " FILL_FIELDCAT

Mohamed_Mukhtar
Active Contributor
0 Kudos

hi,


TYPE-POOLS: slis.
TABLES : scarr.

DATA : it_scarr LIKE STANDARD TABLE OF scarr ,  "-->change TYPE to LIKE
       gt_fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv.

DATA : wa_scarr TYPE scarr,
       wa_fieldcat TYPE slis_fieldcat_alv.

SELECT-OPTIONS : s_carrid FOR scarr-carrid.
"&---------------------------------------------------------------------
**& START-OF-SELECTION.
"&---------------------------------------------------------------------
START-OF-SELECTION.
  PERFORM get_data_scarr.
*&---------------------------------------------------------------------
"& END-OF-SELECTION.
*&---------------------------------------------------------------------
END-OF-SELECTION.
  PERFORM fill_fieldcat.
  PERFORM list_display.
*&---------------------------------------------------------------------
"& Form GET_DATA_SCARR
*&---------------------------------------------------------------------
FORM get_data_scarr.
  SELECT *
  INTO TABLE it_scarr
  FROM scarr
  WHERE carrid IN s_carrid.
  IF sy-subrc NE 0.
    MESSAGE i000(zsat) WITH 'No Data Found For Selection'.
    LEAVE LIST-PROCESSING.
  ENDIF.
ENDFORM. " GET_DATA_SCARR
*&---------------------------------------------------------------------
"& Form FILL_FIELDCAT
*&---------------------------------------------------------------------
FORM fill_fieldcat .
  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name         = sy-repid
*      i_internal_tabname     = 'IT_SCARR'
      i_inclname             = sy-repid  "----> add in ur code
      i_structure_name       = 'SCARR'  "----> add in ur code
    CHANGING
      ct_fieldcat            = gt_fieldcat[]
    EXCEPTIONS
      inconsistent_interface = 1
      program_error          = 2
      OTHERS                 = 3.
  IF sy-subrc NE 0.
    EXIT.
  ENDIF.
ENDFORM. " FILL_FIELDCAT
*&---------------------------------------------------------------------
"& Form LIST_DISPLAY
*&---------------------------------------------------------------------
FORM list_display .
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      i_callback_program = sy-repid
      it_fieldcat        = gt_fieldcat
    TABLES
      t_outtab           = it_scarr[]
    EXCEPTIONS
      program_error      = 1
      OTHERS             = 2.
  IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDFORM. " LIST_DISPLAY

Thanks & Regards

satinder_singh
Participant
0 Kudos

FM FIELDCATALOGUE MERGE only works with internal table that are declared with 'BEGIN OF... ITAB. & END of ... ITAB' syntax. If we try to use the type definition it is not recognised by the FM for FIELDCATALOGUE.

So either replace the declatation of the internal table or use the structure name (as available in DDIC) in the FM.

Former Member
0 Kudos

to remove the error give the structure name in the function module REUSE_ALV_LIST_DISPLAY.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_STRUCTURE_NAME = 'ZEMPMASTERNISH' structure name