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: 

REUSE_ALV_FIELDCATALOG_MERGE fieldcat emply

Former Member
0 Kudos

Good evening

The problem is that after running the function REUSE_ALV_FIELDCATALOG_MERGE table lt_fieldcat (TYPE slis_t_fieldcat_alv) returns emply, I guess it's because I have the internal table declared as "DATA: xxxxxxxx t_xxxxxx TYPE STANDARD TABLE OF LINE WITH HEADER," if the state as "DATA: BEGIN OF xxxxxx OCCURS 0" gives me no problems,

Someone can explain me how to make the function return REUSE_ALV_FIELDCATALOG_MERGE fields with the statement DATA: xxxxxxxx t_xxxxxx TYPE STANDARD TABLE OF LINE WITH HEADER

Thank you for your attention

1 ACCEPTED SOLUTION

former_member194416
Contributor
0 Kudos

You can't use this function in that syntax. Fieldcat merge read the source code to find fields so you have to define your internal table in Begin of table occurs n format. If you have a structure for your ALV than you may not need fieldcat you can directly use structure in REUSE_ALV_GRID_DISPLAY.

Edited by: Gungor Ozcelebi on Jul 9, 2009 4:06 PM

5 REPLIES 5

former_member194416
Contributor
0 Kudos

You can't use this function in that syntax. Fieldcat merge read the source code to find fields so you have to define your internal table in Begin of table occurs n format. If you have a structure for your ALV than you may not need fieldcat you can directly use structure in REUSE_ALV_GRID_DISPLAY.

Edited by: Gungor Ozcelebi on Jul 9, 2009 4:06 PM

Former Member
0 Kudos

hi ,

Try out this Wiki Link , Take a look on this Code

I hope This Will help you

https://wiki.sdn.sap.com/wiki/display/Snippets/Programforalvinteractivereportgeneratingthird+list

Regards

Saurabh Goel

I355602
Advisor
Advisor
0 Kudos

Hi,

Refer the below snippet:-


TYPE-POOLS : slis.

*INTERNAL TABLE
data : BEGIN OF it_final occurs 0,
         waers LIKE tcurc-waers,
         isocd LIKE tcurc-isocd,
         altwr LIKE tcurc-altwr,
         gdatu LIKE tcurc-gdatu,
         xprimary LIKE tcurc-xprimary,
       END OF it_final.

*FIELD CATALOG
DATA : it_field TYPE slis_t_fieldcat_alv,
       wa_field TYPE slis_fieldcat_alv.

Now create Field Catalog using:-


  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
      i_program_name         = sy-repid
      i_internal_tabname     = 'IT_FINAL'
      i_inclname             = sy-repid
    CHANGING
      ct_fieldcat            = it_field
    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.

Use this it_field as your field catalog table.

Hope this helps you.

Regards,

Tarun

Former Member
0 Kudos

Hi Vincete ,

IT_FIELDCAT is the most vital parameter which has to be imported to the alv display function module. A field catalog is required for every ALV list output.

Field catalog contains descriptions of the list output fields (usually a subset of the internal output table fields).The field catalog for the output table is built-up in the caller's coding.Fieldcatalog can be generated either automatically or manually.

You can use either beign of or type statement to create internal table .

Since you are doing it *automactically the syntax with header line cannot be used *.

you can use the following link for your reference .

https://wiki.sdn.sap.com/wiki/display/Snippets/CreatingLVCfieldcatalogUsingInternaltablethroughSLISfieldcatalog.

hope this may help you .

You can do use type standard table with header line if you are creating field catalog manually.

regards

Aditi Wason

Former Member
0 Kudos

Hi,

if you declare the structure Globally (i mean in SE11) then it will come or else it won't.

so if you want to build it based on structure then you need to declare it globally. and use the FM REUSE_ALV_FIELDCATALOG_MERGE.

Try this.

TYPE-POOLS SLIS .

TABLES MARA.

SELECT-OPTIONS S_MATNR FOR MARA-MATNR.

DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

DATA: I_MARA LIKE MARA OCCURS 0 WITH HEADER LINE.

DATA:

BEGIN OF IT_FINAL OCCURS 0,

MATNR LIKE MARA-MATNR,

ERSDA LIKE MARA-ERSDA,

MATKL LIKE MARA-MATKL,

MTART LIKE MARA-MTART,

MEINS LIKE MARA-MEINS,

END OF IT_FINAL.

SELECT * INTO TABLE I_MARA FROM MARA

WHERE MATNR > 'TSA'

AND MATNR < 'TSB'

AND MATNR IN S_MATNR.

LOOP AT I_MARA.

MOVE-CORRESPONDING I_MARA TO IT_FINAL.

APPEND IT_FINAL.

ENDLOOP.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = SY-REPID

I_INTERNAL_TABNAME = 'IT_FINAL'

I_INCLNAME = SY-REPID

CHANGING

CT_FIELDCAT = IT_FIELDCAT[]

EXCEPTIONS

INCONSISTENT_INTERFACE = 1

PROGRAM_ERROR = 2

OTHERS = 3

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

IT_FIELDCAT = IT_FIELDCAT[]

I_GRID_TITLE52 'The field catalog-ALV Tutorial Chapter 2-20'

TABLES

T_OUTTAB = IT_FINAL

EXCEPTIONS

OTHERS = 1.

WRITE: / SY-XPROG, 'has finished'.

Thanks.