Create button on ALV Dashbaord
Hello All,
We have upgraded from XRPM 4.0 to XRPM 4.5 and also have switched to ABAP Dashboards from Java Dashboards. However on this new Item Dashboard, Collection Dashboard, Bucket Dashboard, etc the Create button is not working and also i am not able to open the existing items from this Dashboards.
Is there any additional configuration that I am missing. Please help...
Best Regards,
SB
Hello All,
We have upgraded from XRPM 4.0 to XRPM 4.5 and also have switched to ABAP Dashboards from Java Dashboards. However on this new Item Dashboard, Collection Dashboard, Bucket Dashboard, etc the Create button is not working and also i am not able to open the existing items from this Dashboards.
Is there any additional configuration that I am missing. Please help...
Best Regards,
SB
Similar Messages
-
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. -
How to create multiple buttons in ALV Toolbar in Webdynpro ABAP
Hi all,
I am trying to create multiple buttons in Webdynpro ALV toolbar, please go through the code.
What happening is, second button is replacing the first one.
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_alv_table( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_alv_table( ).
DATA lv_value TYPE REF TO cl_salv_wd_config_table.
lv_value = lo_interfacecontroller->get_model(
DATA lr_buttonui1 TYPE REF TO cl_salv_wd_fe_button.
DATA lr_buttonui2 TYPE REF TO cl_salv_wd_fe_button.
DATA button1 TYPE REF TO cl_salv_wd_function.
DATA button2 TYPE REF TO cl_salv_wd_function.
**First button
CREATE OBJECT lr_buttonui1.
lr_buttonui1->set_text('Button')."setting the text of the button on alv toolbar
button1 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON')."creating the function for alv button
button1->set_editor( lr_buttonui1 ).
**Second button
CREATE OBJECT lr_buttonui2.
lr_buttonui2->set_text('Button1')."setting the text of the button on alv toolbar
button2 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON' )."creating the function for alv button
button2->set_editor( lr_buttonui2 ).
How can I overcome this??
Thanks
EshwarHi Eshwar,
The button Ids are same for both the buttons in your code. You need to change it as BUTTON1, BUTTON2.
**First button
CREATE OBJECT lr_buttonui1.
lr_buttonui1->set_text('Button')."setting the text of the button on alv toolbar
button1 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON1')."creating the function for alv button
button1->set_editor( lr_buttonui1 ).
**Second button
CREATE OBJECT lr_buttonui2.
lr_buttonui2->set_text('Button1')."setting the text of the button on alv toolbar
button2 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON2' )."creating the function for alv button
button2->set_editor( lr_buttonui2 ). -
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 -
Creating push button on ALV application toolbar
Hi Abapers,
I have created one ALV in HR module using function module 'display_basic_list'. now my requirement is to create a push button on ALV application tool bar so that when user clicks on this push button another list has to appear..
kindly gimme valid inputs which would help me.. Also provide me sample code...
Thanks in Advance,
Radhika.Hi,
GO to SE41 copy the status STANDARD from the program SAPLKKBL..And give the status name and your program name...
Add your buttons..
In the parameter I_CALLBACK_PF_STATUS_SET give the form name 'PF_STATUS_SET'.
In the subroutine.
FORM PF_STATUS_SET.
SET PF-STATUS 'STATUS NAME THAT YOU GAVE IN SE41'.
ENDFORM.
For user command pass the parameter I_CALLBACK_USER_COMMAND with the user command subroutine name..
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
IF R_UCOMM = ''.
ENDIF.
ENDFORM.
Example
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = lv_repid
I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_SET'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
Thanks,
Naren -
Create change/edit button in ALV
Hello Experts,
How to insert the button in ALV grid toolbar. Now its showing Check,insert,append and delete button.How to add change or edit button in ALV ?
I'm using ALV componenet SALV_WD_TABLE.
Thanks.Hi,
With the previous reply you can create the customized button.
to make ALV editable or non editable(change or read only) the code to be written is:
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
DATA lo_value TYPE REF TO cl_salv_wd_config_table.
lo_cmp_usage = wd_this->wd_cpuse_alv_table( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
lo_interfacecontroller = wd_this->wd_cpifc_alv_table( ).
lo_value = lo_interfacecontroller->get_model( ).
*lr_table_settings->set_read_only( abap_false ).*"you can make it abap_true or abap_false based to make
the ALV editable or non editable
Priya -
Creating buttons on title bar using alv
hi all good morning,
can any one help me in making a button on title bar of ALV report. Till now i have used only one function of ALV i,e REUSE_ALV_GRID_DISPLAY. it is showing proper out put but i want to make some action using my own button on the final ALV result displayed like save change etc.Hi,
How to add button to ALV toolbar using REUSE_ALV_LIST_DISPLAY?
In the program which calls ALV using REUSE_ALV_LIST_DISPLAY,
I have to add a new button.
I saw the demo program BCALV_GRID_08, which is written using ABAP-Controls.
In that example, the button is added using TOOLBAR event of cl_gui_alv_grid.
Could you help me to implement the same logic using REUSE_ALV_LIST_DISPLAY parameters.
you should copy the 'STANDARD' GUI status from program SAPLKKBL using transaction SE90 >Programming SubObjects> Gui Status.
Execute this transaction to get to next screen. select status using checkbox. click on GUI Status --> Copy.
Enter your Z program name and the name you what for this status - you can keep it as 'STANDARD' to be simple.
Then you can edit the new status to add or delete buttons. This will also bring in the standard SAP ALV functionality such as sorting/subtotaling etc...
When you call 'REUSE_ALV_GRID_DISPLAY' make sure you pass it the new status name.
an example of one of mine:
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZSDBOLST_REPORT'
i_callback_pf_status_set = 'STANDARD' <----
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'I_BOLACT'
i_grid_title = 'BOL Action Report'(031)
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
i_save = 'A'
is_variant = v_variant
TABLES
t_outtab = i_bolact
EXCEPTIONS
program_error = 1
others = 2.
I just tried the same procedure ,but my entire application toolbar disappeared and a lock icon appears next to the application toolbar in my copied pf-status.
Could you advice what might have gone wrong ?
As identified with the FM's help you can do the following.
1). Using SE80 (I think) you can copy a GUI status from one program to another. It mentions which one in the FM's help.
2). Create a form named like so:
Code:
Form Set_pf_status
Notes: Called by FM REUSE_ALV_GRID_DISPLAY
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD'.
ENDFORM. "Set_pf_status
In the above case the GUI status copied was named ZSTANDARD and adjusted accordingly, adding and removing the desired buttons. A button was added called '%DELETE'.
3). Create the following report:
Code:
Form User_command
Notes: Called by FM REUSE_ALV_GRID_DISPLAY
Detects whether the icon/button for
'Return Tag Deletion' has been pressed. If it has then
detect whether any rows have been highlighted and then
set the delete flag.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: li_count TYPE I.
IF r_ucomm EQ '%DELETE'.
LOOP AT %g00 WHERE mark EQ 'X'.
ADD 1 TO li_count.
ENDLOOP.
IF li_count GT 0.
gc_delete_flag = 'X'.
r_ucomm = '&F03'. "Back arraow
ELSE.
MESSAGE W000 WITH 'Please highlight the rows to be deleted!'.
ENDIF.
ENDIF.
ENDFORM. "User_command
As I've added an extra button to indicate which records should be deleted I need to identify a form to be called to process when this button is chosen.
Then when you call the ALV function you to specify the following extra details:
Code:
call function 'REUSE_ALV_GRID_DISPLAY'
exporting i_callback_program = gc_repid
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
i_grid_title = lc_grid_title
is_layout = lc_layout
it_fieldcat = gt_fieldcat
it_sort = sort
i_save = l_save
is_reprep_id = l_bbs_id
is_variant = l_variant
tables t_outtab = %g00
exceptions program_error = 1
others = 2.
The parameters in capitals are the extra ones that need to be added.
Regards,
Satish -
Hide Change Layout Button in ALV report o/p for MB52 Tcode
Hi,
Is it possible to Hide Change Layout Button in ALV output for Report MB52 using authoriztaion.
We have created a layout in which we are hiding some coloumns which the user should not see.
But if the change layout button is active then the user can add those coloumns to output.
Is this possible through authorizations. I want to avoid doing any chnages to the std sap program.
Thanks & Regards,
FawazCheck the object S_ALV_LAYO
-
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. -
Add on custom button to ALV toolbar in std tcode ME51N, ME52N and ME53N.
Hi All,
I have the requirement to add on the custom button to ALV toolbar in ITEM OVERVIEW for standard transaction ME51N, ME52N and ME53N. Does anyone know what enhancement point or user exit i should apply and how i can add on the custom button?
Thanks.There are no user exits or badi's for COOIS. You may have to make copy of the PPIO_ENTRY to ZPPIO_ENTRY including all the varians without changing their names like copy SAP&COOIS to SAP&COOIS. Create a T-Code ZCOOIS and replace COOIS in variant SAP&COOIS to ZCOOIS not in the name of the variant but in the field "Check Authorization for".
The PF-Status is found in the include LCOISOUTPUTF16 which is located in the function group COISOUTPUT you may have to copy that too. Finally you need to copy SAPLCOISOUTPUT with its GUI status GENERAL and add your custom button there. -
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 -
Hi ,
I want to display a ALV Grid layout output and on that I want to insert a button on the application bar .When I click on it I should call a screen and dispaly that out on that screen .
Prg :
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZL_NAV'
I_CALLBACK_PF_STATUS_SET = 'ZL_PF_STATUS'
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
i_structure_name = 'ZLT_MARKET_VALUE'
is_layout = gs_layout
i_save = g_save
IT_FIELDCAT =
IT_EVENTS =
TABLES
t_outtab = i_market_value
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
ENDIF.
Iam settingthe pf status as 'ZL_PF_STATUS' and writing the sub routine for the same.
form 'ZL_PF_STATUS'
set pf-status = 'NAVDISP' .
endform .
But iam getting a dump that there are one actual parameter and zero formal parameters .
Help in this regard
Bye
Santosh ..Hello!
Take this code:
Regards
Ilhan
TYPE-POOLS: col, icon.
DATA:
BEGIN OF wa_sflight.
INCLUDE TYPE sflight.
DATA: color(4),
light, "graphical indicator for booking status
it_field_colors TYPE lvc_t_scol, "for cell highlighting
changes_possible TYPE icon-id,
END OF wa_sflight,
it_sflight LIKE TABLE OF wa_sflight.
DATA:
ok_code LIKE sy-ucomm.
DATA:
alv TYPE REF TO cl_gui_alv_grid,
cont TYPE REF TO cl_gui_custom_container.
DATA: my_variant TYPE disvariant,
my_print TYPE lvc_s_prnt.
DATA:
wa_layout TYPE lvc_s_layo,
wa_field_color LIKE LINE OF wa_sflight-it_field_colors.
DATA:
it_field_cat TYPE lvc_t_fcat,
wa_field_cat LIKE LINE OF it_field_cat.
DATA:
bookings_total TYPE i,
bookings_total_c(10),
message_text(60).
DATA: row TYPE i.
DATA: it_row_no TYPE lvc_t_roid,
wa_row_no LIKE LINE OF it_row_no,
it_lines type i.
DATA: BEGIN OF wa_sel_flights,
mandt TYPE sy-mandt,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
END OF wa_sel_flights,
it_sel_flights LIKE TABLE OF wa_sel_flights.
SELECT-OPTIONS: so_car FOR wa_sflight-carrid,
so_con FOR wa_sflight-connid.
SELECTION-SCREEN SKIP.
PARAMETERS: pa_lv TYPE disvariant-variant.
********************** CLASS **************************
CLASS: lcl_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: on_doubleclick
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING es_row_no,
print_top
FOR EVENT print_top_of_page OF cl_gui_alv_grid,
print_tol
FOR EVENT print_top_of_list OF cl_gui_alv_grid,
on_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object,
on_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm,
on_context_menu_request
FOR EVENT context_menu_request OF cl_gui_alv_grid
IMPORTING e_object.
ENDCLASS. "lcl_handler DEFINITION
CLASS: lcl_handler IMPLEMENTATION.
METHOD on_doubleclick.
READ TABLE it_sflight INTO wa_sflight INDEX es_row_no-row_id.
IF sy-subrc NE 0.
MESSAGE i075(bc408).
EXIT.
ENDIF.
bookings_total = wa_sflight-seatsocc + wa_sflight-seatsocc_b +
wa_sflight-seatsocc_f.
bookings_total_c = bookings_total.
CONCATENATE 'Total number of bookings:'(m01)
bookings_total_c
INTO message_text.
MESSAGE message_text TYPE 'I'.
ENDMETHOD. "on_doubleclick
METHOD print_top.
DATA: pos TYPE i.
FORMAT COLOR COL_HEADING.
WRITE: / sy-datum.
pos = sy-linsz / 2 - 3. " length of pagno: 6 chars
WRITE AT pos sy-pagno.
pos = sy-linsz - 11. " length of username: 12 chars
WRITE: AT pos sy-uname.
ULINE.
ENDMETHOD. "print_top
METHOD print_tol.
DATA: wa_so_car LIKE LINE OF so_car,
wa_so_con LIKE LINE OF so_con.
CONSTANTS: end TYPE i VALUE 20.
FORMAT COLOR COL_HEADING.
WRITE: / 'Select options'(000), AT end space. "#EC *
SKIP.
WRITE: / 'Airlines'(001), AT end space. "#EC *
ULINE AT /(end).
FORMAT COLOR COL_NORMAL.
LOOP AT so_car INTO wa_so_car.
WRITE: / wa_so_car-sign,
wa_so_car-option,
wa_so_car-low,
wa_so_car-high.
ENDLOOP.
SKIP.
FORMAT COLOR COL_HEADING.
WRITE: / 'Connections'(002), AT end space . "#EC *
ULINE AT /(end).
FORMAT COLOR COL_NORMAL.
LOOP AT so_con INTO wa_so_con.
WRITE: / wa_so_con-sign,
wa_so_con-option,
wa_so_con-low NO-ZERO,
wa_so_con-high NO-ZERO.
ENDLOOP.
SKIP.
ENDMETHOD. "print_tol
METHOD on_toolbar.
DATA l_wa_button TYPE stb_button.
l_wa_button-butn_type = 3.
INSERT l_wa_button INTO TABLE e_object->mt_toolbar.
CLEAR l_wa_button.
l_wa_button-function = 'AENDERN'.
l_wa_button-icon = ICON_MC_CONTENTINDICATOR.
l_wa_button-quickinfo = 'FLÜGE ANZEIGEN'. "#EC *
l_wa_button-butn_type = 0.
l_wa_button-text = 'ÄNDERN FLÜGE'.
INSERT l_wa_button INTO TABLE e_object->mt_toolbar.
* Create button "Display bookings"
CLEAR l_wa_button.
l_wa_button-function = 'ANZEGEN'.
l_wa_button-icon = ICON_FLIGHT.
l_wa_button-quickinfo =
'FLÜGE ANZEIGEN'. "#EC *
l_wa_button-butn_type = 0.
l_wa_button-text = 'ANZEIGEN FLÜGE'.
INSERT l_wa_button INTO TABLE e_object->mt_toolbar.
ENDMETHOD. "on_toolbar
* Ereignisbehandlung *
METHOD on_user_command.
CASE e_ucomm.
WHEN 'AENDERN'.
message 'Was möchten Sie ändern ?' type 'I'.
WHEN 'ANZEGEN '.
message 'Was möchten Sie denn anzeigen ?' type 'I'.
ENDCASE.
ENDMETHOD. "on_user_command
METHOD on_context_menu_request.
DATA:
column_info TYPE lvc_s_col.
CALL METHOD alv->get_current_cell
IMPORTING
e_row = row
es_col_id = column_info.
CASE column_info-fieldname.
WHEN 'CARRID'.
CALL METHOD e_object->add_function
EXPORTING
fcode = 'CARRIER_INFO'
text = 'Carrier info'(me1). "#EC *
WHEN OTHERS.
ENDCASE.
ENDMETHOD.
ENDCLASS. "lcl_handler IMPLEMENTATION
********************** ENDCLASS ***********************
*ABAP events
START-OF-SELECTION.
SELECT * FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_sflight
WHERE carrid IN so_car
AND connid IN so_con.
LOOP AT it_sflight INTO wa_sflight.
CLEAR: wa_sflight-it_field_colors.
* set indicator for flights of current month
* Fluege des laufenden Monats hervorheben
IF wa_sflight-fldate(6) = sy-datum(6).
CONCATENATE 'C' col_negative '01' INTO wa_sflight-color.
ENDIF.
* set icon for bookings status
* Ikone für Buchungsstatus belegen
IF wa_sflight-seatsocc = 0.
wa_sflight-light = 1.
ELSEIF wa_sflight-seatsocc < 50.
wa_sflight-light = 2.
ELSE.
wa_sflight-light = 3.
ENDIF.
* highlight specific aircraft
* besonderen Flugzeugtyp hervorheben
IF wa_sflight-planetype = '747-400'.
wa_field_color-fname = 'PLANETYPE'.
wa_field_color-color-col = col_positive.
wa_field_color-color-int = 1.
wa_field_color-color-inv = 0.
APPEND wa_field_color TO wa_sflight-it_field_colors.
ENDIF.
* set indicator for flights in the past
* Ikone setzen für Flüge in der Vergangenheit
IF wa_sflight-fldate < sy-datum.
wa_sflight-changes_possible = icon_space.
ELSE.
wa_sflight-changes_possible = icon_okay.
ENDIF.
MODIFY it_sflight
FROM wa_sflight
TRANSPORTING color light it_field_colors changes_possible.
ENDLOOP.
CALL SCREEN 100.
*PBO modules
MODULE status_0100 OUTPUT.
SET PF-STATUS 'DYN'.
SET TITLEBAR 'T1'.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE clear_ok_code OUTPUT.
CLEAR ok_code.
ENDMODULE. " clear_ok_code OUTPUT
MODULE create_and_transfer OUTPUT.
CHECK cont IS INITIAL.
CREATE OBJECT cont
EXPORTING
container_name = 'MY_CONTROL_AREA'
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0 AND sy-batch IS INITIAL.
MESSAGE a010(bc408).
ENDIF.
CREATE OBJECT alv
EXPORTING
i_parent = cont
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0 AND sy-batch IS INITIAL.
MESSAGE a010(bc408).
ENDIF.
* register event handlers
SET HANDLER:
lcl_handler=>on_toolbar FOR alv,
lcl_handler=>on_user_command FOR alv,
lcl_handler=>on_doubleclick FOR alv,
lcl_handler=>print_top FOR alv,
lcl_handler=>print_tol FOR alv,
lcl_handler=>on_context_menu_request FOR alv.
my_variant-report = sy-cprog.
IF NOT pa_lv IS INITIAL.
my_variant-variant = pa_lv.
ENDIF.
my_print-prntlstinf = 'X'.
my_print-grpchgedit = 'X'.
*define layout
wa_layout-grid_title = 'Flights'(h01). "#EC *
wa_layout-no_hgridln = 'X'.
wa_layout-no_vgridln = 'X'.
*field that contains information on row color
wa_layout-info_fname = 'COLOR'.
*internal table that contains information on cell color
wa_layout-ctab_fname = 'IT_FIELD_COLORS'.
*field that contains information on exception (indicator)
wa_layout-excp_fname = 'LIGHT'.
*multiple row and column selection
wa_layout-sel_mode = 'A'.
*fill field catalog
wa_field_cat-fieldname = 'SEATSOCC'.
wa_field_cat-do_sum = 'X'.
APPEND wa_field_cat TO it_field_cat.
CLEAR wa_field_cat.
wa_field_cat-fieldname = 'PAYMENTSUM'.
wa_field_cat-no_out = 'X'.
APPEND wa_field_cat TO it_field_cat.
CLEAR wa_field_cat.
wa_field_cat-fieldname = 'LIGHT'.
wa_field_cat-coltext = 'Utilization'(h02). "#EC *
APPEND wa_field_cat TO it_field_cat.
CLEAR wa_field_cat.
wa_field_cat-fieldname = 'CHANGES_POSSIBLE'.
wa_field_cat-col_pos = 5.
wa_field_cat-coltext = 'Changes possible'(h03). "#EC *
wa_field_cat-tooltip = 'Are changes possible?'(t01). "#EC *
APPEND wa_field_cat TO it_field_cat.
CALL METHOD alv->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
is_variant = my_variant
i_save = 'A'
is_layout = wa_layout
is_print = my_print
CHANGING
it_outtab = it_sflight
it_fieldcatalog = it_field_cat
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE a012(bc408).
ENDIF.
ENDMODULE. " create_and_transfer OUTPUT
*PAI modules
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
PERFORM free.
SET SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*Form routines
FORM free.
CALL METHOD: alv->free,
cont->free.
FREE: alv,
cont.
ENDFORM. " free -
Button in alv grid cell using REUSE_ALV_GRID_DISPLAY
Hi all,
I want to make the contents of 2 columns of my alv grid as push button with values as text on it. I am not using classes or methods but alv grid fm. On clicking the button one dialog box has to pop up which gives edit option for the values in that coloumn, my question is how to introduce button in alv grid cell? if i can use t_fieldcatalog-icon, then please give me the complete steps for that.
Thanks.this may helps u
u need to copy stadard screen elemetn to MARATAB1(at PF -STATUS)
You should copy the 'STANDARD' GUI status from program <b>SAPLSLVC_FULLSCREEN</b>
type this one in SE41 program name is:<b>SAPLSLVC_FULLSCREEN</b>
status : <b>STANDARD_FULLSCREEN</b>
and copy it ...
Type-pool
type-pools slis.
Tables
tables: mara,sscrfields.
Selection screen
select-options: s_matnr for mara-matnr.
PARAMETERS: p_email TYPE somlreci1-receiver.
TYPES: BEGIN OF t_charmara,
matnr(18) TYPE c, " Material Number
ernam(12) TYPE c, " Person Credited
aenam(12) TYPE c, " Person Changed Object
pstat(15) TYPE c, " Maintenance Status
END OF t_charmara.
Data Declarations
data: rt_extab type slis_t_extab, " Table of inactive function
codes
wa_charmara TYPE t_charmara, " work area of mara Table
fs_fieldcat type slis_t_fieldcat_alv,
" Field catalog with field
descriptions
t_fieldcat like line of fs_fieldcat,
" Table of Field catalog
r_ucomm like sy-ucomm, " User Command
rs_selfield TYPE slis_selfield. " cursor position ALV
data: filedlayout type slis_layout_alv,
heading type slis_t_listheader with header line,
t_event type slis_t_event.
data: fs_event like line of t_event.
data: fs_sort type slis_sortinfo_alv,
t_sort type slis_t_sortinfo_alv.
data: w_char(200) type c,
w_matnr type mara-matnr.
fs_sort-fieldname = 'MATNR'.
fs_sort-up = 'X'.
fs_sort-group = '*'.
append fs_sort to t_sort.
clear fS_sort.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
Internal Tables
data: begin of it_mara occurs 0,
matnr like mara-matnr, " Material Number
ernam like mara-ernam, " Person Credited
aenam like mara-aenam, " Person Changed Object
pstat like mara-pstat, " Maintenance Status
end of it_mara.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
*at selection-screen on field event
AT SELECTION-SCREEN on s_matnr.
PERFORM f0100_VALIDATE_MATERIAL_NUMBER.
start-of-selection.
retrive Data from the data base table Mara
perform retrive_data_from_mara.
end-of-selection.
*Field catalog with field descriptions
perform fieldcat.
*perform top_of_page.
PERFORM EVENT_LIST.
*ALV Grid Display
perform alv_display.
Creating one Push button ENTER
perform maratab1 USING RT_EXTAB.
*& Form f0100_VALIDATE_MATERIAL_NUMBER
text
There are no interface parameters to be passed to this subroutine
FORM F0100_VALIDATE_MATERIAL_NUMBER .
select matnr " Material Number
from mara
up to 1 rows
into mara-matnr
where matnr in s_matnr.
endselect.
IF sy-subrc NE 0.
clear sscrfields-ucomm.
MESSAGE e000 WITH 'Enter valid Material number'(003).
ENDIF. " IF sy-subrc NE 0
ENDFORM. " f0100_VALIDATE_MATERIAL_NUMBER
*& Form retrive_data_from_mara
text
*There are no interface parameters to be passed to this subroutine
FORM retrive_data_from_mara .
select matnr " Material Number
ernam " Person Credited
aenam " Person Changed Object
pstat " Maintenance Status
from mara
into table It_mara
where matnr in s_matnr.
IF sy-subrc NE 0.
MESSAGE i001 WITH 'Records are not found'.
exit.
stop.
ENDIF. " IF sy-subrc NE 0
ENDFORM. " retrive_data_from_mara
*& Form fieldcat
text
*There are no interface parameters to be passed to this subroutine
FORM fieldcat .
*field catalog for MATNR
t_FIELDCAT-REF_TABNAME = 'MARA'.
t_fieldcat-fieldname = 'MATNR'.
t_fieldcat-col_pos = 1.
append t_fieldcat to fs_fieldcat.
clear t_fieldcat.
*field catalog for ERNAM
t_FIELDCAT-REF_TABNAME = 'MARA'.
t_fieldcat-fieldname = 'ERNAM'.
t_fieldcat-col_pos = 2.
append t_fieldcat to fs_fieldcat.
clear t_fieldcat.
*field catalog for AENAM
t_FIELDCAT-REF_TABNAME = 'MARA'.
t_fieldcat-fieldname = 'AENAM'.
t_fieldcat-col_pos = 3.
append t_fieldcat to fs_fieldcat.
clear t_fieldcat.
*field catalog for PSTAT
t_FIELDCAT-REF_TABNAME = 'MARA'.
t_fieldcat-fieldname = 'PSTAT'.
t_fieldcat-col_pos = 4.
append t_fieldcat to fs_fieldcat.
clear t_fieldcat.
ENDFORM. " fieldcat
*& Form EVENT_LIST
text
*There are no interface parameters to be passed to this subroutine
FORM EVENT_LIST .
fs_event-name ='TOP_OF_PAGE'.
fs_event-form = 'TOP_PAGE'.
append fs_event TO t_EVENT.
CLEAR FS_EVENT.
fs_event-name ='END_OF_PAGE'.
fs_event-form = 'END_PAGE'.
append fs_event TO t_EVENT.
CLEAR FS_EVENT.
fs_event-name ='END_OF_LIST'.
fs_event-form = 'LIST_END'.
append fs_event TO t_EVENT.
CLEAR FS_EVENT.
ENDFORM. " EVENT_LIST
*& Form alv_display
text
*There are no interface parameters to be passed to this subroutine
FORM alv_display .
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 = 'MARATAB1'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
I_STRUCTURE_NAME =
IS_LAYOUT =
IT_FIELDCAT = FS_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = T_SORT
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = T_EVENT
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
IR_SALV_LIST_ADAPTER =
IT_EXCEPT_QINFO =
I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_MARA[]
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_display
form TOP_PAGE.
data:tbl_listheader type slis_t_listheader,
wa_listheader type slis_listheader .
wa_listheader-typ = 'S'.
wa_listheader-info = 'Created by : Vijay Pawar'.
append wa_listheader to tbl_listheader.
wa_listheader-typ = 'S'.
concatenate ' Date ' sy-datum into
wa_listheader-info separated by space.
append wa_listheader to tbl_listheader.
wa_listheader-typ = 'S'.
concatenate ' From ' s_matnr-low ' To ' s_matnr-high into
wa_listheader-info separated by space.
append wa_listheader to tbl_listheader.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = tbl_listheader
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
endform. " form TOP_PAGE.
form END_PAGE.
STATICS W_PAGE TYPE I .
data:tbl_listheader type slis_t_listheader,
wa_listheader type slis_listheader .
wa_listheader-typ = 'S'.
wa_listheader-info = W_PAGE.
append wa_listheader to tbl_listheader.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = tbl_listheader
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
add 1 to w_page.
endform. " form END_PAGE.
form list_end.
data:tbl_listheader type slis_t_listheader,
wa_listheader type slis_listheader .
wa_listheader-typ = 'S'.
wa_listheader-info = '......................................Last Page'
append wa_listheader to tbl_listheader.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = tbl_listheader
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
endform. " form list_end.
*& Form maratab1
text
-->P_RT_EXTAB text
FORM maratab1 USING P_RT_EXTAB.
SET PF-STATUS 'MARATAB1' EXCLUDING rt_extab.
ENDFORM. " maratab1
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
case r_ucomm.
when 'ENTER'.
perform bulid_xls_data_table.
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using p_email "'[email protected]'
'Example .xls documnet attachment'
'XLS'
'filename'
changing gd_error
gd_reciever.
perform populate_email_message_body.
PERFORM initiate_mail_execute_program.
endcase. " case r_ucomm.
endform. " FORM user_command
perform populate_email_message_body.
PERFORM initiate_mail_execute_program.
CALL FUNCTION 'RH_START_EXCEL_WITH_DATA'
EXPORTING
DATA_FILENAME = 'MARA.XLS'
DATA_PATH_FLAG = 'W'
DATA_ENVIRONMENT =
DATA_TABLE = ITAB[]
MACRO_FILENAME =
MACRO_PATH_FLAG = 'E'
MACRO_ENVIRONMENT =
WAIT = 'X'
DELETE_FILE = 'X'
EXCEPTIONS
NO_BATCH = 1
EXCEL_NOT_INSTALLED = 2
INTERNAL_ERROR = 3
CANCELLED = 4
DOWNLOAD_ERROR = 5
NO_AUTHORITY = 6
FILE_NOT_DELETED = 7
OTHERS = 8
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
leave to list-processing.
endcase.
*& Form bulid_xls_data_table
text
*There are no interface parameters to be passed to this subroutine
FORM bulid_xls_data_table .
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'matnr' 'ernam' 'aenam' 'pstat'
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
LOOP AT It_mara INTO wa_charmara.
CONCATENATE wa_charmara-matnr wa_charmara-ernam
wa_charmara-aenam wa_charmara-pstat
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
ENDLOOP. " LOOP AT it_mara INTO...
ENDFORM. " bulid_xls_data_table
*& Form send_file_as_email_attachment
Send email
-->P_IT_MESSAGE text
-->P_IT_ATTACH text
-->P_P_EMAIL text
-->P_0387 text
-->P_0388 text
-->P_0389 text
-->P_0390 text
-->P_0391 text
-->P_0392 text
<--P_GD_ERROR text
<--P_GD_RECIEVER text
FORM send_file_as_email_attachment tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM. " send_file_as_email_attachment
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM initiate_mail_execute_program.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
REFRESH it_message.
it_message = 'Please find attached a list test mara records'.
APPEND it_message.
endform. "form populate_email_message_bod
rewards if it helps u -
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 -
Hi i have a requirement like to disable one CREATE Button(Creating of Business Partner IS-FS-CM) which is in standard ALV report.I can eliminate that button from PF status of that screen but we are not supposed to change the existing code.But that screen is BDT implemented.
Can you please help out me how to disable that button w/o changing the standard SAP codeHi Krishna,
For example say your PF sataus name is 'STATUS-100' and function code for create is 'CREATE'.
then in your part of code use the following syntax,
SET PF-STATUS 'STATUS-100' EXCLUDING 'CREATE'.
I hope this will help you.
Regards,
Manoj Kumar P
Maybe you are looking for
-
Me and my family have 2 game cetre accounts on one email, but when we try to log into one, we log into the other. Also, we cant start a new apple id
-
Parental controls do not stay locked
I am having a problem with the parental controls. I block the store, podcasts, and control the content ratings. Once this is done, I click on the lock to "lock" the changes. No sooner do I quit iTunes and go back in and the parental lock is back "unl
-
SCCM Reports Will Not Run - SQL Connection Issue
We have SCCM 2012 R2 CU2 and SQL 2012 SP1 CU6. We used to build our SCCM suites with SQL on the site server and have never had this problem that we now have on a new suite but this time we hosted SQL on its own server (SQ01) separate from the site se
-
Hi, In Select options i am passing date range, in the output i want all the dates which are in the range. Thanks in Advance, Santosh
-
BW - Process did not report an instance
what did this error message mean? "Process did not report an instance" Date Time Message text Message class Message no. Message type 23.01.2012 03:31:56 Job started