cancel
Showing results for 
Search instead for 
Did you mean: 

alv function modules

Former Member
0 Kudos

Please explain the usage of 'REUSE_ALV_FIELDCATALOG_MERGE' with one explain?

What is the main use of the above function module?

Accepted Solutions (1)

Accepted Solutions (1)

mahaboob_pathan
Contributor
0 Kudos

hi,

The function REUSE_ALV_FIELDCATALOG_MERGE can built automatically the field catalog needed in ALV list functions.

The function REUSE_ALV_FIELDCATALOG_MERGE is used for retrieve a catalog from a table defined in DDICT. Then you can modify it as you want. You can see an example in BALV* programs demos.

REPORT ZSTEST_034 .

TABLES VBAK.

TYPE-POOLS SLIS.

DATA ITAB LIKE VBAK OCCURS 0 WITH HEADER LINE.

*--ALV

DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

*--

SELECT-OPTIONS S_VBELN FOR VBAK-VBELN.

START-OF-SELECTION.

SELECT * FROM VBAK INTO TABLE ITAB WHERE VBELN IN S_VBELN.

END-OF-SELECTION.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

  • I_PROGRAM_NAME = SY-REPID

I_INTERNAL_TABNAME = 'ITAB'

I_STRUCTURE_NAME = 'VBAK'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_INCLNAME =

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

CT_FIELDCAT = I_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.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

  • I_CALLBACK_PROGRAM = ' '

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_STRUCTURE_NAME =

  • IS_LAYOUT =

IT_FIELDCAT = I_FIELDCAT

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = ITAB

  • 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.

Answers (4)

Answers (4)

Former Member
0 Kudos

in very simple language it is used to populate a table contents.that table has structure of slis_alv_field catalog

which is used to know diffent attributes of a field that is displayed like key,column pos,hotspot etc.

award if useful

Former Member
0 Kudos

The function REUSE_ALV_FIELDCATALOG_MERGE is used for retrieve a catalog

from a table defined in DDICT. Then you can modify it as you want.

You can see an example in BALV* programs demos.

Look this example:

in the program J_1AINFG is called as:

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' =20

EXPORTING =20

i_internal_tabname = TABLEINT

i_structure_name = 'J_1AIFALVHDR' =20

CHANGING =20

ct_fieldcat = i_fieldcat[]. =20

where i_structure name is defined in DDICT. Then you can add, delete, or=

modify masks, lengths, etc. properties of fields in this table.

In my program I need add a lot of fields

LOOP AT i_fieldcat INTO wa_fieldcat. =20

MOVE wa_fieldcat TO wa_auxfieldcat. =20

CASE wa_fieldcat-col_pos. =20

WHEN 27. =20

CLEAR wa_fieldcat. =20

wa_fieldcat-fieldname = 'COEFIC1'. =20

wa_fieldcat-tabname = g_tabname_header. =20

wa_fieldcat-col_pos = 27. =20

wa_fieldcat-seltext_s = 'Coef.Per.'. =20

wa_fieldcat-seltext_m = 'Coefic.Per=EDodo'. =20

wa_fieldcat-seltext_l = 'Coeficiente del Per=EDodo'. =20

wa_fieldcat-outputlen = 9. =20

wa_fieldcat-just = 'R'. =20

APPEND wa_fieldcat TO auxcatalogo. =20

ADD 1 TO wa_auxfieldcat-col_pos. =20

..

ENDCASE.

ENDLOOP.

i_fieldcat[] = auxcatalogo[].

This is the table that you show in ALV format.

Try modify some fields and see the layout.

In the called program use the REUSE_ALV_HIERSEQ_LIST_DISPLAY

but is similar for the REUSE_ALV_LIST_DISPLAY.

Good luck!

Former Member
0 Kudos

REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to

populate a fieldcatalog which is essential to display the data in ALV.

If the output data is from a single dictionary table and all the

columns are selected, then we need not exclusively create the field cat

alog. Its enough to mention the table name as a parameter

(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases

we need to create it.

The Important Parameters are :

I. Export :

i. I_program_name : report id

ii. I_internal_tabname : the internal output table

iii. I_inclname : include or the report name where all the dynamic forms are handled.

II Changing

ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is

declared in the type pool SLIS.

Check the link below:

http://www.sapdev.co.uk/reporting/alv/alvgrid_basic.htm

Regards.

Former Member
0 Kudos

The function REUSE_ALV_FIELDCATALOG_MERGE can built automatically the field catalog needed in ALV list functions.

The function REUSE_ALV_FIELDCATALOG_MERGE is used for retrieve a catalog from a table defined in DDICT. Then you can modify it as you want. You can see an example in BALV* programs demos.

But can be used for things like column headings, field width, field format, whether key field or not, etc...

This is from the documentation of that FM:

Supports the creation of the field catalog for the ALV function modules

based either on a structure or table defined in the ABAP Data

Dictionary, or a program-internal table.

The program-internal table must either be in a TOP Include or its

Include must be specified explicitly in the interface.

The variant based on a program-internal table should only be used for

rapid prototyping since the following restrictions apply:

o Performance is affected since the code of the table definition must

always be read and interpreted at runtime.

o Dictionary references are only considered if the keywords LIKE or

INCLUDE STRUCTURE (not TYPE) are used.

If the field catalog contains more than 90 fields, the first 90 fields

are output in the list by default whereas the remaining fields are only

available in the field selection.

If the field catalog is passed with values, they are merged with the

'automatically' found information.

Reward points if useful.