2007 Aug 27 2:27 PM
hi i am getting a short bump when trying to execute this program.
pls help me
DATA : iheading TYPE z099-heading.
Tables
*DATA: LT_DATA type ref to DATA.
DATA: LT_FIELDCATALOG type LVC_T_FCAT.
Structure
DATA: LS_FIELDCATALOG type LVC_S_FCAT.
.
DATA: T_OUTPUT TYPE REF TO DATA .
FIELD-SYMBOLS: <T_OUTPUT> TYPE TABLE.
call method cl_alv_table_create=>create_dynamic_table
Exporting
IT_FIELDCATALOG = lt_fieldcatalog
Importing
EP_TABLE = t_output
.
ASSIGN t_output->* TO <t_output>.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-repid
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 = LT_FIELDCATALOG
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
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = <T_OUTPUT>.
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.
2007 Aug 27 2:37 PM
Here is your corrected code, first you need to fill the LT_FIELDCATALOG, also you then need to convert that field catalog to the other structure which is used by the REUSE function module. .
report zrich_0001 .
*data : iheading type z099-heading.
**** Tables
*DATA: LT_DATA type ref to DATA.
data: lt_fieldcatalog type lvc_t_fcat.
*** Structure
data: ls_fieldcatalog type lvc_s_fcat.
* REUSE structures from SLIS
type-pools: slis.
data: it_alvfc type slis_t_fieldcat_alv,
wa_alvfc type slis_fieldcat_alv.
data: repid type sy-repid.
data: t_output type ref to data .
field-symbols: <t_output> type table.
* Create fields .
do 10 times.
clear ls_fieldcatalog.
ls_fieldcatalog-fieldname = sy-index.
ls_fieldcatalog-datatype = 'CHAR'.
ls_fieldcatalog-intlen = 5.
ls_fieldcatalog-seltext = sy-index.
shift ls_fieldcatalog-seltext left deleting leading space.
concatenate 'FIELD' ls_fieldcatalog-seltext
into ls_fieldcatalog-seltext.
condense ls_fieldcatalog-seltext no-gaps.
append ls_fieldcatalog to lt_fieldcatalog .
enddo.
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = lt_fieldcatalog
importing
ep_table = t_output
.
assign t_output->* to <t_output>.
* Build FC for ALV(REUSE)
loop at lt_fieldcatalog into ls_fieldcatalog.
wa_alvfc-fieldname = ls_fieldcatalog-fieldname.
wa_alvfc-seltext_s = ls_fieldcatalog-seltext.
wa_alvfc-outputlen = ls_fieldcatalog-intlen.
append wa_alvfc to it_alvfc.
endloop.
repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
i_callback_program = repid " Don't pass SY-REPID directly
* 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 = it_alvfc "<-- Use REUSE feild cat
* 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
* IT_ALV_GRAPHICS =
* IT_ADD_FIELDCAT =
* IT_HYPERLINK =
* I_HTML_HEIGHT_TOP =
* I_HTML_HEIGHT_END =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = <t_output>.
* 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.
Regards,
Rich Heilman
2007 Aug 27 3:02 PM
hi Rich
thank u for ur immediate response.
my actual problem is
i have a ztable with 2 fields (seqno and heading)
now my req is to place the data from heading column as a header to alv display.
eg:
seqno heading
1 a
2 b
my alv report must look as
a b - -
--
pls help me.
2007 Aug 27 2:37 PM
Hi,
Please give more info on the dump ?
DATA : iheading TYPE z099-heading.
**** Tables
*DATA: LT_DATA type ref to DATA.
DATA: LT_FIELDCATALOG type LVC_T_FCAT.
*** Structure
DATA: LS_FIELDCATALOG type LVC_S_FCAT.
.
DATA: T_OUTPUT TYPE REF TO DATA .
FIELD-SYMBOLS: <T_OUTPUT> TYPE TABLE.
"<<<< Whether it_fieldcatalog have a values??
call method cl_alv_table_create=>create_dynamic_table
Exporting
IT_FIELDCATALOG = lt_fieldcatalog
Importing
EP_TABLE = t_output
.
ASSIGN t_output->* TO <t_output>.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-repid "<<<< change to variable having sy-repid
* 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 = LT_FIELDCATALOG
* 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
* IT_ALV_GRAPHICS =
* IT_ADD_FIELDCAT =
* IT_HYPERLINK =
* I_HTML_HEIGHT_TOP =
* I_HTML_HEIGHT_END =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = <T_OUTPUT>[] " << Change this
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
aRs