07-23-2007 9:16 PM
Hi all,
I have got a query in ALV. I want to build the field catalog . I am using the following statement:
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'ITAB_DATA1'
i_bypassing_buffer = 'X'
i_buffer_active = ' '
CHANGING
CT_FIELDCAT = I_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
The data declarations are as follows :
TYPE-POOLS : SLIS.
DATA :
ITAB_DATA! type standard table of ZDETAILS1.
DATA : I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
But the Changing parameter I_FIELDCAT is never getting filled up.
Please clarify me on how to populate the Changing parameter I_FIELDCAT.
Kindly reply as fast as possible.
Regards,
Vijay
07-23-2007 9:19 PM
First of all, do not pass SY-REPID directly, use a variable, and second, the internal table needs to be defined using the LIKE instead of TYPE. See this program which works well.
report zrich_0002 .
type-pools: slis.
data: begin of xma,
matnr like makt-matnr,
maktx like makt-maktx,
end of xma.
data: ima like standard table of xma with header line.
data: fieldcat type slis_t_fieldcat_alv.
data: repid type syrepid.
repid = sy-repid.
select matnr maktx
into table ima
from makt
up to 100 rows
where spras = sy-langu.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = repid
i_internal_tabname = 'XMA'
i_inclname = repid
i_bypassing_buffer = 'X'
changing
ct_fieldcat = fieldcat.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = fieldcat
tables
t_outtab = ima.
Regards,
Rich Heilman
07-23-2007 9:34 PM
Make sure that your ITAB_DATA1 has all the fields defined using LIKE and has no deep structures within its definition. Also use a variable to capture the value of SY-REPID and pass that variable to the function module call.
This is a limitation of the function module.