Classical Report on clicking button on ALV Report
I have a requirement where I have to display a classical report based on the user-click on a "custom button" on my ALV. I am unable to display the classical report. Please help with code example..
Hi,
See the example.Change the code according to your requirement.
*& Report ZDEMO_ALVGRID *
*& Example of a simple ALV Grid Report *
*& The basic requirement for this demo is to display a number of *
*& fields from the EKKO table. *
REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid,
gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
form build_fieldcatalog.
There are a number of ways to create a fieldcat.
For the purpose of this example i will build the fieldcatalog manualy
by populating the internal table fields individually and then
appending the rows. This method can be the most time consuming but can
also allow you more control of the final product.
Beware though, you need to ensure that all fields required are
populated. When using some of functionality available via ALV, such as
total. You may need to provide more information than if you were
simply displaying the result
I.e. Field type may be required in-order for
the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'.
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
is_variant = z_template
tables
t_outtab = it_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. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
endform. " DATA_RETRIEVAL
Form TOP-OF-PAGE *
ALV Report Header *
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
append wa_header to t_header.
clear: wa_header.
Total No. of Records Selected
describe table it_ekko lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Records Selected: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
i_logo = 'Z_LOGO'.
endform.
FORM USER_COMMAND *
--> R_UCOMM *
--> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
Check function code
CASE r_ucomm.
WHEN '&IC1'.
Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'EBELN'.
Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
*& Form BUILD_EVENTS
Build events table
form build_events.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gt_events[].
read table gt_events with key name = slis_ev_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform. " BUILD_EVENTS
*& Form BUILD_PRINT_PARAMS
Setup print parameters
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
*& Form END_OF_PAGE
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
endform.
*& Form END_OF_LIST
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
skip.
write:/40 'Page:', sy-pagno .
endform.
Pls. reward if useful...
Similar Messages
-
Add buttons in ALV Report output
Dear Friends,
I am developing one ALV report in PP moule for calculating Shelf Life. The output is coming properly in ALV.
But my additional requirement is ADD coustomise buttons in ALV Reports.
Please give me an idea how can I insert buttons in my alv report?
Thanks & Regards
VasuHi vasu,
consider the code given below.
FORM F4200_PF_STATUS_SET *
FORM f4200_pf_status_set USING i_extab TYPE slis_t_extab.
REFRESH i_extab.
PERFORM f4210_exclude_fcodes CHANGING i_extab.
The PF status is an exact copy of the PF status 'STANDARD' of program
SAPLSALV but with command 'CHNG' added to it.
SET PF-STATUS 'ZSOM_STANDARD' EXCLUDING i_extab.
ENDFORM.
*& Form f4210_exclude_fcodes
FORM f4210_exclude_fcodes USING i_extab TYPE slis_t_extab.
DATA: ws_fcode TYPE slis_extab.
CLEAR ws_fcode.
ws_fcode = '&EB9'. " Call up Report.
APPEND ws_fcode TO i_extab.
ws_fcode = '&ABC'. " ABC Analysis.
APPEND ws_fcode TO i_extab.
ws_fcode = '&NFO'. " Info Select.
APPEND ws_fcode TO i_extab.
ws_fcode = '&LFO'. " Information.
APPEND ws_fcode TO i_extab.
ENDFORM. " f4210_exclude_fcodes
*& Form f4300_user_command
FORM f4300_user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
CASE ucomm.
WHEN '&IC1'. "Double Click line Item
READ TABLE i_data INDEX selfield-tabindex.
IF i_data-qmnum NE space.
SET PARAMETER ID 'IQM' FIELD i_data-qmnum.
CALL TRANSACTION 'IW52' AND SKIP FIRST SCREEN.
CLEAR ucomm.
ENDIF.
WHEN 'CHNG'. " Change Notification Icon
READ TABLE i_data INDEX selfield-tabindex.
IF i_data-qmnum NE space.
SET PARAMETER ID 'IQM' FIELD i_data-qmnum.
CALL TRANSACTION 'IW52' AND SKIP FIRST SCREEN.
CLEAR ucomm.
ENDIF.
ENDCASE.
CLEAR ucomm.
ENDFORM. " f4300_user_command
EXPLANATION
In this program, first we created a PF status (ZSOM_STANDARD), which was an exact copy of STANDARD of program SAPLSALV through transaction SE41 (Menu Painter). Then we added another button to it,with a new fcode called CHNG. After this this we set this PF status instead of STANADRD.
We initialize a third event USER_COMMAND and associate a form with it. In this form we can capture the function codes and write any functionality under it. If we write functionality for an existing fcode, then this gets precedence over the default functionality that might be associated with it.
In this example, we capture a standard fcode &IC1 that is nothing but double clicking a line of the report. We are capturing the notification number of that line and calling transaction IW52 with it. We are also doing the same when a user clicks on the new Change Notification button.
When the user clicks the Back button in IW52, it comes back to the report.
Please reward for the same.
Message was edited by: Prakhar Saxena -
How to create user defined button in alv report
how to create user defined button in alv report
thnks in advance.Hi,
U can define it the the PF-STATUS ( Menu for ALV ).
For that u have to define it in the EVENTCAT.
form z_eventcat using p_i_eventcat type slis_t_event.
data: i_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = p_i_eventcat
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.
clear i_event.
read table p_i_eventcat with key name = slis_ev_top_of_page into
i_event.
if sy-subrc = 0.
move 'TOP_OF_PAGE' to i_event-form.
append i_event to p_i_eventcat.
endif.
read table p_i_eventcat with key name = slis_ev_pf_status_set into i_event.
if sy-subrc = 0.
move 'SET_PF_STATUS' to i_event-form.
append i_event to p_i_eventcat.
endif.
clear i_event.
read table p_i_eventcat into i_event with key name = slis_ev_user_command .
if sy-subrc = 0.
move 'USER_COMMAND' to i_event-form.
append i_event to p_i_eventcat.
endif.
And in the DISPLAY
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = v_progname
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = 'TOP_OF_PAGE'
i_grid_title = v_gridtitle
i_save = 'A'
is_layout = i_layout
it_fieldcat = i_fieldcat[]
it_sort = i_sortinfo
it_events = i_eventcat
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = it_final
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.
*MENU SETTINGS.
form set_pf_status using rt_extab type slis_t_extab.
set pf-status 'ALV_MENU'.
endform. "SET_PF_STATUS
endform. " Z_EVENTCAT
Now double click on ALV MENU nad u can create a button in the application bar.
Regards,
Pritha. -
Information button in ALV report
Information button in ALV report is not working. any suggestion
I have copied standard tool bar from standard program.During debugging, I have found that function code is defferent. Then I changed function code according to that.
-
Control User Specific button in ALV report
Hi,
Can anybody please suggest me how to control "USER SPECIFIC" button in ALV report layout using authorization object. I mean if you can tell me which authorization object is responsible to control the "USER SPECIFIC" button.additional info to what Lakshmi already said:-
normally the restrictions for saving layouts/display variants are done at 2 levels:
1) The developer of an ALV list first predetermines the authorization in the 'i_save' parameter within the code.
I_SAVE = ' ' -
layouts cannot be saved
I_SAVE = 'A' -
user-specific and cross-user layouts can be saved
I_SAVE = 'X' --- cross-user layouts can be saved
I_SAVE = 'U' --- user-specific layouts can be saved
2) The second level comes to us restriciting the S_ALV_LAYO which gives access to users to save global layouts if I_SAVE for that particular transaction is A or X.
for example, a report has I_SAVE= 'A', which means
it will allow to save User-specific layouts without any restrictions.
and if user has S_ALV_LAYO then he can save both User-Specific and Global Layouts(variants).
it would be better to keep this object separate. -
Hi All,
I want to know how to create a button in alv report .
Please respond to my query.
Thanks and Regards,
Amanhi aman,
u can try this example:
where i have a created a button:
*& Report Z_GURU_ALV_EVENT01 *
report z_guru_alv_event01 .
tables: mara, makt.
type-pools slis.
data: begin of imara occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
ersda like mara-ersda,
end of imara.
data: begin of imakt occurs 0,
matnr like mara-matnr,
spras like makt-spras,
maktx like makt-maktx,
end of imakt.
data: ffc type slis_t_fieldcat_alv,
ievents type slis_t_event with header line,
iievent type slis_t_event with header line.
select-options: s_matnr for mara-matnr.
initialization.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = ievents[]
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 ievents with key name = slis_ev_top_of_page.
ievents-form = 'TOPP'.
modify ievents transporting form where name = slis_ev_top_of_page.
clear ievents.
read table ievents with key name = slis_ev_user_command.
ievents-form = 'USR_COM'.
modify ievents transporting form where name = slis_ev_user_command.
clear ievents.
read table ievents with key name = slis_ev_pf_status_set.
ievents-form = 'PFSTAT'.
modify ievents transporting form where name = slis_ev_pf_status_set.
clear ievents.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = iievent[]
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 iievent with key name = slis_ev_pf_status_set.
iievent-form = 'PFSTAT'.
modify iievent transporting form where name = slis_ev_pf_status_set.
clear iievent.
read table iievent with key name = slis_ev_user_command.
iievent-form = 'USERCOM'.
modify iievent transporting form where name = slis_ev_user_command.
clear iievent.
start-of-selection.
select matnr ernam ersda from mara into table imara where matnr
in s_matnr.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = sy-repid
i_internal_tabname = 'IMARA'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = sy-repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
changing
ct_fieldcat = ffc
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_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 = 'ALV_BACKGROUND'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
i_callback_html_end_of_list = 'ALV_BACKGROUND'
I_STRUCTURE_NAME =
i_background_id = 'ALV_BACKGROUND'
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
it_fieldcat = ffc
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = ievents[]
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 = imara
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 topp.
data: it_top type slis_t_listheader,"having s , h ,a
wa type slis_listheader.
IT_SPEC TYPE SLIS_T_SPECIALCOL_ALV,
WA1 TYPE SLIS_SPECIALCOL_ALV.
wa-typ = 'H'.
wa-info = 'RELIANCE GLOBAL SERVICES' .
append wa to it_top.
clear wa.
wa-typ = 'S'.wa-key = 'NO:23'.
wa-info = 'TRIPLICANE HIGH ROAD'.
append wa to it_top.
clear wa.
wa-typ = 'S'.
wa-info = 'TRIPLICANE'.
append wa to it_top.
clear wa.
wa-typ = 'A'.
wa-info = 'sample'.
append wa to it_top.
clear wa.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = it_top
i_logo = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID =
I_ALV_FORM =
endform.
form usr_com using r_ucomm type sy-ucomm r_selfield type slis_selfield.
case r_ucomm.
when 'CANC'.
leave to screen 0.
endcase.
data: ff type slis_t_fieldcat_alv.
data: v_vbeln(18) type n.
v_vbeln = r_selfield-value.
select matnr spras maktx
from makt into table imakt
up to 10 rows
where matnr = v_vbeln.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = sy-repid
i_internal_tabname = 'IMAKT'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = sy-repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
changing
ct_fieldcat = ff
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_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 = ff
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = iievent[]
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
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = imakt
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. "USR_COM
form pfstat using extab type slis_t_extab.
set pf-status 'STD' excluding extab.
endform. " pfstat
form usercom using rucom type sy-ucomm rselfield type slis_selfield.
case rucom.
when 'CANC'.
leave to screen 0.
endcase.
data: ffc type slis_t_fieldcat_alv,
v_matnr(18) type n.
v_matnr = rselfield-value.
select matnr ernam ersda from mara into table imara
where matnr = v_matnr.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = sy-repid
i_internal_tabname = 'IMARA'
I_STRUCTURE_NAME =
I_CLIENT_NEVER_DISPLAY = 'X'
i_inclname = sy-repid
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
changing
ct_fieldcat = ffc
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_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 = ffc
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
it_events = iievent[]
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 = imara
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. -
How to give push button in alv report output
hi,
my requirement is that , i have to give push button in alv report output(item level) not in application toolbar, i am using reuse_alv_grid_display FM, can any body provide me sample code
regards,
siva kumarhave a look at this thread, also has a sample report at the end from Uwe Schieferstein.
[button on alv list|How to add and program a pushbutton on ALV grid line;
seems not to work try this:
How to add and program a pushbutton on ALV grid line
Edited by: Micky Oestreich on May 15, 2008 10:20 PM -
How can we place a push button in ALV report
hi
could anybody inform me
how can we place a push button in ALV report
thanx
regards
kals.Hi kals.
please have a look at demoprogram
SALV_DEMO_TABLE_FUNCTIONS
BCALV_GRID_05
Regards
Bernd -
Hi experts,
I am using radio buttons in alv report by using screen painter but error occurs in alv that screen doesn't exist in module.
plz help me.Hi Ankita,
check this program.
*& Report ZALVGRID_WITH_RADIOBUTTONS
*& This program shows how to realize radiobuttons in ALV grid lists
*& using event HOTSPOT_CLICK.
*& Screen 100:
*& - Flow logic
*& PROCESS BEFORE OUTPUT.
*& MODULE PBO.
*& PROCESS AFTER INPUT.
*& MODULE PAI.
*& - Screen elements: none
*& - ok-code field -> gd_okcode
*& GUI Status MAIN100:
*& - F3 = 'BACK', Shift+F3 = 'EXIT', F12 = 'CANC'
PROGRAM zalvgrid_with_radiobuttons.
TYPE-POOLS: abap, icon. " INCLUDE . for releases < 6.20
TYPES: BEGIN OF ty_s_sflight.
INCLUDE TYPE sflight.
TYPES: button1 TYPE iconname.
TYPES: button2 TYPE iconname.
TYPES: button3 TYPE iconname.
TYPES: button4 TYPE iconname.
TYPES: END OF ty_s_sflight.
DATA:
gt_sflight TYPE STANDARD TABLE OF ty_s_sflight,
gs_layout TYPE lvc_s_layo,
gt_fcat TYPE lvc_t_fcat.
DATA:
gd_okcode TYPE ui_func,
go_docking TYPE REF TO cl_gui_docking_container,
go_grid TYPE REF TO cl_gui_alv_grid.
CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING
e_row_id
e_column_id
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_hotspot_click.
define local data
FIELD-SYMBOLS:
IS ASSIGNED ).
Set all radio buttons "unselected"
IS ASSIGNED ).
Set selected radio button "selected".
= icon_wd_radio_button.
ENDIF.
Force PAI followed by refresh of table display in PBO
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'REFRESH'
IMPORTING
RC =
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
MAIN *
START-OF-SELECTION.
PERFORM select_data.
PERFORM init_controls.
PERFORM build_fieldcatalog.
PERFORM set_layout.
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING
it_fieldcatalog = gt_fcat
it_outtab = gt_sflight.
Link docking container to dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
CONTAINER =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
lifetime_dynpro_dynpro_link = 3
OTHERS = 4.
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 SCREEN 100.
END-OF-SELECTION.
MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
ENDMODULE. "PBO OUTPUT
MODULE PAI INPUT *
MODULE pai INPUT.
Leave report
CASE gd_okcode.
WHEN 'BACK' OR
'EXIT' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
Refresh table display
WHEN 'REFRESH'.
PERFORM refresh_display.
WHEN OTHERS.
do nothing
ENDCASE.
CLEAR gd_okcode.
ENDMODULE. "PAI INPUT
*& Form BUILD_FIELDCATALOG
text
--> p1 text
<-- p2 text
FORM build_fieldcatalog .
ALV List with Radio Buttons
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 7
define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
i_structure_name = 'ICON'
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
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.
DELETE gt_fcat WHERE ( fieldname <> 'NAME' ).
NOTE: field ICON-NAME has data element ICONNAME.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
i_structure_name = 'SFLIGHT'
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
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.
READ TABLE gt_fcat INTO ls_fcat
WITH KEY fieldname = 'NAME'.
IF ( syst-subrc = 0 ).
DELETE gt_fcat INDEX syst-tabix.
ENDIF.
ls_fcat-fieldname = 'BUTTON4'.
ls_fcat-coltext = ls_fcat-fieldname.
ls_fcat-icon = 'X'.
ls_fcat-hotspot = 'X'.
INSERT ls_fcat INTO gt_fcat INDEX 5.
ls_fcat-fieldname = 'BUTTON3'.
ls_fcat-coltext = ls_fcat-fieldname.
INSERT ls_fcat INTO gt_fcat INDEX 5.
ls_fcat-fieldname = 'BUTTON2'.
ls_fcat-coltext = ls_fcat-fieldname.
INSERT ls_fcat INTO gt_fcat INDEX 5.
ls_fcat-fieldname = 'BUTTON1'.
ls_fcat-coltext = ls_fcat-fieldname.
INSERT ls_fcat INTO gt_fcat INDEX 5.
Renumbering of the columns
LOOP AT gt_fcat INTO ls_fcat.
ls_fcat-col_pos = syst-tabix.
MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
ENDLOOP.
ENDFORM. " BUILD_FIELDCATALOG
*& Form SELECT_DATA
text
--> p1 text
<-- p2 text
FORM select_data .
define local data
DATA:
ls_sflight TYPE ty_s_sflight.
SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE gt_sflight.
ls_sflight-button1 = icon_wd_radio_button. " selected radiobutton
ls_sflight-button2 = icon_wd_radio_button_empty.
ls_sflight-button3 = icon_wd_radio_button_empty.
ls_sflight-button4 = icon_wd_radio_button_empty.
Alternatively: create icons using function module 'ICON_CREATE'
on SAP releases where these icons are not available.
MODIFY gt_sflight FROM ls_sflight
TRANSPORTING button1 button2 button3 button4
WHERE ( carrid IS NOT INITIAL ).
ENDFORM. " SELECT_DATA
*& Form INIT_CONTROLS
text
--> p1 text
<-- p2 text
FORM init_controls .
CHECK ( go_docking IS NOT BOUND ).
ALV List with Radio Buttons
SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
© 2007 SAP AG 9
Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
REPID =
DYNNR =
SIDE = DOCK_AT_LEFT
EXTENSION = 50
STYLE =
LIFETIME = lifetime_default
CAPTION =
METRIC = 0
ratio = 90
NO_AUTODEF_PROGID_DYNNR =
NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Size of container = full screen size
CALL METHOD go_docking->set_extension
EXPORTING
extension = 99999
EXCEPTIONS
cntl_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.
Create ALV grid instance
CREATE OBJECT go_grid
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
i_parent = go_docking
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
I_FCAT_COMPLETE = SPACE
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Set event handler for event HOTSPOT_CLICK
SET HANDLER:
lcl_eventhandler=>handle_hotspot_click FOR go_grid.
ENDFORM. " INIT_CONTROLS
*& Form REFRESH_DISPLAY
Refresh table display after switching the radiobuttons
--> p1 text
<-- p2 text
FORM refresh_display .
define local data
DATA:
ls_stable TYPE lvc_s_stbl.
ls_stable-row = abap_true.
ls_stable-col = abap_true.
CALL METHOD go_grid->refresh_table_display
EXPORTING
is_stable = ls_stable
I_SOFT_REFRESH =
EXCEPTIONS
finished = 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. " REFRESH_DISPLAY
*& Form SET_LAYOUT
Set layout for ALV list
--> p1 text
<-- p2 text
FORM set_layout .
CLEAR: gs_layout.
gs_layout-cwidth_opt = abap_true. " optimize column width
gs_layout-zebra = abap_true.
ENDFORM. " SET_LAYOUT
Regards,
Prasanth
Reward if helpful -
How to create a radio button in ALV Reports
Hi all,
Best wishes to all..
Kindly reply me to this question... that is "How to create a radio button in ALV Report"
Thanks and Regards
AnjaliHI
here is an example :
PROGRAM ZUS_SDN_BCALV_GRID_DEMO_2.
Based on: BCALV_GRID_DEMO.
TYPE-POOLS: icon.
TYPES: BEGIN OF ty_s_sflight.
INCLUDE TYPE sflight.
TYPES: button1 TYPE lvc_emphsz.
TYPES: button2 TYPE lvc_emphsz.
TYPES: button3 TYPE lvc_emphsz.
TYPES: button4 TYPE lvc_emphsz.
TYPES: END OF ty_s_sflight.
DATA:
gt_sflight TYPE STANDARD TABLE OF ty_s_sflight,
gt_fcat TYPE lvc_t_fcat.
DATA: ok_code LIKE sy-ucomm,
gt_sflight TYPE TABLE OF sflight,
g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container.
CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
md_cnt TYPE i.
CLASS-METHODS:
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING
e_row_id
e_column_id
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_hotspot_click.
define local data
FIELD-SYMBOLS:
<ls_entry> TYPE ty_s_sflight,
<ld_fld> TYPE ANY.
READ TABLE gt_sflight ASSIGNING <ls_entry> INDEX es_row_no-row_id.
CHECK ( <ls_entry> IS ASSIGNED ).
Set all radio buttons "unselected"
<ls_entry>-button1 = icon_wd_radio_button_empty.
<ls_entry>-button2 = icon_wd_radio_button_empty.
<ls_entry>-button3 = icon_wd_radio_button_empty.
<ls_entry>-button4 = icon_wd_radio_button_empty.
ASSIGN COMPONENT e_column_id-fieldname OF STRUCTURE <ls_entry>
TO <ld_fld>.
IF ( <ld_fld> IS ASSIGNED ).
Set selected radio button "selected".
<ld_fld> = icon_wd_radio_button.
ENDIF.
Force PAI followed by refresh of table display in PBO
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'DUMMY'
IMPORTING
RC =
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
MAIN *
PERFORM select_data.
CALL SCREEN 100.
MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
CREATE OBJECT grid1
EXPORTING i_parent = g_custom_container.
PERFORM build_fieldcatalog.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
it_fieldcatalog = gt_fcat
it_outtab = gt_sflight.
Set event handler for event TOOLBAR
SET HANDLER:
lcl_eventhandler=>handle_hotspot_click FOR grid1.
else.
CALL METHOD grid1->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
EXCEPTIONS
FINISHED = 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.
ENDIF.
ENDMODULE. "PBO OUTPUT
MODULE PAI INPUT *
MODULE pai INPUT.
to react on oi_custom_events:
CALL METHOD cl_gui_cfw=>dispatch.
CASE ok_code.
WHEN 'EXIT'.
PERFORM exit_program.
WHEN OTHERS.
do nothing
ENDCASE.
CLEAR ok_code.
ENDMODULE. "PAI INPUT
FORM EXIT_PROGRAM *
FORM exit_program.
CALL METHOD G_CUSTOM_CONTAINER->FREE.
CALL METHOD CL_GUI_CFW=>FLUSH.
LEAVE PROGRAM.
ENDFORM. "EXIT_PROGRAM
*& Form BUILD_FIELDCATALOG
text
--> p1 text
<-- p2 text
FORM build_fieldcatalog .
define local data
DATA:
ls_fcat TYPE lvc_s_fcat,
ls_hype TYPE lvc_s_hype.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
i_structure_name = 'LVC_S_FCAT'
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
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.
DELETE gt_fcat WHERE ( fieldname <> 'EMPHASIZE' ).
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
i_structure_name = 'SFLIGHT'
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
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.
READ TABLE gt_fcat INTO ls_fcat
WITH KEY fieldname = 'EMPHASIZE'.
IF ( syst-subrc = 0 ).
DELETE gt_fcat INDEX syst-tabix.
ENDIF.
ls_fcat-fieldname = 'BUTTON4'.
ls_fcat-icon = 'X'.
ls_fcat-hotspot = 'X'.
INSERT ls_fcat INTO gt_fcat INDEX 4.
ls_fcat-fieldname = 'BUTTON3'.
INSERT ls_fcat INTO gt_fcat INDEX 4.
ls_fcat-fieldname = 'BUTTON2'.
INSERT ls_fcat INTO gt_fcat INDEX 4.
ls_fcat-fieldname = 'BUTTON1'.
INSERT ls_fcat INTO gt_fcat INDEX 4.
LOOP AT gt_fcat INTO ls_fcat.
ls_fcat-col_pos = syst-tabix.
MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
ENDLOOP.
ENDFORM. " BUILD_FIELDCATALOG
*& Form SELECT_DATA
text
--> p1 text
<-- p2 text
FORM select_data .
define local data
DATA:
ls_sflight TYPE ty_s_sflight.
SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE gt_sflight.
ls_sflight-button1 = icon_wd_radio_button.
ls_sflight-button2 = icon_wd_radio_button_empty.
ls_sflight-button3 = icon_wd_radio_button_empty.
ls_sflight-button4 = icon_wd_radio_button_empty.
MODIFY gt_sflight FROM ls_sflight
TRANSPORTING button1 button2 button3 button4
WHERE ( carrid IS NOT INITIAL ).
ENDFORM. " SELECT_DATA
Regards,
Prasanth
Reward all helpful answers -
CRviewer do not show anything when click button to show report with VS2013
First of all I must say, My English language skill is not good but I'll try to communicate as best as possible.
I am using Visual Studio 2013Ultimate with Update4 on .NetFramework 4.5.1 and Crystal Reports SP13.0.13.1597
When installed complete. ( Previously i have tried it with my project but CR & CRviewer not working)
I have tried using CRviewer in a new asp.net page The following code
***-----WebFrom1.aspx-----***
<body>
<form id="form1" runat="server">
<div>
<asp:RadioButton ID="rdoByAll" runat="server" Text="all" GroupName="rdoChoose" AutoPostBack="True" />
FromDate :
<asp:TextBox ID="txtDateFrom1" runat="server" AutoPostBack="True"></asp:TextBox>
ToDate :
<asp:TextBox ID="txtDateTo1" runat="server" AutoPostBack="True"></asp:TextBox>
<asp:Button ID="btnCallReport1" runat="server" Text="CallReport" />
<br />
<br />
<asp:RadioButton ID="rdoByName" runat="server" Text="ByName" GroupName="rdoChoose" AutoPostBack="True" />
FromDate :
<asp:TextBox ID="txtDateFrom2" runat="server" Height="16px" Width="150px" AutoPostBack="True"></asp:TextBox>
ToDate :
<asp:TextBox ID="txtDateTo2" runat="server" Height="16px" Width="150px" AutoPostBack="True"></asp:TextBox>
<asp:Button ID="btnCallReport2" runat="server" Text="CallReport" />
<asp:DropDownList ID="ddlNamelist" runat="server" AutoPostBack="True">
</asp:DropDownList>
<br />
<br />
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True" ToolPanelView="None" />
<br />
</div>
</form>
</body>
***-----WebFrom1.aspx.vb-----***
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.Web
Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub rdoByAll_CheckedChanged(sender As Object, e As EventArgs) Handles rdoByAll.CheckedChanged
If rdoByAll.Checked = True Then
txtDateFrom1.Enabled = True
txtDateTo1.Enabled = True
btnCallReport1.Enabled = True
txtDateFrom2.Enabled = False
txtDateTo2.Enabled = False
btnCallReport2.Enabled = False
ddlNamelist.Enabled = False
Else
txtDateFrom1.Enabled = False
txtDateTo1.Enabled = False
btnCallReport1.Enabled = False
txtDateFrom2.Enabled = True
txtDateTo2.Enabled = True
btnCallReport2.Enabled = True
ddlNamelist.Enabled = True
End If
End Sub
Protected Sub rdoByName_CheckedChanged(sender As Object, e As EventArgs) Handles rdoByName.CheckedChanged
rdoByAll_CheckedChanged(sender, e)
End Sub
Protected Sub btnCallReport1_Click(sender As Object, e As EventArgs) Handles btnCallReport1.Click
Dim rpt As New ReportDocument()
rpt.Load(Server.MapPath("CrystalReport1.rpt"))
Me.CrystalReportViewer1.ReportSource = rpt
Me.CrystalReportViewer1.RefreshReport()
End Sub
End Class
When i press F5 to run project make Code of radiobutton not work(Disable,Enable OtherControl such as textbox)
And when i try press CallReportButton CRviewer do not show anything.
When I brought CRviewer leaving the page ,Code of Radiobutton were working fine.
But can't to show "CrystalReport1.rpt" on CRviewer when i click CallReportButton. i'm not understand.
Then i have tried to learn from follow this link : CR not working in visual studio 2013
and Using Crystal Report in ASP.Net website, Report not showing in CrystalReportViewer
i have to create a new CR ASP NET project and copy the whole C:\inetpub\wwwroot\aspnet_client folder
into my app folder and then add this to your web.config file, line in bold: <add key="vs:EnableBrowserLink" value="false"/>
project is working but not fine when I try to click button to call report I get this pop-up . " popup.JPG" what is it?
And project warning! could not find schema information every element . "Could not find every Element.JPG"
After that, copy the whole C:\inetpub\wwwroot\aspnet_client folder into my app folder Only! not add in my web.config
(In previous project need to use CR) make to project were working but i get same pop-up when i click to show report.
**** buleline in popup.JPG picture is "The report you requested requires further information"I think you're over-complicating things. I'd like you to have a look at a few sample apps, see how they work, then adjust your app. Samples are here:
Crystal Reports for .NET SDK Samples - Business Intelligence (BusinessObjects) - SCN Wiki
Also, have a look at Crystal Reports for Visual Studio 2005 Walkthro... | SCN (- applies to all versions of CR and .NET).
Finally, the Developer Help files are here:
SAP Crystal Reports .NET SDK Developer Guide
SAP Crystal Reports .NET API Guide
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow me on Twitter -
How to get GUI Status(Push Buttons) in ALV Report
Hi Friends
I have a requirement in a way that:
Once selection-screen was processed,an ALV report has to come and above the ALV List,I need a custom GUI Status(4 Push Button) with Push Buttons Logic.
Once I had clicks on thesse push button,I need to display one more ALV List and above this List,again I need a custom GUI Status(2 Push Buttons) with Push Buttons Logic.
Can anyone throw some light how we can achieve this.
Thanks for your cooperation!
Regards,
Madisettydata: rt_extab type slis_t_extab,
g_ucomm like sy-ucomm ,
g_selfield type slis_selfield.
form alv_display .
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = g_repid
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'USER_COMM'
it_fieldcat = it_fldcat
tables
t_outtab = it_final1
perform pf_status using rt_extab.
perform user_comm using g_ucomm g_selfield .
endform.
form pf_status using p_rt_extab.
set pf-status 'PF_STATUS' excluding p_rt_extab.
endform.
form user_comm using p_ucomm like sy-ucomm
p_selfield type slis_selfield.
data: l_row type i.
case p_ucomm.
when 'DISPLAY_PO'.
loop at it_final1 into wa_final1.
if wa_final1-sel eq 'X' .
l_row = l_row + 1.
endif.
if l_row gt 1.
message e004.
endif.
clear wa_final1.
endloop.
p_selfield-fieldname = 'SEL'.
read table it_final1 into wa_final1 index p_selfield-tabindex .
set parameter id 'BES' field wa_final1-ebeln.
call transaction 'ME23N'.
endcase.
endform.
*create user interface for gui status by double clicking on 'PF_STATUS'.
*Check the above sample code . -
Summation button in ALV report is giving shortdump
Dear All,
I have developed a ALV report. The report is a simple ALV report (Using REUSE_ALV_GRID_DISPLAY). When I am pressing the summation button at the top, it is giving a shortdump. The reason I have found out is the no. of columns are very large (45 to 50). Can anyone suggest how to handle this situation?
Best wishes,
AtanuHi atanu,
then you can use DO_SUM = 'X' (for the field which you want to sum option) in the fieldcat , this will try to sum while display it self.i mean in list display it will show the totals also.
then you need not to explicitly click on SUM button.
Regards
vijay -
Needed select all button in alv report
Dear Experts,
In alv report i want first field as button selectall then remaining fields must be displayed
this is my code,,
DEFINE m_fieldcat.
is_fieldcat-fieldname = &1.
is_fieldcat-hotspot = &2.
is_fieldcat-seltext_m = &3.
is_fieldcat-col_pos = &4.
is_fieldcat-outputlen = &5.
is_fieldcat-emphasize = &6.
is_fieldcat-Checkbox = &7.
append is_fieldcat to it_fcat.
clear is_fieldcat.
END-OF-DEFINITION.
m_fieldcat 'SLNO' '' text-112 '1' '5' 'C310' ''.
m_fieldcat 'KPI' '' text-110 '2' '30' 'C310' ''.
m_fieldcat 'PWEEK' 'X' text-109 '3' '16' 'C310' ''.
m_fieldcat 'CWEEK' 'X' text-111 '4' '16' 'C310' ''.
m_fieldcat 'MONTH' 'X' text-122 '5' '16' 'C310' ''.
m_fieldcat 'PMONTH' 'X' text-132 '6' '16' 'C310' ''.
m_fieldcat 'UOM ' '' text-138 '7' '10' 'C310' ''.
Thanks,
Thiru. RHi,
You can keep first field as checkbox. 'Select All' button is present in ALV whnever you use 'REUSE_ALV_GRID' F.M.
You can click on select all button that appears in ALV grid toolbar and all your checkboxes that appears in first field will get selected. Similar to 'Select All' there is 'Deselct All' button also in ALV grid.
Regards,
Saba -
Add log button in alv report-OO
Hi experts,
i have a alv report with 2 buttons: one - RElease order and the other is LOG.
the user want that after he push on release button(that operate a functions)
he want to see if it ended succesfuly - so he need log.
the problem is that i dont know how can i show the report when he click on the "log" button?
(how can i create a report that we can see after the user ran the alv report and click on "log" button?)
thanks in advanced,
Michal.Hi,
I can help you on this if you are using the SALV method. Factory method.
You need to created event handlers for this. and then need to call the second alv .
CLASS LCL_HANDLE_EVENTS DEFINITION DEFERRED. "events for the alv
DATA: GR_EVENTS TYPE REF TO LCL_HANDLE_EVENTS. "events object
* CLASS lcl_handle_events DEFINITION
* To define a local class for handling events of cl_salv_table
CLASS LCL_HANDLE_EVENTS DEFINITION.
PUBLIC SECTION.
METHODS:
ON_USER_COMMAND FOR EVENT ADDED_FUNCTION OF CL_SALV_EVENTS
IMPORTING E_SALV_FUNCTION.
ENDCLASS. "lcl_handle_events DEFINITION
* CLASS lcl_handle_events IMPLEMENTATION
* To implement the events for handling the events of cl_salv_table
CLASS LCL_HANDLE_EVENTS IMPLEMENTATION.
METHOD ON_USER_COMMAND.
PERFORM HANDLE_USER_COMMAND USING E_SALV_FUNCTION.
ENDMETHOD. "on_user_command
ENDCLASS. "lcl_handle_events IMPLEMENTATION
DATA: LR_EVENTS TYPE REF TO CL_SALV_EVENTS_TABLE.
LR_EVENTS = IR_TABLE->GET_EVENT( ).
CREATE OBJECT GR_EVENTS.
*... register to the event USER_COMMAND
SET HANDLER GR_EVENTS->ON_USER_COMMAND FOR LR_EVENTS.
*& Form handle_user_command
FORM HANDLE_USER_COMMAND USING I_UCOMM TYPE SALV_DE_FUNCTION.
DATA: LR_SELECTIONS TYPE REF TO CL_SALV_SELECTIONS,
L_W_ROW_TAB LIKE LINE OF ROW_TAB,
L_W_INDEX TYPE I.
*... To get the selected rows
LR_SELECTIONS = IR_TABLE->GET_SELECTIONS( ).
ROW_TAB = LR_SELECTIONS->GET_SELECTED_ROWS( ).
LOOP AT ROW_TAB INTO L_W_ROW_TAB.
L_W_INDEX = L_W_ROW_TAB.
READ TABLE IT_OUTTAB INTO WA_OUTTAB INDEX L_W_INDEX.
APPEND WA_OUTTAB TO IT_OUTTAB2.
CLEAR WA_OUTTAB.
ENDLOOP.
IF IT_OUTTAB2 IS NOT INITIAL.
PERFORM DISPLAY_ALV_DETAILS.
ELSE.
EXIT.
ENDIF.
ENDFORM. "handle_user_command
*& Form display_alv_details
* text
FORM DISPLAY_ALV_DETAILS.
*... create an ALV table
* just create an instance and do not set LIST_DISPLAY for
* displaying the data as a Fullscreen Grid
TRY.
CL_SALV_TABLE=>FACTORY(
IMPORTING
R_SALV_TABLE = IR_TABLE
CHANGING
T_TABLE = I_RECON ).
CATCH CX_SALV_MSG. "#EC NO_HANDLER
ENDTRY.
IR_TABLE->SET_SCREEN_STATUS(
PFSTATUS = 'STANDARD_ALV'
REPORT = SY-REPID
SET_FUNCTIONS = IR_TABLE->C_FUNCTIONS_ALL ).
*... To display the Table IT_OUTTAB2 with values
IR_TABLE->DISPLAY( ).
ENDFORM. " display_alv_details
Regards
Ansari
Edited by: Muhammed Ansari Abubekkar on Sep 9, 2009 5:18 PM
Maybe you are looking for
-
Setting a new keyboard shortcut in Final Cut Express
Dear All, I'm using Final Cut Express 2, with Tiger. I'm doing some editing that includes many dissolves, and so I'm having to go to Sequence>Render Selection>Video very frequently. There's no keyboard shortcut on the drop-down menu. Is there any way
-
How To get low MTW emails to pass?
We have some offsite marketing people who have an email address that is hosted through wowway.com (local cable company) and their email is getting rejected due to low MTA. We only have one email policy running on our C160 and have the address whiteli
-
HI all, When I change the quantity on the Purchase Order above the tolerance ( which is 3 % of the Purchase Order Quantity in this case ), I get two errors, 1. u201COver Delivery cannot be more than 3.0%. Please change the confirmed quantity for the
-
In the dvd player, the button to go back chapters does not work!
Hi.. I need some help please. In the dvd player when I ask to skip a chapter, the command works fine, however when I ask to return to the previous chapter it back to the beginning of the same chapter. And only works if I press the back button twice q
-
I have purchased a dock with remote control for my iPhone and connected it to my TV so that I can play music videos but This only works by playing them one at a time from the video/movie list. I have tried everyway to put videos into a playlist but i