‎2006 Feb 21 6:21 PM
hi all
i wrote an alv program and executed it.it is giving a short dump saying 'no_fieldcatalog_available'.also i cheked the contents of the fieldcatalog but it is not populated.i am sending u the code.plz help me out
regards
sandeep
REPORT ZVV_ALVREPORT .
TYPE-POOLS SLIS.
tables: ekko, ekpo.
types: begin of t_ekko,
ebeln like ekko-ebeln,
end of t_ekko.
types: begin of t_ekpo,
ebeln like ekpo-ebeln,
ebelp like ekpo-ebelp,
matnr like ekpo-matnr,
bukrs like ekpo-bukrs,
werks like ekpo-werks,
end of t_ekpo.
data: i_ekko type t_ekko occurs 0 with header line,
i_ekpo type t_ekpo occurs 0 with header line.
select-options s_ebeln for ekko-ebeln.
initialization.
at selection-screen.
start-of-selection.
select ebeln
from ekko into table i_ekko
where ebeln in s_ebeln.
if not i_ekko[] is initial.
select ebeln
ebelp
matnr
bukrs
werks
from ekpo into table i_ekpo
for all entries in i_ekko
where ebeln = i_ekko-ebeln .
endif.
data: repid like sy-repid.
repid = sy-repid.
DATA fieldcat TYPE slis_t_fieldcat_alv.
DATA fieldcat1 TYPE slis_t_fieldcat_alv.
DATA I_EVENTS TYPE SLIS_T_EVENT.
DATA WA_EVENTS TYPE SLIS_ALV_EVENT.
perform fill_fieldcatlog.
PERFORM FILL_FIELDCATALOG1.
PERFORM ALV_EVENTS.
PERFORM ALV_GRID.
PERFORM ALV_GRID1.
&----
*& Form fill_fieldcatlog
&----
form fill_fieldcatlog .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = repid
I_INTERNAL_TABNAME = 'I_EKKO'
i_inclname = repid
CHANGING
ct_fieldcat = fieldcat.
endform. " fill_fieldcatlog
&----
*& Form FILL_FIELDCATALOG1
&----
form FILL_FIELDCATALOG1 .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = REPID
I_INTERNAL_TABNAME = 'I_EKPO'
I_STRUCTURE_NAME = EKPO
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME =
I_BYPASSING_BUFFER = 'X'
I_BUFFER_ACTIVE = ' '
CHANGING
ct_fieldcat = FIELDCAT1
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.
endform. " FILL_FIELDCATALOG1
&----
*& Form ALV_EVENTS
&----
form ALV_EVENTS .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = I_EVENTS
EXCEPTIONS
LIST_TYPE_WRONG = 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.
READ TABLE I_EVENTS INTO WA_EVENTS WITH KEY = slis_ev_top_of_page.
IF SY-SUBRC = 0.
WA_EVENTS-FORM = 'TOP_OF_PAGE'.
APPEND WA_EVENTS TO I_EVENTS.
CLEAR WA_EVENTS.
ENDIF.
endform. " ALV_EVENTS
FORM TOP_OF_PAGE.
DATA:I_COMMENTARY TYPE SLIS_T_LISTHEADER,
WA_COMMENTARY TYPE slis_listheader.
WA_COMMENTARY-TYP = 'H'.
WA_COMMENTARY-INFO = 'ZVV_ALVREPORT' .
append wa_commentary to i_commentary.
clear wa_commentary.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = I_COMMENTARY
I_LOGO =
I_END_OF_LIST_GRID =
.
ENDFORM.
&----
*& Form ALV_GRID
&----
form ALV_GRID .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = 'X'
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 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 = EKKO
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = 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
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = I_EKKO
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.
endform. " ALV_GRID
&----
*& Form ALV_GRID1
&----
form ALV_GRID1 .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = 'X'
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = 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 = EKPO
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = FIELDCAT1
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_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = I_EKPO
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.
‎2006 Feb 21 6:28 PM
You cannot use this function module if your internal table is defined using a TYPE. Instead, if you define your internal table as follows, you should be fine.
DATA: BEGIN OF i_ekko OCCURS 0,
ebeln LIKE ekko-ebeln.
DATA: END OF I_ekko.
DATA: BEGIN OF i_ekpo OCCURS 0,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
matnr LIKE ekpo-matnr,
bukrs LIKE ekpo-bukrs,
werks LIKE ekpo-werks,
DATA: END OF i_ekpo.It is a known limitation of this function module.
‎2006 Feb 21 6:23 PM
When you pass internal table FIELDCAT to the report generating fm, use square brackets '[ ]'. This should help.
For eg
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
i_grid_settings = wa_grid_settings
is_layout = wa_layout
it_fieldcat = tb_fieldcatalog[]
i_save = 'A'
it_events = tb_events[]
tables
t_outtab = tb_final
exceptions
program_error = 1
others = 2.
Message was edited by: Ashish Gundawar
‎2006 Feb 21 6:25 PM
Hi
If you use TYPES statament to define the structure of output table, the ALV fm for merge can't load that definition, try to define the tables I_EKKO and I_EKPO in this way:
DATA: begin of i_ekko occurs 0,
ebeln like ekko-ebeln,
end of i_ekko.
DATA: begin of i_ekpo occurs 0,
ebeln like ekpo-ebeln,
ebelp like ekpo-ebelp,
matnr like ekpo-matnr,
bukrs like ekpo-bukrs,
werks like ekpo-werks,
end of i_ekpo.
Max
‎2006 Feb 21 6:44 PM
hi max
thanx for ur help
even srinivas and vijay babu suggested me to do the same changes.
i did make the changes and it is working properly to an extent.
the second fieldcatalog is not populated and therefore i am not getting the complete output
can anyone plz suggest some solution
regards
sandeep
‎2006 Feb 21 6:46 PM
Did you see this part in the previous post.
call function 'REUSE_ALV_FIELDCATALOG_MERGE' exporting
i_program_name = repid
i_internal_tabname = 'I_EKPO'
* I_STRUCTURE_NAME = EKPO*
* I_CLIENT_NEVER_DISPLAY = 'X'
<b> I_INCLNAME = repid <-- you were missing this </b>
* I_BYPASSING_BUFFER = 'X'
* I_BUFFER_ACTIVE = ' '
.............
REgards,
Rich Heilman
‎2006 Feb 21 6:46 PM
in the second u had forgot
I_INCLDE = repid
as Rich had pointed out
‎2006 Feb 21 6:47 PM
‎2006 Feb 21 6:51 PM
the same you need to mention for second also..
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
<b>I_PROGRAM_NAME = REPID
I_INTERNAL_TABNAME = 'I_EKPO'
I_INCLNAME = REPID</b>
CHANGING
ct_fieldcat = FIELDCAT1
* 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.
‎2006 Feb 21 6:26 PM
try the one in bold
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = repid
I_INTERNAL_TABNAME = 'I_EKKO'
<b>I_STRUCTURE_NAME = 'I_EKKO'</b>
i_inclname = repid
CHANGING
ct_fieldcat = fieldcat
‎2006 Feb 21 6:28 PM
You cannot use this function module if your internal table is defined using a TYPE. Instead, if you define your internal table as follows, you should be fine.
DATA: BEGIN OF i_ekko OCCURS 0,
ebeln LIKE ekko-ebeln.
DATA: END OF I_ekko.
DATA: BEGIN OF i_ekpo OCCURS 0,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
matnr LIKE ekpo-matnr,
bukrs LIKE ekpo-bukrs,
werks LIKE ekpo-werks,
DATA: END OF i_ekpo.It is a known limitation of this function module.
‎2006 Feb 21 6:40 PM
I have made some mods to your program. Highlighted in BOLD.
report zvv_alvreport .
type-pools slis.
tables: ekko, ekpo.
<b>*types: begin of t_ekko,
*ebeln like ekko-ebeln,
*end of t_ekko.
*types: begin of t_ekpo,
*ebeln like ekpo-ebeln,
*ebelp like ekpo-ebelp,
*matnr like ekpo-matnr,
*bukrs like ekpo-bukrs,
*werks like ekpo-werks,
*end of t_ekpo.
*
*data: i_ekko type t_ekko occurs 0 with header line,
*i_ekpo type t_ekpo occurs 0 with header line.
DATA: BEGIN OF i_ekko OCCURS 0,
ebeln LIKE ekko-ebeln,
END OF I_ekko.
DATA: BEGIN OF i_ekpo OCCURS 0,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
matnr LIKE ekpo-matnr,
bukrs LIKE ekpo-bukrs,
werks LIKE ekpo-werks,
END OF i_ekpo.</b>
select-options s_ebeln for ekko-ebeln.
initialization.
at selection-screen.
start-of-selection.
select ebeln
from ekko into table i_ekko
where ebeln in s_ebeln.
if not i_ekko[] is initial.
select ebeln
ebelp
matnr
bukrs
werks
from ekpo into table i_ekpo
for all entries in i_ekko
where ebeln = i_ekko-ebeln .
endif.
data: repid like sy-repid.
repid = sy-repid.
data fieldcat type slis_t_fieldcat_alv.
data fieldcat1 type slis_t_fieldcat_alv.
data i_events type slis_t_event.
data wa_events type slis_alv_event.
perform fill_fieldcatlog.
perform fill_fieldcatalog1.
perform alv_events.
perform alv_grid.
perform alv_grid1.
*&---------------------------------------------------------------------*
*& Form fill_fieldcatlog
*&---------------------------------------------------------------------*
form fill_fieldcatlog .
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = repid
i_internal_tabname = 'I_EKKO'
i_inclname = repid
changing
ct_fieldcat = fieldcat.
endform.
*&---------------------------------------------------------------------*
*& Form FILL_FIELDCATALOG1
*&---------------------------------------------------------------------*
form fill_fieldcatalog1 .
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = repid
i_internal_tabname = 'I_EKPO'
* I_STRUCTURE_NAME = EKPO
** I_CLIENT_NEVER_DISPLAY = 'X'
<b> I_INCLNAME = repid <-- you were missing this</b>
* I_BYPASSING_BUFFER = 'X'
* I_BUFFER_ACTIVE = ' '
changing
ct_fieldcat = fieldcat1
* 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.
endform.
*&---------------------------------------------------------------------*
*& Form ALV_EVENTS
*&---------------------------------------------------------------------*
form alv_events .
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = i_events
* EXCEPTIONS
* LIST_TYPE_WRONG = 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.
read table i_events into wa_events with key = slis_ev_top_of_page.
if sy-subrc = 0.
wa_events-form = 'TOP_OF_PAGE'.
append wa_events to i_events.
clear wa_events.
endif.
endform.
*---------------------------------------------------------------------*
* FORM TOP_OF_PAGE *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form top_of_page.
data:i_commentary type slis_t_listheader,
wa_commentary type slis_listheader.
wa_commentary-typ = 'H'.
wa_commentary-info = 'ZVV_ALVREPORT' .
append wa_commentary to i_commentary.
clear wa_commentary.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = i_commentary
* I_LOGO =
* I_END_OF_LIST_GRID =
.
endform.
*&---------------------------------------------------------------------*
*& Form ALV_GRID
*&---------------------------------------------------------------------*
form alv_grid .
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = 'X'
* I_BUFFER_ACTIVE = ' '
i_callback_program = 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 = EKKO
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
it_fieldcat = 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
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* I_HTML_HEIGHT_TOP =
* I_HTML_HEIGHT_END =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = i_ekko
* 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.
endform.
*&---------------------------------------------------------------------*
*& Form ALV_GRID1
*&---------------------------------------------------------------------*
form alv_grid1 .
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = 'X'
* I_BUFFER_ACTIVE = ' '
i_callback_program = 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 = EKPO
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
it_fieldcat = fieldcat1
* 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_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* I_HTML_HEIGHT_TOP =
* I_HTML_HEIGHT_END =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = i_ekpo
* 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.
endform.
This is working good in my system.
Regards,
Rich Heilman
‎2006 Feb 21 6:37 PM
Hi,
instead of type declaration use like
data: begin of i_ekpo occurs 0,
ebeln like ekko-ebeln,
....
.........
end of i_ekpo.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
<b>I_PROGRAM_NAME = REPID
I_INTERNAL_TABNAME = 'I_EKPO'
I_INCLNAME = REPID</b>
CHANGING
ct_fieldcat = FIELDCAT1
* 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.Regards
vijay