‎2009 Feb 03 5:18 PM
Hi,
I am working on developing a report in ALV and came across an issue with the FM 'REUSE_ALV_FIELDCATALOG_MERGE'. Here is the code..
data: alv_fc type table of slis_fieldcat_alv with header line,
Data: Begin of error occurs 0,
pernr(12),
empname(40),
paystartdate(15),
payenddate(15),
amount(15),
warning(50),
End of error.
Data: error_alv like error occurs 0 with header line.
THE CODE...
error_alv has the data records that need to be displayed on ALV.
clear alv_fc[].
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
*i_program_name = sy-repid
i_internal_tabname = 'error_alv'
*i_inclname = sy-repid
CHANGING
ct_fieldcat = alv_fc[] ...........>
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
if sy-subrc <> 0.
message e007(hrben00listreports).
endif.
It is throwing an runtime error that the filed type is not matching between alv_fc[] and error_alv.
what am I missing here?
Any thoughts?
Thanks,
VG
‎2009 Feb 03 6:05 PM
First of all the structure u pass should be DDIC structure.you should not do type ,but make structure in se11..
and define the changing parameter alv_fc of type slis_t_fieldcat_alv.
jus use:
DATA: alv_fc TYPE slis_t_fieldcat_alv.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = error_tab defined in se11
CHANGING
ct_fieldcat = alv_fc.
EXCEPTIONS
OTHERS = 1.
hope it solves...
Edited by: pratyush v on Feb 3, 2009 7:05 PM
Edited by: pratyush v on Feb 3, 2009 7:07 PM
Edited by: pratyush v on Feb 3, 2009 7:08 PM
‎2009 Feb 03 6:05 PM
First of all the structure u pass should be DDIC structure.you should not do type ,but make structure in se11..
and define the changing parameter alv_fc of type slis_t_fieldcat_alv.
jus use:
DATA: alv_fc TYPE slis_t_fieldcat_alv.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = error_tab defined in se11
CHANGING
ct_fieldcat = alv_fc.
EXCEPTIONS
OTHERS = 1.
hope it solves...
Edited by: pratyush v on Feb 3, 2009 7:05 PM
Edited by: pratyush v on Feb 3, 2009 7:07 PM
Edited by: pratyush v on Feb 3, 2009 7:08 PM
‎2009 Feb 03 6:19 PM
Thanks, I knew that but I wanted to do it without creating the strucutre and directly reading the data from the internal table to the ALV field catalog. I understood that it does not work.
VG
‎2009 Feb 03 6:12 PM
Try this:
DATA: g_fieldcat_tab TYPE slis_t_fieldcat_alv,
w_fieldcat_tab TYPE LINE OF slis_t_fieldcat_alv.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'LT_VBAK' " caps
i_structure_name = 'VBAP' "caps
CHANGING
ct_fieldcat = g_fieldcat_tab[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.