‎2007 May 06 8:49 AM
Hi Friends,
I am having data in the final internal table and displaying in the table control, user wants to print the data available in the table control, I tried for the print option cannot get it. I am planning to use the ALV for printing purpose. when I am trying to send my final internal table data to the function
'REUSE_ALV_FIELDCATALOG_MERGE' it is not populating can any one send me the sample code for this function module. I am using table types in declaration.
Thanx in advance,
Line
‎2007 May 06 9:27 AM
Since it might not be an DDIC structure which ur are passing to the function module.
so u can define ur catalog as this way.
DATA: i_fieldcat TYPE slis_t_fieldcat_alv.
DATA : wa_fieldcat TYPE slis_fieldcat_alv.
wa_fieldcat-tabname ='I_KNA1'.
wa_fieldcat-fieldname = 'CHCK_BOX'.
wa_fieldcat-seltext_l = 'SELECT '.
wa_fieldcat-checkbox = 'X'.
wa_fieldcat-edit = 'X'.
wa_fieldcat-col_pos = 1.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
wa_fieldcat-tabname = 'I_KNA1'.
wa_fieldcat-fieldname = 'TRAFFIC_LIGHTS'.
wa_fieldcat-seltext_l = 'LIGHTS '.
wa_fieldcat-col_pos = 2.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
wa_fieldcat-tabname = 'I_KNA1'.
wa_fieldcat-fieldname = 'NAME1'.
wa_fieldcat-seltext_l = text-001.
*wa_fieldcat-outputlen = 15.
wa_fieldcat-col_pos = 3.
wa_fieldcat-emphasize = 'C600'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'I_KNA1'.
wa_fieldcat-fieldname = 'NAME2'.
wa_fieldcat-seltext_l = text-002.
*wa_fieldcat-outputlen = 15.
wa_fieldcat-col_pos = 4.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'I_KNA1'.
wa_fieldcat-fieldname = 'ORT01'.
wa_fieldcat-seltext_l = text-003.
*wa_fieldcat-outputlen = 15.
wa_fieldcat-col_pos = 5.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'I_KNA1'.
wa_fieldcat-fieldname = 'SPRAS'.
wa_fieldcat-seltext_l = text-004.
*wa_fieldcat-outputlen = 15.
wa_fieldcat-col_pos = 6.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
‎2007 May 06 9:11 AM
Refer the following code:
report z_test_palv .
tables : mara.
select-options: s_matnr for mara-matnr.
type-pools: slis.
data: begin of itab occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
ersda like mara-ersda,
labor like mara-labor,
end of itab.
data: i_fieldcat type slis_t_fieldcat_alv,
xevents type slis_t_event,
ls_event type slis_alv_event,
slis_ev_top type slis_formname value 'TOP_OF_PAGE'.
data: v_repid like sy-repid.
start-of-selection.
v_repid = sy-repid.
select matnr ernam ersda labor
into table itab
from mara
where matnr in s_matnr.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = xevents
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 xevents with key name = slis_ev_top
into ls_event.
if sy-subrc = 0.
move slis_ev_top to ls_event-form.
append ls_event to xevents.
endif.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = v_repid
i_internal_tabname = 'ITAB'
* I_STRUCTURE_NAME =
* I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = v_repid
i_bypassing_buffer = 'X'
i_buffer_active = ' '
changing
ct_fieldcat = i_fieldcat
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_LIST_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
i_bypassing_buffer = 'X'
i_buffer_active = ' '
i_callback_program = v_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 = 'A'
* IS_VARIANT =
it_events = xevents
* 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
* 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.
*&--------------------------------------------------------------------*
*& Form top_of_page
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
form top_of_page.
write:/ 'Top of page event triggered.
WRITE:/ This report gives the material details'.
endform. "top_of_page
‎2007 May 06 9:27 AM
Since it might not be an DDIC structure which ur are passing to the function module.
so u can define ur catalog as this way.
DATA: i_fieldcat TYPE slis_t_fieldcat_alv.
DATA : wa_fieldcat TYPE slis_fieldcat_alv.
wa_fieldcat-tabname ='I_KNA1'.
wa_fieldcat-fieldname = 'CHCK_BOX'.
wa_fieldcat-seltext_l = 'SELECT '.
wa_fieldcat-checkbox = 'X'.
wa_fieldcat-edit = 'X'.
wa_fieldcat-col_pos = 1.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
wa_fieldcat-tabname = 'I_KNA1'.
wa_fieldcat-fieldname = 'TRAFFIC_LIGHTS'.
wa_fieldcat-seltext_l = 'LIGHTS '.
wa_fieldcat-col_pos = 2.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
wa_fieldcat-tabname = 'I_KNA1'.
wa_fieldcat-fieldname = 'NAME1'.
wa_fieldcat-seltext_l = text-001.
*wa_fieldcat-outputlen = 15.
wa_fieldcat-col_pos = 3.
wa_fieldcat-emphasize = 'C600'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'I_KNA1'.
wa_fieldcat-fieldname = 'NAME2'.
wa_fieldcat-seltext_l = text-002.
*wa_fieldcat-outputlen = 15.
wa_fieldcat-col_pos = 4.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'I_KNA1'.
wa_fieldcat-fieldname = 'ORT01'.
wa_fieldcat-seltext_l = text-003.
*wa_fieldcat-outputlen = 15.
wa_fieldcat-col_pos = 5.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'I_KNA1'.
wa_fieldcat-fieldname = 'SPRAS'.
wa_fieldcat-seltext_l = text-004.
*wa_fieldcat-outputlen = 15.
wa_fieldcat-col_pos = 6.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
‎2007 May 06 9:33 AM
Hi
I tried with it I am getting message 'Field catalog not found' I am afraid of the reason for this error, Can u pls tell me how to solve the error.
Regards,
Line
‎2007 May 06 9:36 AM
<b>Have you declare the field catalog rightly like below:</b>
data: i_fieldcat type slis_t_fieldcat_alv.