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.
Similar Messages
-
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 -
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. -
How to create User Defined Variables in Procurement Contract 12.1.3
Hi,
We are using Procurement Contract 12.1.3. As per our business requirement while creating contract template we need to use many variables which are not available in 'System Defined' variable list. Please guide us with some samples (step by step) how to create the 'User defined' variables.
Regards,
PrabhuHi Prabhu,
Did you get the setps how to create user defined variables in Procurement contracts? if so please share me the setp by step flow.
Prakash -
How to create user defined transactioncode in bw
hi,
How to create user defined transactioncode in bw.My user want this
regards,
Abhishekhi
by using the t code SE93 u can create.
after that it will ask u for what ur going create
1.Program and screen
2.Program and selection screen
3.method of class
4.transaction with variant
5.transaction with parameter
here u have to select appropriate option based on ur requirement
and enter the options as per ur needs save and activate -
How to create user defined functions in xi.
how to create user defined functions in xi.
can anyone give info with screen shots.Hi,
Please follow the steps mentioned in below link
http://help.sap.com/saphelp_nw04/helpdata/en/f8/2857cbc374da48993c8eb7d3c8c87a/frameset.htm
also refer below links to know more about UDF
udf
Thanks
Swarup
Edited by: Swarup Sawant on Mar 3, 2008 3:59 PM -
How to create user defined metrics for SQL Server target?
The customer is not able to create a user defined metrics for SQL Server target.
This is very important for him to use this product.
He is asking how to create user defined metrics?
I sent him Note 304952.1 How to Create a User-Defined SQL Metric in EM 10g Grid Control
But it would work for an Oracle DB, but his target is SQL Server DB
Not able to find the "User-Defined Metrics" link from Database home page.
How to create user defined metrics for SQL Server target?http://download-uk.oracle.com/docs/cd/B14099_19/manage.1012/b16241/Monitoring.htm
-
How to create User defined templates
Hi all,
I want to create user defined templates for pages and regions and how to create form templates and report templates.
pls help me.
thanks
maniHi Mani,
If you copy a template in ApEx, you have your own version of that template.
If you then alter the code in your version of the template, you have your own custom version.
If you don't understand the underlying HTML, you are going to struggle.
Regards
Michael -
How can give the user defined parameter in alv report
Hi experts
I have created one alv report for Sale Order statement.In this alv report have different input parameters
My problem is in this alv i have two input field Sales Orgaization and Plant.When I set this parameter value in user details it snot affected in my alv report.But it is affected in the standard alv report.How can
i rectify this
Regards
Manojhi
i think don't use set parameter value, use there SUBMIT & RETURN statement and write in USER_COMMAND function.
FORM USER_COMMAND USING P_UCOMM LIKE SY-UCOMM
P_SELFIELD TYPE SLIS_SELFIELD.
SUBMIT program name AND RETURN
WITH <selection-screen field> IN <selection-screen field>
WITH WERKS IN WERKS .
ENDFORM .
Regards,
Abhi -
How to disable user defined buttons
hi,
how to disable userdefined buttons in alv in webdynpro abap.
thanks and regards,
Sridevi.DHi,
Create attribute in context to control enabling/disabling action of a button. Bind this attribute to button. In some action method populate this attibute with boolean values.
Reward point if useful.
Regards,
Karthick S -
How to create User-defined Transform in BODS
Hi,
Is there documents explaining how to create a User-defined Transform in BODS Designer?
Thanks
RexHi,
Please follow the steps mentioned in below link
http://help.sap.com/saphelp_nw04/helpdata/en/f8/2857cbc374da48993c8eb7d3c8c87a/frameset.htm
also refer below links to know more about UDF
udf
Thanks
Swarup
Edited by: Swarup Sawant on Mar 3, 2008 3:59 PM -
How To Create User-Defined DateTo and DateFrom?
This document https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6ce7b0a4-0b01-0010-52ac-a6e813c35a84 describe techniques used to create BI Infocubes.
In chapter 4.4.2.4 Report only on data for constellations valid today and yesterday (comparable results) - today and yesterday.
...Report only on data for constellations valid today and yesterday (comparable results): Solution
Given an attribute–characteristic relation.
Define the dependent attribute as a time-dependent navigational attribute of the characteristic. Define
additionally user-defined DateTo and DateFrom time-dependent navigational attributes. Together with the
query key date and a filter on DateTo and DateFrom excluding your reporting time span, you will get the
desired result.
MatGr-SID From-User To-User From-Sys To-Sys Material Material-SID
910 01/1000 12/9999 01/1000 12/9999 AAA 001
910 01/1000 09/1998 01/1000 09/1998 BBB 002
920 10/1998 12/9999 10/1998 12/9999 BBB 002
920 01/1000 12/9999 01/1000 12/9999 CCC 003
920 01/1000 12/9999 01/1000 12/9999 DDD 004
920 10/1998 12/9999 10/1998 12/9999 EEE 005
Report showing comparable results
Material group Rev 09/98 Rev 10/98
X 100 100
Y 200 200
HOW TO Create From-User To-User attributes?Hi Monica
Third party software is available,from AccessVia, that can be used to create and update templates. Sample sample sqt can help you to understand the required inputs (batchID, templateID, departmentID, locale).
Thanks
Himanshu -
How to Create User Defined Template in Back Office with Labels and Tags App
Hello,
Can anyone help me in creating a user defined template in Back Office with Labels and Tags Application. I'm currently using version 13.2.?
Kindly help me out asap.
Thanks,
Monica.Hi Monica
Third party software is available,from AccessVia, that can be used to create and update templates. Sample sample sqt can help you to understand the required inputs (batchID, templateID, departmentID, locale).
Thanks
Himanshu -
How to disable self defined button from ALV Toolbar when ok_code ='BACK'
here is the code
CLASS Z_CL_6_U_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
METHODS:
HANDLE_TOOLBAR
FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT E_INTERACTIVE,
HANDLE_USER_COMMAND
FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
IMPORTING E_UCOMM.
ENDCLASS.
CLASS Z_CL_6_U_EVENT_RECEIVER IMPLEMENTATION.
METHOD HANDLE_TOOLBAR.
DATA: LS_TOOLBAR TYPE STB_BUTTON.
IF G_FLAG = 'X' and ok_code = space.
CLEAR LS_TOOLBAR.
MOVE 0 TO LS_TOOLBAR-BUTN_TYPE.
MOVE 'UPDATE' TO LS_TOOLBAR-FUNCTION.
MOVE ICON_MODIFY TO LS_TOOLBAR-ICON.
MOVE 'Update Records'(111) TO LS_TOOLBAR-QUICKINFO.
MOVE ''(112) TO LS_TOOLBAR-TEXT.
MOVE ' ' TO LS_TOOLBAR-DISABLED.
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
elseif ok_code = 'BACK'.
CLEAR LS_TOOLBAR.
LS_TOOLBAR-function = 'UPDATE'.
LS_TOOLBAR-butn_type = 0.
LS_TOOLBAR-icon = ICON_MODIFY.
LS_TOOLBAR-quickinfo = 'Update Records'.
LS_TOOLBAR-disabled = 'X'.
append LS_TOOLBAR TO <i><b>E_OBJECT</b></i>->MT_TOOLBAR.
ENDIF.
ENDMETHOD.
<i><b>ERROR COMES when ok_code is 'BACK'.
at this point E_OBJECT has null reference instead of ref to Class cl_ALV_EVENT_TOOLBAR_SET.</b></i>
tell me why this error coming.
pls helpHello Neetu
To give you an example I have copied sample report BCALV_GRID_DEMO, added some code (search for <b>$Comment</b>) and modified the GUI-status <b>MAIN100</b> (replace function code EXIT with <b>BACK</b> for the F3 function).
Run the program and push several times the BACK button: one toolbar function after the other will be inactivated.
PROGRAM test.
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.
<b>----
CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
md_cnt TYPE i.
CLASS-METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object
e_interactive
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_toolbar.
DATA:
ls_button TYPE stb_button.
ADD 1 TO md_cnt. " a simple counter
LOOP AT e_object->mt_toolbar INTO ls_button FROM 1 TO md_cnt.
ls_button-disabled = 'X'.
MODIFY e_object->mt_toolbar FROM ls_button.
ENDLOOP.
ENDMETHOD. "handle_toolbar
ENDCLASS. "lcl_eventhandler IMPLEMENTATION</b>
START-OF-SELECTION.
* MAIN *
SELECT * FROM sflight INTO TABLE gt_sflight.
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.
* Instantiate ALV grid control
CREATE OBJECT grid1
EXPORTING i_parent = g_custom_container.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
it_outtab = gt_sflight.
<b>*$Comment: Set event handler for event TOOLBAR
SET HANDLER:
lcl_eventhandler=>handle_toolbar FOR grid1.
ENDIF.</b>
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.
<b> WHEN 'BACK'.
$Comment: Toolbar can be modified on-the-fly
grid1->set_toolbar_interactive( ).</b>
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
Regards
Uwe -
How to Create user-defined Dependency : thru CT04
Hi guys,
for batch management , i have to create a new Characteristic Class ( which is copy for Characteristic Class LOMB_VERAB) and i have to add one more condition in that.
<b>Code of Standard Class</b>
[code] $SELF.LOBM_APO_SL_MIN = 0
if LOBM_HSDAT = LOBM_VERAB,
FUNCTION SL_MIN_COMPUTE
(LOBM_HSDAT = LOBM_HSDAT,
LOBM_VERAB = LOBM_VERAB,
LOBM_APO_SL_MIN = $SELF.LOBM_APO_SL_MIN)
if LOBM_HSDAT specified and
LOBM_VERAB specified
*[/code]
in that new Class , i have to check
1.Lobm_hsdat is initial or not?
2. i have to add 8 days to that one
i.e lobm_verab = lobm_hsdat + 8.
when i do like that its giving Syntax errors?
How Can i Implement my Logic over there
can i expect any inputs ?
regards
Prabhu
TC-team SAP
pepsi inida
[email protected]Prabhu,
Can you pls help me out, how you solved the issue? am also having similar kind of requirement and getting syntax errors...
Ram...
Maybe you are looking for
-
Error in deploying application in GlassFish
Hi, I'm working on GlassFish server to develop a web service. While deploying the server application i'm encountring an error... i issue the following command... asadmin deploy user admin passwordfile password host localhost port 4849 contextroot Cal
-
I cannot get my the iphone to sync with itunes.. it keeps telling me to reinstall itunes, is there any fix for this?
-
Time machine no longer backs up changes to files in home folder.
My Time Machine seems to be in some sort of weird state where it has stopped backing up any files/folders in my home (~/) folder or below. This is obviously a big issue since those are the files most needing to be backed up. It does catch changes to
-
So can it be done?
-
Export scale issue - Premiere Elements 13
When I export my video, clips which have been Scaled (In Applied Effects) are not matched to the ratio of the rest of the clips. How do I fix this? Here is a screen grab showing the problem. The clip is supposed to be zoomed in so the model's eyes ar