2005 Nov 01 9:41 AM
Hi all,
I am developing a ALV based on ABAP Objects.
I have got struck on few things. I need ur advice!!!
Questions:
1. When the program displays the ALV, there is a GAP between the Application Tool Bar and the Grid. How do i remove the Gap
2. Inside the Grid, the Background Color has to be BLUE in Color(in general). But for me, it is displaying as a Normal SAP Screen Color(Light Brown). How do I make the Backround to be in light Blue in color.
3. Is there is anyway of Displaying the GRID directly below (the remaining Screen portion beneth the Application Tool Bar) ???.
Thanks in Advance,
Kam
2005 Nov 01 1:16 PM
Hi all,
I am developing a ALV based on ABAP Objects.
I have got struck on few things. I need ur advice!!!
Questions:
1. When the program displays the ALV, there is a GAP between the Application Tool Bar and the Grid. How do i remove the Gap
2. Inside the Grid, the Background Color has to be BLUE in Color(in general). But for me, it is displaying as a Normal SAP Screen Color(Light Brown). How do I make the Backround to be in light Blue in color.
3. Is there is anyway of Displaying the GRID directly below (the remaining Screen portion beneth the Application Tool Bar) ???.
Thanks in Advance,
Kam
2005 Nov 01 9:58 AM
Hi Kam,
As far as my knowledge goes we can color one Row/one Column/Each Cell in ALV Grid...no idea about background coloring.
If one of them is what you are looking at then solution is simple.
let me know .
2005 Nov 01 10:21 AM
Soujash,
I think, you are refering to use of ZEBRA option.
This option brings the Background of Odd or Even Rows in Blue Color.
But my requirement is to have all the rows with Blue Color bgd!!
Many Thanks
Kam
2005 Nov 01 1:16 PM
2005 Nov 01 1:21 PM
Here is a sample program for ALV in a docking container and coloring the lines blue.
report zrich_0002 .
*****************************************************************
* Use of colours in ALV grid (cell, line and column) *
*****************************************************************
* Table
tables : mara.
* Type
types : begin of ty_mara,
matnr like mara-matnr,
matkl like mara-matkl,
counter(4) type n,
free_text(15) type c,
color_line(4) type c, " Line color
end of ty_mara.
* Structures
data : wa_mara type ty_mara,
wa_fieldcat type lvc_s_fcat,
is_layout type lvc_s_layo,
wa_color type lvc_s_scol.
* Internal table
data : it_mara type standard table of ty_mara,
it_fieldcat type standard table of lvc_s_fcat,
it_color type table of lvc_s_scol.
* Variables
data : okcode like sy-ucomm,
w_alv_grid type ref to cl_gui_alv_grid,
w_docking_container type ref to cl_gui_docking_container.
parameters : p_check.
at selection-screen output.
perform get_data.
perform fill_catalog.
if w_docking_container is initial.
perform create_objects.
endif.
*&--------------------------------------------------------------*
*& Form create_objects
*&--------------------------------------------------------------*
form create_objects.
create object w_docking_container
exporting
extension = 1700
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.
create object w_alv_grid
exporting
i_parent = w_docking_container.
* Field that identify color line in internal table
move 'COLOR_LINE' to is_layout-info_fname.
call method w_alv_grid->set_table_for_first_display
exporting
is_layout = is_layout
changing
it_outtab = it_mara
it_fieldcatalog = it_fieldcat
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4.
endform.
*&--------------------------------------------------------------*
*& Form get_data
*&--------------------------------------------------------------*
form get_data.
select * from mara up to 5 rows.
clear : wa_mara-color_line.
move-corresponding mara to wa_mara.
add 1 to wa_mara-counter.
move 'Blabla' to wa_mara-free_text.
* Color line * Blue *
move 'C110' to wa_mara-color_line.
append wa_mara to it_mara.
endselect.
endform.
*&--------------------------------------------------------------*
*& Form fill_catalog
*&--------------------------------------------------------------*
form fill_catalog.
data : w_position type i value '1'.
clear wa_fieldcat.
move w_position to wa_fieldcat-col_pos.
move 'MATNR' to wa_fieldcat-fieldname.
move 'MARA' to wa_fieldcat-ref_table.
move 'MATNR' to wa_fieldcat-ref_field.
append wa_fieldcat to it_fieldcat.
add 1 to w_position.
clear wa_fieldcat.
move w_position to wa_fieldcat-col_pos.
move 'MATKL' to wa_fieldcat-fieldname.
move 'MARA' to wa_fieldcat-ref_table.
move 'MATKL' to wa_fieldcat-ref_field.
append wa_fieldcat to it_fieldcat.
add 1 to w_position.
clear wa_fieldcat.
move w_position to wa_fieldcat-col_pos.
move 'COUNTER' to wa_fieldcat-fieldname.
move 'N' to wa_fieldcat-inttype.
move '4' to wa_fieldcat-intlen.
move 'Counter' to wa_fieldcat-coltext.
append wa_fieldcat to it_fieldcat.
add 1 to w_position.
clear wa_fieldcat.
move w_position to wa_fieldcat-col_pos.
move 'FREE_TEXT' to wa_fieldcat-fieldname.
move 'C' to wa_fieldcat-inttype.
move '20' to wa_fieldcat-intlen.
move 'Text' to wa_fieldcat-coltext.
append wa_fieldcat to it_fieldcat.
endform.
Regards,
Rich Heilman
2005 Nov 03 2:01 PM
Rich/All,
Thanks for the color issue. I will check this out later. Because i have been asked to concentarate on other HIGH Priority works in the same program.
New Problem:
The tool bar displays at the top of the Container.
SAP gives some Buttons/tools on this Tool Bar.
Question:
How do i remove some Buttons(Change Layout, Excel Emdedding Etc) from this Tool Bar????
My Understanding:
SET PF-STATUS excluding itab.
I have tried with this option . It is able to remove buttons placed in the Apllication Tool Bar.
<b>But we have remove buttons present in the Tool Bar seen at the top of the Container!!!!</b>
I am waiting for the help..
Thanks
Kam
Message was edited by: Kam
2005 Nov 03 2:09 PM
Hi kam,
check this....
data: lt_exclude type ui_functions,
lt_f4 type lvc_t_f4 with header line.
perform exclude_tb_functions changing lt_exclude.
call method g_grid->set_table_for_first_display
EXPORTING
it_toolbar_excluding = lt_exclude
it_hyperlink = gt_hypetab
is_layout = gs_layout
CHANGING
it_fieldcatalog = pt_fieldcat
it_outtab = pt_outtab.
form exclude_tb_functions changing pt_exclude type ui_functions.
* Only allow to change data not to create new entries (exclude
* generic functions).
data ls_exclude type ui_func.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
append ls_exclude to pt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
* append ls_exclude to pt_exclude.
* ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
* append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>MC_FC_CHECK.
append ls_exclude to pt_exclude.
endform. " EXCLUDE_TB_FUNCTIONS
check these links for further help....
http://help.sap.com/saphelp_erp2005/helpdata/en/e5/1cecdc32fc11d4b5c4006094192fe3/frameset.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/0a/b5533cd30911d2b467006094192fe3/frameset.htm
reward points for helpfull answers and close the thread if your question is solved.
regards,
venu.
2005 Nov 03 2:10 PM
Sure, you can do it this way.
data: <b>lt_exclude type ui_functions,</b>
lt_f4 type lvc_t_f4 with header line.
create object g_grid
exporting i_parent = g_docking.
* Build fieldcat and set column WUNIT
* edit enabled. Assign a handle for the dropdown listbox.
perform build_fieldcat changing pt_fieldcat.
* Optionally restrict generic functions to 'change only'.
* (The user shall not be able to add new lines).
<b> perform exclude_tb_functions changing lt_exclude.</b>
* Define a drop down table.
perform set_drdn_table.
select * from sbook into table pt_outtab up to g_max rows.
if sy-subrc ne 0.
* generate own entries if database table is empty
perform generate_entries changing pt_outtab.
endif.
call method g_grid->set_table_for_first_display
<b>exporting it_toolbar_excluding = lt_exclude</b>
changing it_fieldcatalog = pt_fieldcat
it_outtab = pt_outtab.
*&---------------------------------------------------------------------*
*& Form EXCLUDE_TB_FUNCTIONS
*&---------------------------------------------------------------------*
form exclude_tb_functions changing pt_exclude type ui_functions.
* Only allow to change data not to create new entries (exclude
* generic functions).
<b> data ls_exclude type ui_func.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
append ls_exclude to pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
append ls_exclude to pt_exclude.</b>
endform.
The values like mc_fc_loc_copy_row can be found in the attributes tab of the class in SE24. There you can find the specific ones that you want to exclude.
Regards,
Rich Heilman
2005 Nov 07 11:44 AM
Rich/Venu,
Thanks for the Help.
I am now able to remove some buttons on the ALV grid.
Now the other case . I have to add <b>Export to Excel</b> option in the ALV.
Is it possible???
Thanks
Kam
2005 Nov 07 12:07 PM
Hi Kam,
By default the button should be there in alv toolbar , to download data in excel format(icon is a book with yellow horizontal arrow).
click and select spreadsheet
2005 Nov 07 1:31 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |