Decrease titel bar in alv
1)Hallow I doing a alv report with to 2 tables one is bigger then another and In the small table I wont to decrease the toolbar(I dont wont icon that I dont use) how can I do that because when I wont to deal with SET_TABLE_FOR_FIRST_DISPLAY I dont have access key. What can I do ?
2) I have header for the 2 tables and I won't header for all the report I try with SET TITLEBAR 'TTT' but its not working what can I do to change this because in my header written sap thanks for your time
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'TTT'
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.
gs_layout-grid_title = text-001.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'YHR_GET_EMP_COURSE_STR'
is_layout = gs_layout
is_variant = variant
i_save = 'A'
CHANGING
it_outtab = itab_final.
ENDIF.
IF g_custom_container1 IS INITIAL.
CREATE OBJECT g_custom_container1
EXPORTING container_name = g_container1.
CREATE OBJECT grid2
EXPORTING i_parent = g_custom_container1.
gs_layout-grid_title = text-002.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'YHR_GET_EMP_DONT_COURSE'
is_layout = gs_layout1
is_variant = variant1
i_save = 'A'
CHANGING
it_outtab = IT_FINAL.
ENDIF.
ENDMODULE. " PBO OUTPUT
Hello Antonio
Here is a sample report. Simply search for <b>SET_GRIDTITLE</b> and <b>SMALLTITLE</b>.
*& Report ZUS_SDN_TWO_ALV_GRIDS_1
REPORT ZUS_SDN_TWO_ALV_GRIDS_1.
DATA:
gd_okcode TYPE ui_func,
go_docking TYPE REF TO cl_gui_docking_container,
go_splitter TYPE REF TO cl_gui_splitter_container,
go_cell_top TYPE REF TO cl_gui_container,
go_cell_bottom TYPE REF TO cl_gui_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid.
data:
gs_layout1 type lvc_s_layo,
gs_layout2 type lvc_s_layo.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1,
gt_knvv TYPE STANDARD TABLE OF knvv.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
* define local data
DATA:
ls_knb1 TYPE knb1.
CHECK ( sender = go_grid1 ).
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
* IS_ROW_ID =
* IS_COLUMN_ID =
is_row_no = es_row_no.
* Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DETAIL' ).
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = '1000'.
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
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.
* Create splitter container
CREATE OBJECT go_splitter
EXPORTING
parent = go_docking
rows = 2
columns = 1
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_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.
* Get cell container
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_top.
CALL METHOD go_splitter->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = go_cell_bottom.
* Create ALV grids
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_cell_top
EXCEPTIONS
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
SET HANDLER: lcl_eventhandler=>handle_double_click FOR go_grid1.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_cell_bottom
EXCEPTIONS
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.
perform SET_LAYOUT_AND_VARIANT.
* Display data
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'KNB1'
is_layout = gs_layout1
CHANGING
it_outtab = gt_knb1
EXCEPTIONS
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 METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'KNVV'
is_layout = gs_layout2
CHANGING
it_outtab = gt_knvv " empty !!!
EXCEPTIONS
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 METHOD go_grid1->set_gridtitle
EXPORTING
i_gridtitle = '1st grid: small title'.
CALL METHOD go_grid2->set_gridtitle
EXPORTING
i_gridtitle = '2st grid: LARGE Title'.
* Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
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.
* NOTE: dynpro does not contain any elements
CALL SCREEN '0100'.
* Flow logic of dynpro (does not contain any dynpro elements):
*PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
*PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"
* SET TITLEBAR 'xxx'.
* Refresh display of detail ALV list
CALL METHOD go_grid2->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
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.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
* User has pushed button "Display Details"
WHEN 'DETAIL'.
PERFORM entry_show_details.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form ENTRY_SHOW_DETAILS
* text
* --> p1 text
* <-- p2 text
FORM entry_show_details .
* define local data
DATA:
ld_row TYPE i,
ls_knb1 TYPE knb1.
CALL METHOD go_grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT * FROM knvv INTO TABLE gt_knvv
WHERE kunnr = ls_knb1-kunnr.
ENDFORM. " ENTRY_SHOW_DETAILS
*& Form SET_LAYOUT_AND_VARIANT
* text
* --> p1 text
* <-- p2 text
form SET_LAYOUT_AND_VARIANT .
gs_layout1-smalltitle = abap_true. " small grid title
gs_layout2-smalltitle = abap_false. " large grid title
endform. " SET_LAYOUT_AND_VARIANT
Regards
Uwe
Similar Messages
-
Remove titel bar from JInternalFrame?
I don't need any of the things in the titel bar and want to remove it. Is this possible? If not is there another way to make the JInternalFrame look less bulky?
you could get the internalFrame's ui and set the north pane to null,
or you could set the client property of isPallette to true -
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 -
How to include tool bar in alv table?
Dear All,
I want to know how to use tool bar in alv table? Is there any seperate interfaces available for it?
Thanks,
Gopi.Hi,
1.To deactivate the Standard buttons:
Data: lr_config_table TYPE REF TO cl_salv_wd_config_table,
lo_value = lo_interfacecontroller->get_model( ).
lr_config_table ?= lo_value .
Wd_this->lr_config_table ?= lo_value .
lr_config_table->if_salv_wd_std_functions~set_edit_append_row_allowed( abap_false ).
lr_config_table->if_salv_wd_std_functions~set_edit_insert_row_allowed( abap_false ).
lr_config_table->if_salv_wd_std_functions~set_edit_delete_row_allowed( abap_false ).
2.To create the customized buttons:
Create the a method initilaze_buttons.
Data:lv_function_add_record_sap TYPE REF TO cl_salv_wd_function,
lv_button_add_record_sap TYPE REF TO cl_salv_wd_fe_button,
R_ALV_TABLE_COMP type ref to CL_SALV_WD_CONFIG_TABLE.
r_alv_table_comp = wd_this->lr_config_table.
Generate Function Objects
lv_function_add_record_sap = wd_this->lr_config_table->if_salv_wd_function_settings~create_function( 'ADD_RECORD_SAP' ).
Generate Buttons
CREATE OBJECT lv_button_add_record_sap.
lv_button_add_record_sap->set_image_source( 'ICON_INSERT_ROW' ).
lv_button_add_record_sap->set_text( 'Add Record' ).
Assign Buttons to Functions
lv_function_add_record_sap->set_editor( lv_button_add_record_sap ).
Set positions of the buttons
lv_function_add_record_sap->set_position( value = 1 ).
Set Alignment of the buttons
lv_function_add_record_sap->set_alignment( value = if_salv_wd_c_function_settings=>align_left ).
Call this method initilaze_buttons in WDDOINIT .
3.To find out which button is clicked an dhandling that function
A)Go to methods tab.
B)give the name of the method as on_button select the method type as Eventhandler.
In the event coulmn select the event ON_FUNCTION of the ALV comp.
METHOD on_button .
DATA index TYPE i.
index = wd_this->sort_index .
CASE r_param->id."r_param->id is importing paramter which comes automatically once u use the event handler
WHEN 'DELETE_ROW'. "Delete row
wd_this->delete_row( )."methods you need to create and call them here.(your own customized button functionality
WHEN 'ADD_RECORD_SAP'.
wd_this->add_record_sap( ).
ENDCASE.
r_param->id holds the value which button is clicked.
Priya -
Moving Scroll bar in ALV?
Hi,
Is it possible to move scroll bar in ALV table programatically, if i have more fields?
Thanks,
GSHi Sathish,
I think you can try have a workaround by using the following method of class
CL_SALV_WD_CONFIG_TABLE~IF_SALV_WD_TABLE_SETTINGS~SET_FIRST_VISIBLE_ROW
It takes Integer as input for Row Number to be displayed as first row. So put your coding within a button up on pressing which you want the scrolling to take place. I however haven't tried it out myself ever...
Regards,
Uday -
How to add a standard tool bar in alv
H i
i am developing a custom report in Alv interactive report for to dispaly MRP information.
Can you sejjest me how to add a standard tool bar in alv.
i displayed one final alv grid display there i have to add standard tool bar and application tool bar.
Thanks,
Rams
Edited by: Ramsoft on Oct 27, 2010 12:09 PMHi,
Give the PF ststus name in the PF status parameter of ALV FM
I_CALLBACK_PF_STATUS_SET = ' PF_STATUS'. " this parameter of ALV FM
FORM pf_status USING pt_extab TYPE slis_t_extab.
SET PF-STATUS 'MAIN' .
ENDFORM. "pf_status
Then create a main PF status by double clicking on it , after this goto EXTRA in menu
EXTRA>ADJUST TEMPLATE> then give program - SAPLSLVC and status - STANDARD this will give u standard toolbar of ALV ,
THen add what ever button you require in application toolbar
Regards,
Madhukar Shetty -
Lock front panel with has titel bar?
How can I lock a front panel that has a title bar?
I do not want that the user
- close the window --> ok, vi-property
- resize the Window --> ok, vi-property
- minimize the window --> ok, vi-property
but:
I also want, that the user can't move the window using the titel bar
I do not want to poll permanently the windows-position.
Any idea?Hello zav,
via vi->property node you can also set the window size. So switch of
closing/resizing/minimizing in the vi properties dialog and do the rest
in a small while loop parallel to your main program (permanently set
the window size to the size of the screen).
Attached is a picture of a sub-vi calculating the window position
regarding to screen size. The output is wired to a property node
'Frontpanel Window.Window Bounds'. Hope this helps...
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome
Attachments:
WindowSize.png 4 KB -
Hi Ppl,
I am using REUSE_ALV_COMMENTARY_WRITE to display top of page in ALV. The issue is i want to restrict the top-of-page height.
As of now if i have 10 lines to print...the top-of-page comes with 10 lines in display.
But i want some (say 4 or 5) to be visible with scroolbar and rest can be viewed by use of the scroll--bar movement!!
Any soln?? Please reply
Regards,
Santosh!!Hi Santosh,
I am not sure if that is possible by using FM approach. - REUSE_ALV_COMMENTARY_WRITE
But yes its possible if you are using Docking Container. with split container approach. ie. OOPs .
Refer sample code.
Constants Declaration
CONSTANTS: c_x TYPE c VALUE 'X',
c_mode TYPE char1 VALUE 'O',
c_mask TYPE char9 VALUE ',*.*,*.*.',
c_error_log TYPE tabname VALUE 'ZERROR_LOG',
c_succ TYPE iconname VALUE '@01@', "#EC *
c_fail TYPE iconname VALUE '@02@',
c_object TYPE emg_object VALUE 'PARTNER'," Legacy obj
c_opbuk TYPE opbuk_kk VALUE 'UK01',
c_split TYPE c
VALUE cl_abap_char_utilities=>horizontal_tab,
c_path TYPE char100
VALUE '/local/data/interface/A28/DM/OUT'.
*Variables Declaration
DATA: flg_pre TYPE c, " Flag - Presentation browse
flg_x TYPE c,
cnt_total TYPE char8, " Total Records processed
cnt_success TYPE char8, " Total Records success
cnt_failed TYPE char8, " Total Records failed
cnt_repeat TYPE char8.
*-- ALV Grid data declaration
CLASS v_lcl_event_receiver DEFINITION
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_print_top_of_page FOR EVENT print_top_of_page OF
cl_gui_alv_grid,
handle_top_of_page FOR EVENT top_of_page OF
cl_gui_alv_grid.
ENDCLASS. "o_lcl_event_receiver DEFINITION
ALV Data declaration
DATA : o_alvgrid TYPE REF TO cl_gui_alv_grid,
o_split TYPE REF TO cl_gui_easy_splitter_container,
o_dockingcontainer TYPE REF TO cl_gui_docking_container,
<b> o_container_top TYPE REF TO cl_gui_container,
o_container_bot TYPE REF TO cl_gui_container,
o_html TYPE REF TO cl_dd_document,</b> o_event_receiver TYPE REF TO lcl_event_receiver,
ok_code LIKE sy-ucomm,
i_fieldcat TYPE lvc_t_fcat,
wa_fieldcat TYPE lvc_s_fcat,
wa_layout TYPE lvc_s_layo.
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
*-- Top of Page
METHOD handle_print_top_of_page.
ENDMETHOD. "handle_print_top_of_page
METHOD handle_top_of_page.
ENDMETHOD. "handle_top_of_page
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
*-- ALV List data declaration
DATA: i_field_cat1 TYPE slis_t_fieldcat_alv,
w_lay_out1 TYPE slis_layout_alv,
w_field_cat TYPE slis_fieldcat_alv,
i_events1 TYPE slis_t_event,
w_event TYPE slis_alv_event,
w_print TYPE slis_print_alv.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STANDARD'.
SET TITLEBAR 'TITLE'.
*-- Create Instances
PERFORM f0040_create_object.
*-- Create Field catalog
PERFORM f0050_field_catalog
TABLES i_fieldcat
USING c_error_log.
*-- Modify Field Catalog
PERFORM f0060_modify_fldcatalog
TABLES i_fieldcat.
*-- Set ALV Layout
PERFORM f0070_layout.
*-- Generate ALV Grid
PERFORM f0080_display_list
TABLES i_error
i_fieldcat
USING wa_layout.
ENDMODULE. " STATUS_0100 OUTPUT
*& Form f0040_create_object
FORM f0040_create_object .
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
*-- Create Container
CREATE OBJECT o_dockingcontainer
EXPORTING
ratio = '95'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc NE 0.
MESSAGE i000 WITH text-013. " Error in object creation
LEAVE LIST-PROCESSING.
ENDIF.
*--Create Splitter Container
CREATE OBJECT o_split
EXPORTING
parent = o_dockingcontainer
sash_position = 20
with_border = 0
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
*--Get the containers of the splitter control
o_container_top = o_split->top_left_container.
o_container_bot = o_split->bottom_right_container.
ENDIF.
CREATE OBJECT o_alvgrid
EXPORTING
i_parent = o_container_bot.
*-- Print Top of Page
PERFORM f0041_top_of_page.
ENDFORM. " f0040_create_object
<b>&----
*& Form f0041_top_of_page</b>
FORM f0041_top_of_page .
DATA: lws_text TYPE sdydo_text_element.
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
*-- Object for HTML top container
CREATE OBJECT o_html
EXPORTING style = 'ALV_GRID'
background_color = 35.
*-- Top of Page
CALL METHOD o_alvgrid->list_processing_events
EXPORTING
i_event_name = 'TOP_OF_PAGE'
i_dyndoc_id = o_html.
*-- Total Record Text
CALL METHOD o_html->add_text
EXPORTING
text = text-014
sap_emphasis = text-017.
CALL METHOD o_html->add_gap
EXPORTING
width = 8.
**-- Total record Value
lws_text = cnt_total.
CALL METHOD o_html->add_text
EXPORTING
text = lws_text
sap_emphasis = text-017.
CLEAR lws_text.
CALL METHOD o_html->new_line
EXPORTING
repeat = 1.
**-- Total Success text
CALL METHOD o_html->add_text
EXPORTING
text = text-015
sap_emphasis = text-017
fix_lines = c_x.
CALL METHOD o_html->add_gap
EXPORTING
width = 12.
lws_text = cnt_success.
CALL METHOD o_html->add_text
EXPORTING
text = lws_text
sap_emphasis = text-017
fix_lines = c_x.
CLEAR lws_text.
CALL METHOD o_html->new_line
EXPORTING
repeat = 1.
*-- Total Failed text
CALL METHOD o_html->add_text
EXPORTING
text = text-016
sap_emphasis = text-017
fix_lines = c_x.
CALL METHOD o_html->add_gap
EXPORTING
width = 16.
lws_text = cnt_failed.
CALL METHOD o_html->add_text
EXPORTING
text = lws_text
sap_emphasis = text-017
fix_lines = c_x.
CLEAR lws_text.
*-- Display Report Header
<b> CALL METHOD o_html->display_document
EXPORTING
parent = o_container_top.</b>
ENDIF.
ENDFORM. " f0041_top_of_page
*& Form f0050_field_catalog
FORM f0050_field_catalog TABLES p_fieldcat STRUCTURE lvc_s_fcat
USING value(p_structure).
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = p_structure
CHANGING
ct_fieldcat = p_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE i000(zo_spa) WITH text-017.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " f0050_field_catalog
*& Form f0070_layout
FORM f0070_layout .
wa_layout-zebra = c_x.
wa_layout-cwidth_opt = c_x.
ENDFORM. " f0070_layout
*& Form f0080_display_list
FORM f0080_display_list TABLES p_output
p_fieldcat
USING value(p_layout).
*-- Display Report
CALL METHOD o_alvgrid->set_table_for_first_display
EXPORTING
i_save = 'A'
is_layout = p_layout
CHANGING
it_outtab = p_output[]
it_fieldcatalog = p_fieldcat[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE i000(zo_spa) WITH text-022. " Error in Displaying
LEAVE LIST-PROCESSING.
ENDIF.
**-- Create Event object
CREATE OBJECT o_event_receiver.
SET HANDLER o_event_receiver->handle_print_top_of_page
FOR o_alvgrid.
ENDFORM. " f0080_display_list
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
ok_code = sy-ucomm.
CASE ok_code.
WHEN 'EXIT' OR 'CANC'.
PERFORM f4000_free_objects:
USING o_alvgrid 'ALV' text-031,
USING o_dockingcontainer 'DOCKING' text-032.
LEAVE PROGRAM.
WHEN 'BACK'.
PERFORM f4000_free_objects:
USING o_alvgrid 'ALV' text-031,
USING o_dockingcontainer 'DOCKING' text-032.
SET SCREEN '0'.
LEAVE SCREEN.
WHEN OTHERS.
PERFORM f4000_free_objects:
USING o_alvgrid 'ALV' text-031,
USING o_dockingcontainer 'DOCKING' text-032.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form f4000_free_objects
FORM f4000_free_objects USING pobject
value(ptype)
value(ptext) TYPE c.
DATA: lo_objectalv TYPE REF TO cl_gui_alv_grid.
CASE ptype.
WHEN 'ALV'.
lo_objectalv = pobject.
IF NOT ( lo_objectalv IS INITIAL ).
CALL METHOD lo_objectalv->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
CLEAR: pobject, lo_objectalv.
PERFORM f4010_error_handle USING ptext.
ENDIF.
WHEN 'DOCKING'.
DATA: lo_objectdock TYPE REF TO cl_gui_docking_container.
lo_objectdock = pobject.
IF NOT ( lo_objectdock IS INITIAL ).
CALL METHOD lo_objectdock->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
CLEAR: pobject, lo_objectdock.
PERFORM f4010_error_handle USING ptext.
ENDIF.
WHEN OTHERS.
sy-subrc = 1.
PERFORM f4010_error_handle
USING text-031.
ENDCASE.
ENDFORM. " f4000_free_objects
*& Form f4010_error_handle
FORM f4010_error_handle USING value(ptext) TYPE c.
IF sy-subrc NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = text-031
txt2 = sy-subrc
txt1 = ptext.
ENDIF.
ENDFORM. " f4010_error_handle
Reward points if this Helps.
Manish -
hi,
I have written an ABAP report using ALV . We need to add a button to the menu bar of the screen that appears after the report is run, not on the selection screen. And when report is executed user will choose for example STOCK then it has to go to the transaction(QA03).
thanks in advance.
Anu.Hi,
Goto SE41, create a pf-status for your alv report program.
On the next screen, click menu EXTRAS --> click option ADJUST TEMPLATES and select radiobutton LIST VIEWER --> you will get all standard buttons of alv in the pf-status.
Delete the unwanted buttons and also you can add new buttons if reqd.
Activate pf-status --> and apply in alv program.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_rep_id " report id
i_callback_pf_status_set = 'PF' " for PF-STATUS
i_callback_user_command = 'USER_COMMAND' " for User-Command
is_layout = wa_layout " for layout
it_fieldcat = it_field " field catalog
it_sort = it_sort " sort info
TABLES
t_outtab = it_final " internal table
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form pf
* SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
* ON WHICH THE ALV GRID IS DISPLAYED
* -->RT_EXTAB
FORM pf USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZTG_STAT'.
ENDFORM. "pf
*& Form USER_COMMAND
* SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
* AND EXECUTE THE APPROPIATE CODE
* -->LV_OKCODE used to capture the function code
* of the user-defined push-buttons
* -->L_SELFIELD text
FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
* assign the function code to variable v_okcode
lv_okcode = sy-ucomm.
* handle the code execution based on the function code encountered
CASE lv_okcode.
* when the function code is STOCK
WHEN 'STOCK'.
SET PARAMETER ID '<param_id>' FIELD '<field_value>'.
CALL TRANSACTION 'QA03' AND SKIP FIRST SCREEN.
ENDCASE.
ENDFORM. "USER_COMMAND
Hope this helps you.
Regards,
Tarun -
Hi,
We have created an object oriented ALV. This ALV output is used in ESS(web enabled). When the user presses the save button, we need to show the processing status on the status bar.We tries this usin the FM 'SAPGUI_PROGRESS_INDICATOR' but we are not able to see the status bar in the browser.Plz help.
With Regards,
Kiran Ihi Kiran,
You can use the ready code and test it.
It will surely give u the result which ur looking for:
TABLES BKPF.
CONSTANTS: C_STEP TYPE I VALUE '4',
C_MSGLNS TYPE I VALUE 20.
DATA: BEGIN OF IBKPF OCCURS 0.
INCLUDE STRUCTURE BKPF.
DATA: END OF IBKPF.
DATA: V_LNS TYPE I,
V_REST TYPE I,
V_LOOP(4) TYPE C,
V_MSG(30) TYPE C,
V_PER TYPE I,
V_LINES(4) TYPE C.
SELECT * FROM BKPF INTO TABLE IBKPF UP TO 50 ROWS.
DESCRIBE TABLE IBKPF LINES V_LNS.
V_LINES = V_LNS.
LOOP AT IBKPF.
IF V_LNS GE C_MSGLNS.
V_LOOP = SY-TABIX.
V_REST = SY-TABIX MOD ( V_LNS / C_MSGLNS ).
IF V_REST EQ 0.
V_PER = SY-TABIX / ( V_LNS / C_MSGLNS ) * C_STEP.
CLEAR V_MSG.
CONCATENATE 'PROCESSING' V_LOOP 'OF' V_LINES INTO _MSG
SEPARATED BY SPACE.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = V_PER
TEXT = V_MSG.
ENDIF.
ENDIF.
ENDLOOP. "IBKPF
Just copy paste this code.it will wrk fine.
Cheers
Sunny
rewrd point , if found helpful -
Problem with refresh button in tool bar in ALV
hello experts,
I am displaying a report using OOPS ALV. Here i am deleting one row. After deleting the row, if i clicked on REFRESH button in the tool bar, it should display the table newly with all updations which i made. wat is the code to perform dis.
thanks in adance,in normal ALV we can refresh using sel-refresh = 'X'.
in OOPS ALV
IF wa_toolbar-function = '&REFRESH'.
wa_toolbar-function = 'REFRESH'.
wa_toolbar-disabled = gc_x.
MODIFY e_object->mt_toolbar FROM wa_toolbar
TRANSPORTING function disabled. -
Puting buttons in the appl bar with alv reporting
hai
im trying to put buttons in alv in applctn bar
the coding i made is
perform eventtab.
form eventtab.
wa_event-name='set_pf_status'.
wa_event-form = 'status'.
append wa_event to tab_event.
endform.
form status.
set pf-status 'ystatus'.----
>status havin buttons.
endform.
the result is
program is geting run time error(shortdump)
error is too many parameters in the perform.
in coding itis pointing arroe mark like this
>form status.
plz help me how to add buttons in application bar
tahnks in advance
sindu.you should not populate FORM name of STATUS to EVENTS. instead you have to give the FORM name to the FUnction module.
check this link,to know how to give our own GUI status.
Re: own PF-Status for REUSE_ALV_GRID_DISPLAY
FORM F_SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
CLEAR : WA_EXTAB,
IT_EXTAB.
*--Set the Modified PF status for the ALV.
SET PF-STATUS 'STATUS_01' EXCLUDING RT_EXTAB.
you have to copy any ALV related GUI status (from SE41 transaction) to STATUS_01. standard alv programs starts with BCALV*. so check it in SE41
copy it and add your own button to the Application tool bar.
ENDFORM. " SET_PF_STATUS
Regards
Srikanth
Message was edited by: Srikanth Kidambi -
Display of only Tool bar in ALV without displaying the table
Hi Experts,
I defined a custom container and split it into 2 containers and used one for Top of page and the other for displaying the ALV.
Now I want to export the entire report to excel sheet. So is there any method for having the Tool bar set for the custom container without displaying the ALV??
I want to get the tool bar for custom container as we will have an option to download to excel sheet.Hi,
You could try creating an instance of the class 'CL_GUI_TOOLBAR' on the custom container.
And then call the method 'add_button' to add the export to Excel functionality.
Here is a sample code..
call method toolbar->add_button
exporting fcode = func code
icon = icon name
is_disabled = ' ' or 'X'
butn_type = '0'
quickinfo = quickinfo information.
Try it .............
Thanks,
Ketan -
How to show message on selection screen status bar if alv is empty.
Hi,
Can anyone tell me how to show message on selection screen status bar when our final internal table or alv is empty .
i am getting message on alv status bar, where no data is in alv but i want to stop it to selection screen and show message there only.
Regards,
RanuHi,
After populating the final internal table do this check,
if it_final [] is initial.
message 'No data available' TYPE 'S' DISPLAY LIKE 'E'.
exit.
endif.
This will be displayed in the selection screen itself
Regards,
Vikranth -
How to inactive the push button on tool bar of alv report
hi masters,
i m working on the ALV interactive report, in this report i have to do 2 different operation on 2 screen.
eg.- on first screen i have the push button for 'data' and on second screen i will have the push button for 'upload'.
in this i don't want to give the 'upload' button on first screen and same i don't want to give the 'data' button on 2nd screen.
i tried with using the 2 different gui status and 2 different PF-STATUS but its not working.
anyone can tell me how i can deactivate the 'upload' button on first screen and how i can do same for 'get' buttton on 2nd screen.
regards,
vickyHI Vicky ,
if u want an interactive ALV report , there are lot of forums already having the solution for that , but let me give u the solution anyway.
In the function module "REUSE_ALV_GRID_DISPLAY" , import parameters
I_CALLBACK_PF_STATUS_SET = 'FLIGHT'
I_CALLBACK_USER_COMMAND = 'BUTTON_CLICK'
has to be supplied to this function module . The PF status is where u hav created the two buttons , that PF status has to be given here .If the user clicks on the button then it is handled by the form routines . Inside the sub-routine based on the button the user has selected u could perform the action.
FORM FLIGHT USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'FLIGHT' EXCLUDING RT_EXTAB.
ENDFORM.
Here the "Flight" is the PF_status .
FORM BUTTON_CLICK USING UCOMM type SY-UCOMM
SELFIELD type SLIS_SELFIELD.
CASE UCOMM.
WHEN 'BUTTON!' .
write ur code for button 1.
WHEN "BUTTON"
*Write ur code for button2 .
end case.
endform.
for any queries reply back.
regards
Maybe you are looking for
-
MacBook Air (Late 2008) WI-FI no hardware installed
Last week all was well...On Friday I learned that the FBI turned off servers that were responsible for DNS changes. I now believe that I was using a rouge server. My wifi no longer works. I have rebooted and reset the PRAM and NVRAM as well as res
-
How do I bring it out of hibernation when it is in black screen
Is system simulating hibernation
-
Using the pen in tx1000 series
How I can remove and place the pencil on the tx1000?, my pencil is stuck on the computer. Some can help me?. Thanks. RWRS
-
Hi , Anyone know the access details for 'guest' for VIKASA workspace.I had this several months ago but right now i can see the application on : http://htmldb.oracle.com/pls/otn/f?p=24317 But the guest/guest is not working . I need to view the page de
-
HT3702 How to redeem a gift card for iTunes?
I have a gift card for $10 to make purchase on iTunes or App Store. I have the redeem code, however, after I choose an app to purchase, it is asking for my credit card info. I do not see where I ca enter the redeem code. Please help, thanks!