Application Development and Automation 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: 
Read only

About alvs

Former Member
0 Likes
866

Hi All,

can any one explain brifely REUSE_ALV_FIELDCATALOG_MERGE.

Thanks&Regrds,

phani

7 REPLIES 7
Read only

sharat_chandra
Product and Topic Expert
Product and Topic Expert
0 Likes
839

Hi,

"REUSE_ALV_FIELDCATALOG_MERGE" is used to create a field catalog for the ALV. The input to this FM can be either an internal table or a dictionary structure/table/table type.

Please see the documentation in SE37 for a detailed explanation .

Read only

Former Member
0 Likes
839

hello,

there are 3 ways of preparing the fieldcatalog internal table.

>manual way

>semiautomatic

> automatic(REUSE_ALV_FIELDCATALOG_MERGE)

let us consider we have output internal table.

if all the fields of output internal table are from only one database table.

then we can use REUSE_ALV_FIELDCATALOG_MERGE.

i hope it will help you.

sathish

Read only

paruchuri_nagesh
Active Contributor
0 Likes
839

hi

phani!

field catalog can be build in three ways

1)manually

2)automatically

3)semi-automatically

manually u can build by using type-pool SLIS

automatically by using FM REUSE_ALV_FIELDCATALOG_MERGE

semi-automatically by using FM

LVC_FIELDCATALOG_MERGE

if fields of internal table from different tables u have to use type pool SLIS to build field catalog

if internal table fields are from single database table there is no need to build field catalog manually in that scenario u can use function maodule REUSE_ALV_FIELDCATALOG_MERGE

dont forget to reward

Regards

Nagesh.Paruchuri

Read only

Former Member
0 Likes
839

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.

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

Example:

in the program J_1AINFG is called as:

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' =20

EXPORTING =20

i_internal_tabname =3D TABLEINT

i_structure_name =3D 'J_1AIFALVHDR' =20

CHANGING =20

ct_fieldcat =3D 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 a program if u need to add 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 =3D 'COEFIC1'. =20

wa_fieldcat-tabname =3D g_tabname_header. =20

wa_fieldcat-col_pos =3D 27. =20

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

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

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

wa_fieldcat-outputlen =3D 9. =20

wa_fieldcat-just =3D 'R'. =20

APPEND wa_fieldcat TO auxcatalogo. =20

ADD 1 TO wa_auxfieldcat-col_pos. =20

..

ENDCASE.

ENDLOOP.

Regards,

Sravanthi

Read only

Former Member
0 Likes
839

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.

do like this

  • Create the Field Catalog.

PERFORM field_catalog USING 'CARRID' .

PERFORM field_catalog USING 'CONNID' .

PERFORM field_catalog USING 'FLDATE' .

PERFORM field_catalog USING 'BOOKID' .

PERFORM field_catalog USING 'LUGWEIGHT' .

PERFORM field_catalog USING 'WUNIT' .

  • Build Layout

PERFORM f9300_build_layout.

*display report

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

is_layout = gv_layout1

it_fieldcat = git_fieldcatalog[]

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. " IF sy-subrc 0.

FORM field_catalog USING xv_fieldname TYPE slis_fieldname.

DATA: gv_colpos TYPE i,

git_fieldcatalog TYPE slis_t_fieldcat_alv,

lwa_fieldcatalog TYPE LINE OF slis_t_fieldcat_alv,

gv_layout1 TYPE slis_layout_alv.

gv_colpos = gv_colpos + 1.

lwa_fieldcatalog-col_pos = gv_colpos.

lwa_fieldcatalog-fieldname = xv_fieldname.

APPEND lwa_fieldcatalog TO git_fieldcatalog.

CLEAR lwa_fieldcatalog.

ENDFORM. " field_catalog

FORM build_layout .

gv_layout1-colwidth_optimize = 'X'.

gv_layout1-zebra = 'X'.

gv_layout1-group_change_edit = 'X'.

gv_layout1-f2code = 'DISPLAY'.

ENDFORM. " build_layout

Hope this will help you

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

simple program here in this link

Read only

Former Member
0 Likes
839

hi ,

read this brief docu.

B. 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 catalog. 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:

1. Export:

a. I_program_name : report id

b. I_internal_tabname : the internal output table

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

2. Changing

ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is declared in

the type pool SLIS.

Read only

Former Member
0 Likes
839

Hi,

normally we can generate field catalog by our self by

using structure 'slis_fieldcat_alv'

which have fields like fieldname , itabname, edit, do_sum...etc.

here we r generating work area and appending to internal table of type 'slis_t_fieldcat_alv' to format the data output.

2. But instead of above u can also generate fieldcatalog by using function module 'REUSE_ALV_FIELDCATALOG_MERGE' HERE

U R PASSING TWO PARAMETERS to this FM

ie.

IMPORT

u r internal table

EXPORT

fieldcatalog internal table of type slis_t_fieldcat_alv.

here output of this consist field catalog itab with format of data to display on grid or list.

then u can directly pass to FM

REUSE_ALV_GRID_DISPLAY or REUSE_ALV_LIST_DISPLAY