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: 

use and inputs fields for reuse_alv_fieldcat_merge

Former Member
0 Kudos
159

Hi all,

could any one please tell me what is the use of reuse_alv_fieldcat_merge function module

and what are the different inputs we have to give for that function module. I have tried but getting short dump .

thanks in advance

regards

Vardhan

1 ACCEPTED SOLUTION

Former Member
0 Kudos
99

Main purpose of it is to build the field catalog automatically for the output table passed to REUSE_ALV_GRID/LIST_DISPLAY.

Use of this FM:

1. 1st declare the type for the internal table

types: begin of ty_purchasing,

vrsio like s012-vrsio, " Version number in the

" info structure

spwoc like s012-spwoc, " Period to analyze-week

ekorg like s012-ekorg, " Purchasing organization

lifnr like s012-lifnr, " Vendor no.

matnr like s012-matnr, " Material no.

werks like s012-werks, " Plant

basme like s012-basme, " Base unit of measure

menge like s012-menge, " Purchase order quantity

netwr like s012-netwr, " Effective order value

name1 like lfa1-name1, " Vendor name

maktx like makt-maktx, " Material description

ekgrp like marc-ekgrp, " Purchasing group

end of ty_purchasing.

All fields must be declared with LIKE not with TYPE otherwise FM

REUSE_ALV_FIELDCATALOG_MERGE will not work.

2. Define the internal table

data: i_purchasing type standard table of ty_purchasing initial size 0 with header line.

3. Pass the internal table name to fm REUSE_ALV_FIELDCATALOG_MERGE

call function 'REUSE_ALV_FIELDCATALOG_MERGE'

exporting

i_program_name = sy-repid " Internal table

" declaration program

i_internal_tabname = 'I_PURCHASING'" Output table name

changing

ct_fieldcat = i_fieldcat " Field catalog with

" field descriptions

exceptions

inconsistent_interface = 1

program_error = 2

others = 3

.

if sy-subrc 0.

message i000 with text-012. " Error using function

" module REUSE_ALV_

" FIELDCATALOG_MERGE

leave list-processing.

endif.

Regards,

joy.

5 REPLIES 5

Former Member
0 Kudos
100

Main purpose of it is to build the field catalog automatically for the output table passed to REUSE_ALV_GRID/LIST_DISPLAY.

Use of this FM:

1. 1st declare the type for the internal table

types: begin of ty_purchasing,

vrsio like s012-vrsio, " Version number in the

" info structure

spwoc like s012-spwoc, " Period to analyze-week

ekorg like s012-ekorg, " Purchasing organization

lifnr like s012-lifnr, " Vendor no.

matnr like s012-matnr, " Material no.

werks like s012-werks, " Plant

basme like s012-basme, " Base unit of measure

menge like s012-menge, " Purchase order quantity

netwr like s012-netwr, " Effective order value

name1 like lfa1-name1, " Vendor name

maktx like makt-maktx, " Material description

ekgrp like marc-ekgrp, " Purchasing group

end of ty_purchasing.

All fields must be declared with LIKE not with TYPE otherwise FM

REUSE_ALV_FIELDCATALOG_MERGE will not work.

2. Define the internal table

data: i_purchasing type standard table of ty_purchasing initial size 0 with header line.

3. Pass the internal table name to fm REUSE_ALV_FIELDCATALOG_MERGE

call function 'REUSE_ALV_FIELDCATALOG_MERGE'

exporting

i_program_name = sy-repid " Internal table

" declaration program

i_internal_tabname = 'I_PURCHASING'" Output table name

changing

ct_fieldcat = i_fieldcat " Field catalog with

" field descriptions

exceptions

inconsistent_interface = 1

program_error = 2

others = 3

.

if sy-subrc 0.

message i000 with text-012. " Error using function

" module REUSE_ALV_

" FIELDCATALOG_MERGE

leave list-processing.

endif.

Regards,

joy.

0 Kudos
99

Hi Joyjit Ghosh,

I did the same thing which you have specified in the example. But i am getting message as fieldcatalog not found. Could you please tell what i did wrong in the given code.

*Global Declarations

TYPE-POOLS : slis.

  • TABLES

TABLES : edidc,edid4.

DATA : BEGIN OF g_tab occurs 10000,

docnum like edidc-docnum,

credat like edidc-credat,

status like edidc-status,

kunnr like vbak-kunnr,

partn like but0id-partner,

END OF g_tab.

DATA : l_tab type standard table of t_tab initial size 0 with header line,

i_fieldcat type slis_t_fieldcat_alv,

wa_fieldcat type slis_fieldcat_alv,

l_repid type sy-repid.

DATA v_sdata(30).

*selection screen

SELECT-OPTIONS: s_docnum FOR edidc-docnum.

SELECT-OPTIONS: s_credat FOR edidc-credat.

SELECT-OPTIONS: s_status FOR edidc-status.

*Start Of Selection

START-OF-SELECTION.

SELECT docnum

credat

status FROM edidc INTO corresponding fields of TABLE g_tab

WHERE docnum IN s_docnum AND

credat IN s_credat AND

status IN s_status.

DATA: l_bp TYPE but0id-partner.

LOOP AT g_tab.

SELECT * from edid4 where

docnum = g_tab-docnum.

IF edid4-segnam EQ 'E1BPMEPOHEADER'.

SELECT SINGLE t1~partner INTO l_bp

FROM but0id as t1

join /nyh/bpcremast as t2 on t1type = t2type

WHERE idnumber = edid4-sdata+10(10). "BP segment in IDOC

  • AND ( type = 'BUP001' OR type = 'BUP002'

  • OR type = 'BUP007' OR type = 'BUP010').

g_tab-kunnr = edid4-sdata+3(10).

g_tab-partn = l_bp.

IF sy-subrc = 0.

write :/'before replacing ', edid4-sdata+10(10).

REPLACE edid4-sdata+10(10) WITH l_bp

INTO edid4-sdata+10(10).

IF sy-subrc = 0." AND upd_bp = 'X'.

write 😕 'After replacing ', edid4-sdata+10(10).

ENDIF.

ENDIF.

ENDIF.

ENDSELECT.

ENDLOOP.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = sy-repid

I_INTERNAL_TABNAME = 'G_TAB'

CHANGING

CT_FIELDCAT = i_fieldcat.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE = ' '

I_CALLBACK_PROGRAM = l_repid

  • 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

  • IR_SALV_LIST_ADAPTER =

  • IT_EXCEPT_QINFO =

  • I_SUPPRESS_EMPTY_DATA = ABAP_FALSE

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = g_tab.

Thanks in advance

Vardhan

vinod_vemuru2
Active Contributor
0 Kudos
99

Hi,

This FM is used to build the fieldcat automatically. U got that dump because ur fieldcat might be empty. Check the fieldcat after calling this FM.

Probably u defined ur internal table fields using TYPE

eg: vbeln TYPE vbak-vbeln.

Instead of this u have to use key work LIKE

eg: vbeln LIKE vbak-vbeln.

Check this and get back.

Also check the sample code given by Jotjit.

Thanks,

Vinod.

Former Member
0 Kudos
99

Hi Vishnuvardhan,

'REUSE_ALV_FIELDCATALOG_MERGE' is used to build fieldcatalog according to the passed internal table.if u r passing standard table then u have to give structure name of that table I_STRUCTURE_NAME = 'MARA' and if u r picking up the fields from different table then u need to create a sructure according to the internal table in se11 and then u pass that structure to the field I_STRUCTURE_NAME = ' ' i hope u get my point here is a short program just go through this.... ur program is going on dump just bcoz the structure u r passing is not defined in se11.

tables: mara.

type-pools:slis.

data: itab like table of mara .

data: fcat type slis_t_fieldcat_alv.

data i_repid like sy-repid.

select matnr from mara into table itab.

i_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = i_repid

I_INTERNAL_TABNAME = 'ITAB'

I_STRUCTURE_NAME = 'MARA'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

CHANGING

ct_fieldcat = fcat

  • 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_GRID_DISPLAY'

EXPORTING

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

  • I_CALLBACK_PROGRAM = ' '

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

  • I_STRUCTURE_NAME =

  • I_BACKGROUND_ID = ' '

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

IT_FIELDCAT = fcat

  • 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

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

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

Reward points if helpful.

Thanks & Regards

Ashu Singh.

0 Kudos
99

Hi ashu singh,

Thank you for replying. creating structure in se11 is not compulsory i think . Even in the above example they created structure in SE38 and they are using in the same program.could you please check out some other view .Even i found some other source in which they are using straight away in se38 with out going to se11. Thanks in advance.

Regards

Vardhan