ALV sort any column in fieldcatalog by default
hi all
i have developed report in ALV format. i have total 8 columns
normally we sort any column in the output only.
i have requirement that instead of sorting manually any column say Material no
it should be sorted by default when user execute the report. he should not do manually by pressing Sort button in
alv list
give code for refrence
hi u can use the IT_SORT parameter of the FM REUSE_ALV_GRID_DISPLAY for this purpose.
specify the fields for which u need to sort ur table and the sorting order
( I have jst given da example for one field but this it_sort table can hav more than one fields.)
gs_alv_sort-spos = 1.
gs_alv_sort-fieldname = 'VKORG'. " Sales Org
gs_alv_sort-up = 'X'. " Ascending
APPEND gs_alv_sort TO gt_alv_sort.
then pass this internal table to teh alv fm
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = wf_repid
I_CALLBACK_HTML_TOP_OF_PAGE = 'HTML_TOP_OF_PAGE'
I_BACKGROUND_ID = 'WEAVE_BACKGROUND'
IS_LAYOUT = gs_alv_layout
IT_FIELDCAT = gt_alv_fieldcat
IT_SORT = gt_alv_sort
TABLES
T_OUTTAB = it_output
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
Similar Messages
-
Do not allow to sort some columns in Alv Grid
Dear friends,
Please help me.
I want to tell to the method set_table_for_first_display - make one of the columns not sortable. Let's say the column name is "My Icon".
What I mean with that is:
when User will highlight column "My icon" and then click on sort buttons in the toolbar - no sort will happen on this column.
I was trying to identify a field in lvc_s_sort which would say "do not sort this column". Is there any?
Or the only way to accomplish my task is to make sort buttons in the toolbar disable if column "My Icon" is clicked?
gt_sort TYPE lvc_t_sort.
CALL METHOD grid1->set_table_for_first_display
EXPORTING i_structure_name = 'IT'
is_layout = gs_layout
is_print = gs_print
CHANGING it_outtab = it
it_fieldcatalog = gt_fcat
it_sort = gt_sort
Thank you,
Tatyana.Got a solution for ya, but you have to handle it thru coding. So you will need to handle an event from your ALV grid.
First thing is that you need a local class as your event handler, copy and paste this code. Here we are using the name ALV_GRID for your alv object
data: alv_grid type ref to cl_gui_alv_grid.
* CLASS lcl_event_receiver DEFINITION
class lcl_event_receiver definition.
public section.
methods handle_user_command
for event before_user_command of cl_gui_alv_grid
importing e_ucomm.
private section.
endclass.
* CLASS lCL_EVENT_RECEIVER IMPLEMENTATION
class lcl_event_receiver implementation.
method handle_user_command.
data: icols type lvc_t_col,
xcols like line of icols.
* Get the currently selected column
call method alv_grid->get_selected_columns
importing
et_index_columns = icols.
read table icols into xcols index 1.
* If the selected column is not one that should be sorted
check xcols-fieldname = 'MATNR'. "<-- Whatever columns that you don't want to allow sorting on.
* Now check the function code, if sort ascending or descending, then give message
check e_ucomm = cl_gui_alv_grid=>mc_fc_sort_asc
or e_ucomm = cl_gui_alv_grid=>mc_fc_sort_dsc.
message i001(00) with 'Can not sort on this column'.
* Now set the UCOMM as if the user didn't click anything.
call method alv_grid->set_user_command( space ).
endmethod.
endclass.
data: event_receiver type ref to lcl_event_receiver.
Also, you will need to set the event hanlder after calling the SET_TABLE_FOR_FIRST_DISPLAY.
call method alv_grid->set_table_for_first_display
changing
it_outtab = i_alv[]
it_fieldcatalog = ifc[].
* Set the handler for ALV grid
create object event_receiver.
set handler event_receiver->handle_user_command for alv_grid.
Just tested this, and works quite well.
Regards,
Rich Heilman -
In iTunes, is there any way to do a mass copy and paste of song titles from the "name" column to the "sort name" column? I know it can be done with individual titles but I have over 6,000 titles in my library.
Thank you. I have heard of Logic Pro 7, but I have never personally used it. I'm still growing in the world of Composition, and I know that it is something I will be studying in one of my Computer Music classes coming up for my degree. I think it is something I will look into getting once I can justify the price of it. I guess for the time being, I will continue to play and grow in my ability to use and take advantage of GB, and then see what I can do about or with Logic Pro when I'm ready. The thought of spending $1000 for a program is hard to bite, because I've already spent a lot to produce my music, not only electronic music, but also chamber music and so on. I had no idea it would be so expensive to dive deep into the world of composition! lol.
Finale 2007: $500
Sibelius 4: $500
Jam Packs: $400
Midi Keyboard Interface: $100
PowerBook: $1700
Printer for printing scores and analysis: $150
Logic Pro 7: Oy!
As you can see it adds up very quickly...that doesn't even include my personal instruments and study materials.
Thank you for your input, as I haven't really worked much with LP, and therefore didn't know which features are available. I will talk with some of my Composition buddies, and professors and see what they have to say as well, and who knows, I may be able to get the express version through one of them. -
ALV: How to sort multiple columns?
Hi all,
Good morning!
I have a requirement to sort multiple columns in ALV. I did a search and tried with following codes:
data: lo_config_alv type ref to cl_salv_wd_config_table.
lo_config_alv->if_salv_wd_table_settings~set_multi_column_sort( value = abap_true ).
But I still can not sort for multiple columns.
Please guide me how to do that.
Thanks,
KhanhHello,
If you want to sort ALV by multiple fields, then you have to create sort rule for each field and set sort position for each field to specify the sequence in which you want to sort multiple columns.
Here is a sample code:
* Sort rows by PRICE descending
DATA: lr_field1 TYPE REF TO cl_salv_wd_field.
DATA: lr_rule1 TYPE REF TO CL_SALV_WD_SORT_RULE.
lr_field1 = lv_value->if_salv_wd_field_settings~get_field( 'PRICE' ).
lr_field1->if_salv_wd_sort~create_sort_rule( EXPORTING sort_order = if_salv_wd_c_sort=>sort_order_descending
RECEIVING value = lr_rule1 ).
lr_rule1->set_sort_position( 2 ). "set the sort position to 2
* Sort rows by seatsmax descending
DATA: lr_field2 TYPE REF TO cl_salv_wd_field.
DATA: lr_rule2 TYPE REF TO CL_SALV_WD_SORT_RULE.
lr_field2 = lv_value->if_salv_wd_field_settings~get_field( 'SEATSMAX' ).
lr_field2->if_salv_wd_sort~create_sort_rule( EXPORTING sort_order = if_salv_wd_c_sort=>sort_order_descending
RECEIVING value = lr_rule2 ).
lr_rule2->set_sort_position( 1 ). "set the sort position to 1
* Sort rows by seatsocc descending
DATA: lr_field TYPE REF TO cl_salv_wd_field.
DATA: lr_rule3 TYPE REF TO CL_SALV_WD_SORT_RULE.
lr_field = lv_value->if_salv_wd_field_settings~get_field( 'SEATSOCC' ).
lr_field->if_salv_wd_sort~create_sort_rule( EXPORTING sort_order = if_salv_wd_c_sort=>sort_order_descending
RECEIVING value = lr_rule3 ).
lr_rule3->set_sort_position( 3 ). "set the sort position to 3
In the above code, the sequence of sorting would be seatsmax price seatsocc
If you dont specify the sort position, then the sequence of sorting would be the order in which the sort rules are created.
In the above example, if we didnt set sort positions for the fields, then order would be price seatsmax seatsocc.
Refer to this link for more info: https://cw.sdn.sap.com/cw/docs/DOC-33859
Hope this helps!
Regards,
Srilatha -
Hi Gurus! how to count number of records in any column of ALV Grid report
Hi Guys!
I want to know how can we count the number of records in any column selected by the user. Like for oe customer there might be 20 sale order that means for 10 customer there will be 200 Sale order. So if i select cutomer number column ti should give 10 out put and whern select sale order it should give 200 as output.
-Anurag JainHi,
Either you can use the hotspot_click event or double_click to show the Pop-up info of the Sales Order count or customer Count depending on the selection.
In the hotspot_click event method you have E_ROW_ID E_COLUMN_ID..using these you can find the Sales Ordert or customer Number.. Loop the internal table and find the Count.
In the double_click event method you have E_ROW E_COLUMN..using these you can find the Sales Ordert or customer Number.. Loop the internal table and find the Count. -
Hotspot-clicking (Insert function) plus ALV Sorting
Hi,
I have a requirement where the ALV display has to be SORTED based on values entered/changed on a certain column. The sort works ok when used with a custom APPEND button for new records (always inserted at the bottom of the list).
However, it does not work correctly when used with the Hotspot-click (INSERT functionality). It looks like if you CLICK on a particular record onscreen, you are actually addressing the original record in that position before the SORT was effected.
Is the Hotspot-clicking (Insert functionality) possible with ALV sorting? The ideal solution would be to have the ALV sorted at PBO and also at PAI so that the user can change existing records and add new ones with the sorting being updated everytime ON_DATA_CHANGED is triggered.
Will appreciate any help on this.
Thanks!
MichaelHello Michael
Thanks for further specifying your requirements. I have created the sample variant ZUS_SDN_ALVGRID_HOTSPOT_SORT_1 which contains two differences as compared to its template:
Replace table VBAK with VBAP (so we have two levels of sorting: VBELN, POSNR)
Move SET_TABLE_FOR_FIRST_DISPLAY method call into PBO
When I click on the hotspot (VBELN) a new row entry for the order number is created. The sorting (VBELN, POSNR) is kept even though the new row has been appended to the itab.
*& Report ZUS_SDN_ALVGRID_HOTSPOT_SORT
*& Thread: Hotspot-clicking (Insert function) plus ALV Sorting
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1159431"></a>
REPORT zus_sdn_alvgrid_hotspot_sort.
TYPES: BEGIN OF ty_s_outtab.
INCLUDE TYPE vbap.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab
WITH DEFAULT KEY.
DATA: gt_outtab TYPE ty_t_outtab.
DATA:
gd_okcode TYPE ui_func,
gd_repid TYPE syrepid,
gt_sort TYPE lvc_t_sort,
gt_fcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo,
gs_variant TYPE disvariant,
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-DATA:
ms_sel_row TYPE lvc_s_row. " selected row
CLASS-METHODS:
handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING
er_data_changed
e_onf4
e_onf4_before
e_onf4_after
sender,
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_data_changed.
FIELD-SYMBOLS: <lt_outtab> TYPE ty_t_outtab.
BREAK-POINT.
ENDMETHOD. "handle_data_changed
METHOD handle_hotspot_click.
" define local data
DATA: ls_outtab TYPE ty_s_outtab,
ld_msg TYPE bapi_msg.
BREAK-POINT.
CLEAR: lcl_eventhandler=>ms_sel_row.
ms_sel_row = e_row_id.
READ TABLE gt_outtab INTO ls_outtab INDEX e_row_id-index.
CONCATENATE 'Selected Sales Order = ' ls_outtab-vbeln ' / '
ls_outtab-posnr
INTO ld_msg.
message i398(00) with ld_msg.
" Trigger PAI
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'INSERT'
* IMPORTING
* rc =
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
PARAMETERS:
p_vkorg TYPE vkorg DEFAULT '0001' OBLIGATORY.
START-OF-SELECTION.
** SELECT * FROM vbak INTO CORRESPONDING FIELDS OF TABLE gt_outtab
** UP TO 200 ROWS
** WHERE vkorg = p_vkorg.
SELECT * FROM vbap INTO CORRESPONDING FIELDS OF TABLE gt_outtab
UP TO 100 ROWS.
PERFORM init_controls.
* Build fieldcatalog and set hotspot for field KUNNR
PERFORM build_fieldcatalog.
PERFORM set_layout_and_variant.
PERFORM set_sorting.
" Register EDIT event
CALL METHOD go_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SET HANDLER:
lcl_eventhandler=>handle_data_changed FOR go_grid,
lcl_eventhandler=>handle_hotspot_click FOR go_grid.
* Link the docking container to the target dynpro
gd_repid = syst-repid.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* ok-code field = GD_OKCODE
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
* Display data
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
i_bypassing_buffer = abap_true
is_variant = gs_variant
i_save = 'A'
* i_default = 'X'
is_layout = gs_layout
* is_print =
* it_special_groups =
* it_toolbar_excluding =
* it_hyperlink =
* it_alv_graphics =
* it_except_qinfo =
* ir_salv_adapter =
CHANGING
it_outtab = gt_outtab
it_fieldcatalog = gt_fcat
it_sort = gt_sort
* it_filter =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
** CALL METHOD go_grid->refresh_table_display
*** EXPORTING
*** IS_STABLE =
*** I_SOFT_REFRESH =
** EXCEPTIONS
** finished = 1
** OTHERS = 2.
** IF sy-subrc ne 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
'EXIT' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'INSERT'.
PERFORM insert_row.
WHEN OTHERS.
" Check for changed data at the frontend (= grid control)
CALL METHOD go_grid->check_changed_data( ).
ENDCASE.
CALL METHOD go_grid->refresh_table_display
* EXPORTING
* IS_STABLE =
* I_SOFT_REFRESH =
EXCEPTIONS
finished = 1
OTHERS = 2.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form INIT_CONTROLS
* text
* --> p1 text
* <-- p2 text
FORM init_controls .
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
others = 6.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD go_docking->set_extension
EXPORTING
extension = 99999
EXCEPTIONS
cntl_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create ALV grid
CREATE OBJECT go_grid
EXPORTING
i_parent = go_docking
EXCEPTIONS
others = 5.
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " INIT_CONTROLS
*& Form BUILD_FIELDCATALOG
* text
* --> p1 text
* <-- p2 text
FORM build_fieldcatalog.
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'VBAP' " 'VBAK'
* 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 NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
** LOOP AT gt_fcat INTO ls_fcat.
** CASE ls_fcat-fieldname.
** WHEN 'VBELN' OR
** 'ERDAT' OR
** 'ERZET' OR
** 'ERNAM' OR
** 'AUART' OR
** 'NETWR' OR
** 'WAERK'.
** CONTINUE.
** WHEN OTHERS.
** ls_fcat-no_out = abap_true.
** ENDCASE.
** MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
** ENDLOOP.
* Only non-key fields are editable
** ls_fcat-edit = 'X'.
** MODIFY gt_fcat FROM ls_fcat
** TRANSPORTING edit
** WHERE ( fieldname NE space ).
ls_fcat-hotspot = abap_true.
MODIFY gt_fcat FROM ls_fcat
TRANSPORTING hotspot
WHERE ( fieldname = 'AUART' OR
fieldname = 'VBELN' ).
** DELETE gt_fcat FROM 15 TO 99.
ENDFORM. " BUILD_FIELDCATALOG_KNB1
*& Form SET_LAYOUT_AND_VARIANT
* text
* --> p1 text
* <-- p2 text
FORM set_layout_and_variant .
CLEAR: gs_layout,
gs_variant.
gs_layout-cwidth_opt = abap_true.
gs_variant-report = syst-repid.
gs_variant-handle = 'GRID'.
ENDFORM. " SET_LAYOUT_AND_VARIANT
*& Form SET_SORTING
* text
* --> p1 text
* <-- p2 text
FORM set_sorting .
* define local data
DATA: ls_sort TYPE lvc_s_sort.
REFRESH: gt_sort.
CLEAR: ls_sort.
ls_sort-spos = 1.
ls_sort-fieldname = 'VBELN'.
ls_sort-up = abap_true.
APPEND ls_sort TO gt_sort.
CLEAR: ls_sort.
ls_sort-spos = 1.
ls_sort-fieldname = 'POSNR'.
ls_sort-up = abap_true.
APPEND ls_sort TO gt_sort.
ENDFORM. " SET_SORTING
*& Form INSERT_ROW
* text
* --> p1 text
* <-- p2 text
FORM insert_row .
* define local data
DATA: ls_outtab TYPE ty_s_outtab,
ld_order TYPE vbeln.
READ TABLE gt_outtab INTO ls_outtab
INDEX lcl_eventhandler=>ms_sel_row-index.
ld_order = ls_outtab-vbeln.
" Find last item of sales order
LOOP AT gt_outtab INTO ls_outtab
WHERE ( vbeln = ld_order ).
ENDLOOP.
" Create next item:
add 10 to ls_outtab-posnr.
" NOTE: added at the end of the list
APPEND ls_outtab TO gt_outtab.
" NOTE: insert new row AFTER selected row => works, too
** INSERT ls_outtab INTO gt_outtab
** INDEX lcl_eventhandler=>ms_sel_row-index.
ENDFORM. " INSERT_ROW -
How not to sort datagrid column on double click
Hello,
I am currently building an application containing a datagrid for data representation. I've created a custom datagridheader in order to add a input text for filtering the columns (see code below).
My goal is to hide the textinput, and then show it on a double click on the header. So i would like to know how to avoid the sort of this column each time i double click.?
<?xml version="1.0" encoding="utf-8"?>
<s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" resize="onColumnResize(event)" clipAndEnableScrolling="true" doubleClick="managefilterField(event)">
<fx:Declarations>
<!--- The default value of the <code>sortIndicator</code> property.
It must be an IFactory for an IVisualElement.
<p>This value is specified in a <code>fx:Declaration</code> block and can be overridden
by a declaration with <code>id="defaultSortIndicator"</code>
in an MXML subclass.</p>
@langversion 3.0
@playerversion Flash 10
@playerversion AIR 2.0
@productversion Flex 4.5
-->
<fx:Component id="defaultSortIndicator">
<s:Path data="M 3.5 7.0 L 0.0 0.0 L 7.0 0.0 L 3.5 7.0" implements="spark.components.gridClasses.IGridVisualElement">
<fx:Script>
<![CDATA[
import spark.components.DataGrid;
import spark.components.Grid;
* @private
public function prepareGridVisualElement(grid:Grid, rowIndex:int, columnIndex:int):void
const dataGrid:DataGrid = grid.dataGrid;
if (!dataGrid)
return;
const color:uint = dataGrid.getStyle("symbolColor");
arrowFill1.color = color;
arrowFill2.color = color;
]]>
</fx:Script>
<s:fill>
<s:RadialGradient rotation="90" focalPointRatio="1">
<!--- @private -->
<s:GradientEntry id="arrowFill1" color="0" alpha="0.6" />
<!--- @private -->
<s:GradientEntry id="arrowFill2" color="0" alpha="0.8" />
</s:RadialGradient>
</s:fill>
</s:Path>
</fx:Component>
<!--- Displays the renderer's label property, which is set to the column's <code>headerText</code>.
It must be an instance of a <code>TextBase</code>, like <code>s:Label</code>.
<p>This visual element is added to the <code>labelDisplayGroup</code> by the renderer's
<code>prepare()</code> method. Any size/location constraints specified by the labelDisplay
define its location relative to the labelDisplayGroup.</p>
<p>This value is specified with a <code>fx:Declaration</code> and can be overridden
by a declaration with <code>id="labelDisplay"</code>
in an MXML subclass.</p>
@langversion 3.0
@playerversion Flash 10
@playerversion AIR 2.0
@productversion Flex 4.5
-->
<s:Label id="labelDisplay"
verticalCenter="1" left="0" right="0" top="0" bottom="0"
textAlign="start"
fontWeight="bold"
verticalAlign="middle"
maxDisplayedLines="1"
showTruncationTip="true" />
</fx:Declarations>
<fx:Script>
<![CDATA[
import net.awl.ismp.console.components.misc.FilterCriteria;
import net.awl.ismp.console.events.ColumnFilteredEvent;
import net.awl.ismp.console.events.ColumnResizedEvent;
import mx.events.ResizeEvent;
import spark.components.gridClasses.IGridVisualElement;
import mx.core.IVisualElement;
import spark.components.DataGrid;
import spark.components.GridColumnHeaderGroup;
import spark.components.gridClasses.GridColumn;
import spark.primitives.supportClasses.GraphicElement;
// chrome color constants and variables
private static const DEFAULT_COLOR_VALUE:uint = 0xCC;
private static const DEFAULT_COLOR:uint = 0xCCCCCC;
private static const DEFAULT_SYMBOL_COLOR:uint = 0x000000;
private static var colorTransform:ColorTransform = new ColorTransform();
* @private
private function dispatchChangeEvent(type:String):void
if (hasEventListener(type))
dispatchEvent(new Event(type));
protected function onColumnResize(event:ResizeEvent):void
dispatchEvent(new ColumnResizedEvent(ColumnResizedEvent.COLUMNRESIZED_EVT,this.width,this.column.columnInde x));
// maxDisplayedLines
private var _maxDisplayedLines:int = 1;
[Bindable("maxDisplayedLinesChanged")]
[Inspectable(minValue="-1")]
* The value of this property is used to initialize the
* <code>maxDisplayedLines</code> property of this renderer's
* <code>labelDisplay</code> element.
* @copy spark.components.supportClasses.TextBase#maxDisplayedLines
* @default 1
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4.5
public function get maxDisplayedLines():int
return _maxDisplayedLines;
override protected function stateChanged(oldState:String, newState:String, recursive:Boolean):void
trace("state changed from : "+oldState+" to "+newState);
super.stateChanged(oldState, newState, recursive);
* @private
public function set maxDisplayedLines(value:int):void
if (value == _maxDisplayedLines)
return;
_maxDisplayedLines = value;
if (labelDisplay)
labelDisplay.maxDisplayedLines = value;
invalidateSize();
invalidateDisplayList();
dispatchChangeEvent("maxDisplayedLinesChanged");
// sortIndicator
private var _sortIndicator:IFactory;
private var sortIndicatorInstance:IVisualElement;
[Bindable("sortIndicatorChanged")]
* A visual element that's displayed when the column is sorted.
* <p>The sortIndicator visual element is added to the <code>sortIndicatorGroup</code>
* by this renderer's <code>prepare()</code> method. Any size/location constraints
* specified by the sortIndicator define its location relative to the sortIndicatorGroup.</p>
* @default null
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion Flex 4.5
public function get sortIndicator():IFactory
return (_sortIndicator) ? _sortIndicator : defaultSortIndicator;
* @private
public function set sortIndicator(value:IFactory):void
trace("setSortIndicator");
if (_sortIndicator == value)
return;
_sortIndicator = value;
if (sortIndicatorInstance)
sortIndicatorGroup.includeInLayout = false;
sortIndicatorGroup.removeElement(sortIndicatorInstance);
sortIndicatorInstance = null;
invalidateDisplayList();
dispatchChangeEvent("sortIndicatorChanged");
* @private
* Create and add the sortIndicator to the sortIndicatorGroup and the
* labelDisplay into the labelDisplayGroup.
override public function prepare(hasBeenRecycled:Boolean):void
trace("prepare !!");
super.prepare(hasBeenRecycled);
if (labelDisplay && labelDisplayGroup && (labelDisplay.parent != labelDisplayGroup))
labelDisplayGroup.removeAllElements();
labelDisplayGroup.addElement(labelDisplay);
trace(sortIndicator);
trace("sortIndicatorInstance : "+sortIndicatorInstance);
const column:GridColumn = this.column;
if (sortIndicator && column && column.grid && column.grid.dataGrid && column.grid.dataGrid.columnHeaderGroup)
const dataGrid:DataGrid = column.grid.dataGrid;
const columnHeaderGroup:GridColumnHeaderGroup = dataGrid.columnHeaderGroup;
if (columnHeaderGroup.isSortIndicatorVisible(column.columnIndex))
if (!sortIndicatorInstance)
sortIndicatorInstance = sortIndicator.newInstance();
sortIndicatorGroup.addElement(sortIndicatorInstance);
chromeColorChanged = true;
invalidateDisplayList();
// Initialize sortIndicator
sortIndicatorInstance.visible = true;
const gridVisualElement:IGridVisualElement = sortIndicatorInstance as IGridVisualElement;
if (gridVisualElement)
gridVisualElement.prepareGridVisualElement(column.grid, -1, column.columnIndex);
sortIndicatorGroup.includeInLayout = true;
sortIndicatorGroup.scaleY = (column.sortDescending) ? 1 : -1;
else
if (sortIndicatorInstance)
sortIndicatorGroup.removeElement(sortIndicatorInstance);
sortIndicatorGroup.includeInLayout = false;
sortIndicatorInstance = null;
private var chromeColorChanged:Boolean = false;
private var colorized:Boolean = false;
* @private
* Apply chromeColor style.
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
//trace("update display list");
// Apply chrome color
if (chromeColorChanged)
var chromeColor:uint = getStyle("chromeColor");
if (chromeColor != DEFAULT_COLOR || colorized)
colorTransform.redOffset = ((chromeColor & (0xFF << 16)) >> 16) - DEFAULT_COLOR_VALUE;
colorTransform.greenOffset = ((chromeColor & (0xFF << 8)) >> 8) - DEFAULT_COLOR_VALUE;
colorTransform.blueOffset = (chromeColor & 0xFF) - DEFAULT_COLOR_VALUE;
colorTransform.alphaMultiplier = alpha;
transform.colorTransform = colorTransform;
var exclusions:Array = [labelDisplay, sortIndicatorInstance];
// Apply inverse colorizing to exclusions
if (exclusions && exclusions.length > 0)
colorTransform.redOffset = -colorTransform.redOffset;
colorTransform.greenOffset = -colorTransform.greenOffset;
colorTransform.blueOffset = -colorTransform.blueOffset;
for (var i:int = 0; i < exclusions.length; i++)
var exclusionObject:Object = exclusions[i];
if (exclusionObject &&
(exclusionObject is DisplayObject ||
exclusionObject is GraphicElement))
colorTransform.alphaMultiplier = exclusionObject.alpha;
exclusionObject.transform.colorTransform = colorTransform;
colorized = true;
chromeColorChanged = false;
super.updateDisplayList(unscaledWidth, unscaledHeight);
* @private
override public function styleChanged(styleProp:String):void
var allStyles:Boolean = !styleProp || styleProp == "styleName";
super.styleChanged(styleProp);
if (allStyles || styleProp == "chromeColor")
chromeColorChanged = true;
invalidateDisplayList();
protected function managefilterField(event:MouseEvent):void
trace("double click sortIndicator : "+this.sortIndicatorInstance);
this.filterInput.visible=!this.filterInput.visible;
this.filterInput.includeInLayout=this.filterInput.visible;
this.filterSpacer.visible=this.filterInput.visible;
this.filterSpacer.includeInLayout=this.filterInput.visible;
if(!this.filterInput.visible)
this.filterInput.text="";
dispatchEvent(new ColumnFilteredEvent(ColumnFilteredEvent.COLUMNFILTERED_EVT,new FilterCriteria(this.column.dataField,this.filterInput.text)));
this.filterInput.setStyle("borderColor",0xFF6319);
this.filterInput.setStyle("focusColor",0xFF6319);
//this.filterInput.setStyle(
protected function onTextInputSelection(event:MouseEvent):void
event.stopImmediatePropagation();
this.filterInput.setStyle("borderColor",0xFF6319);
this.filterInput.setStyle("focusColor",0xFF6319);
protected function onKeyUp(event:KeyboardEvent):void
if(event.charCode==Keyboard.ENTER)
stage.focus=null;
protected function onFocusOut(event:FocusEvent):void
this.filterInput.setStyle("borderColor",0x00ff00);
this.filterInput.setStyle("focusColor",0x70B2EE);
dispatchEvent(new ColumnFilteredEvent(ColumnFilteredEvent.COLUMNFILTERED_EVT,new FilterCriteria(this.column.dataField,this.filterInput.text)));
]]>
</fx:Script>
<s:states>
<s:State name="normal" />
<s:State name="hovered" />
<s:State name="down" />
</s:states>
<!-- layer 1: shadow -->
<!--- @private -->
<s:Rect id="shadow" left="-1" right="-1" top="-1" bottom="-1" radiusX="2">
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color="0x000000"
color.down="0xFFFFFF"
alpha="0.01"
alpha.down="0" />
<s:GradientEntry color="0x000000"
color.down="0xFFFFFF"
alpha="0.07"
alpha.down="0.5" />
</s:LinearGradient>
</s:fill>
</s:Rect>
<!-- layer 2: fill -->
<!--- @private -->
<s:Rect id="fill" left="0" right="0" top="0" bottom="0">
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color="0xFFFFFF"
color.hovered="0xBBBDBD"
color.down="0xAAAAAA"
alpha="0.85" />
<s:GradientEntry color="0xD8D8D8"
color.hovered="0x9FA0A1"
color.down="0x929496"
alpha="0.85" />
</s:LinearGradient>
</s:fill>
</s:Rect>
<!-- layer 3: fill lowlight -->
<!--- @private -->
<s:Rect id="lowlight" left="0" right="0" top="0" bottom="0">
<s:fill>
<s:LinearGradient rotation="270">
<s:GradientEntry color="0x000000" ratio="0.0" alpha="0.0627" />
<s:GradientEntry color="0x000000" ratio="0.48" alpha="0.0099" />
<s:GradientEntry color="0x000000" ratio="0.48001" alpha="0" />
</s:LinearGradient>
</s:fill>
</s:Rect>
<!-- layer 4: fill highlight -->
<!--- @private -->
<s:Rect id="highlight" left="0" right="0" top="0" bottom="0">
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color="0xFFFFFF"
ratio="0.0"
alpha="0.33"
alpha.hovered="0.22"
alpha.down="0.12"/>
<s:GradientEntry color="0xFFFFFF"
ratio="0.48"
alpha="0.33"
alpha.hovered="0.22"
alpha.down="0.12" />
<s:GradientEntry color="0xFFFFFF"
ratio="0.48001"
alpha="0" />
</s:LinearGradient>
</s:fill>
</s:Rect>
<!-- layer 5: highlight stroke (all states except down) -->
<!--- @private -->
<s:Rect id="highlightStroke" left="0" right="0" top="0" bottom="0" excludeFrom="down">
<s:stroke>
<s:LinearGradientStroke rotation="90" weight="1">
<s:GradientEntry color="0xFFFFFF" alpha.hovered="0.22" />
<s:GradientEntry color="0xD8D8D8" alpha.hovered="0.22" />
</s:LinearGradientStroke>
</s:stroke>
</s:Rect>
<!-- layer 6: highlight stroke (down state only) -->
<!--- @private -->
<s:Rect id="hldownstroke1" left="0" right="0" top="0" bottom="0" includeIn="down">
<s:stroke>
<s:LinearGradientStroke rotation="90" weight="1">
<s:GradientEntry color="0x000000" alpha="0.25" ratio="0.0" />
<s:GradientEntry color="0x000000" alpha="0.25" ratio="0.001" />
<s:GradientEntry color="0x000000" alpha="0.07" ratio="0.0011" />
<s:GradientEntry color="0x000000" alpha="0.07" ratio="0.965" />
<s:GradientEntry color="0x000000" alpha="0.00" ratio="0.9651" />
</s:LinearGradientStroke>
</s:stroke>
</s:Rect>
<!--- @private -->
<s:Rect id="hldownstroke2" left="1" right="1" top="1" bottom="1" includeIn="down">
<s:stroke>
<s:LinearGradientStroke rotation="90" weight="1">
<s:GradientEntry color="0x000000" alpha="0.09" ratio="0.0" />
<s:GradientEntry color="0x000000" alpha="0.00" ratio="0.0001" />
</s:LinearGradientStroke>
</s:stroke>
</s:Rect>
<!--<s:Rect id="fill" left="0" right="0" top="0" bottom="0">
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color.normal="0xf9f9f9" color.hovered="0xfcfdfa"
color.down="0xdceac2" alpha="0.85" />
<s:GradientEntry color.normal="0xeaeaea" color.hovered="0xdceac2"
color.down="0xd2e1b5" alpha="0.85" />
</s:LinearGradient>
</s:fill>
</s:Rect>-->
<!--<s:VGroup left="7" right="7" top="5" bottom="5" gap="6" verticalAlign="middle">
<s:TextInput width="100%" />
<s:HGroup width="100%">
<s:Group id="labelDisplayGroup" width="100%" />
<s:Group id="sortIndicatorGroup" includeInLayout="false" />
</s:HGroup>
</s:VGroup>-->
<s:VGroup verticalAlign="middle" left="7" top="5" right="7" bottom="5" gap="2" >
<s:TextInput id="filterInput" width="100%" visible="false" includeInLayout="false" keyUp="onKeyUp(event)" focusOut="onFocusOut(event)" click="onTextInputSelection(event)"/>
<s:Spacer id="filterSpacer" visible="false" includeInLayout="false" height="5" />
<s:HGroup width="100%" height="100%" verticalAlign="middle">
<s:Group id="labelDisplayGroup" width="100%" />
<s:Group id="sortIndicatorGroup" includeInLayout="false" />
</s:HGroup>
</s:VGroup>
</s:GridItemRenderer>Based on your idea, i've intercepted the click event and I use stopImmediatePropagation.
THen i added an image to sort the column. So if the image is clicked the sort is ok. -
Can we apply sorting on Column values in Cross tab??
Can we apply sorting on Column values in Cross tab??
Following is the scenario with me.
I have 2 fields and one formula.
Fields are HostName and Username.
Formula is status which categorizes the Authorized and Unauthorized events.
And in the Summary Field, I am calculating the total number of events.
In cross tab, Fields are marking the Rows of the cross tab and Formula is making the Columns(Authorized and Unauthorized ) of the cross tab.
Since in cross tab data is grouped from left to right and sorted by default. I want to remove this default sorting and want to put sorting on the formula for Unauthorized events.
Is there any way to fulfill this requirement?Hi,
You can assign a number to each Unauthorised field e.g
Rank Unauthorised
1 A
2 BC
3 DF
5 TD
6 GF
Then add "Rank" to the crostab Columns before the Unauthorised field. Then you can control the sorting order on your crosstab.
Hope this helps
Regards
Dotun -
Sort datagrid column in groupby
Hai
can any one help to sort the advanced datagrid column in ascending
by default the values will be in groupby format..
how to sort in groupby...
Thanks in AdvanceHai
can any one help to sort the advanced datagrid column in ascending
by default the values will be in groupby format..
how to sort in groupby...
Thanks in Advance -
Setting sort priority to 90.0 by default instead of standard 100.0
Hai,
I have requirement in which i have to upload some 100 roles from SAP R/3. When these 100 roles are imported, it will have sort priority 100.00. I have created a another Iview, that also has sort priority as 100.0 by default.
When I assign few of the roles and the Iview to a user this Iview is coming in between the roles. I want this Iview to be shown in the extreme right in Second Level Navigation. This I can do by changing the sort priority of 100 roles to 90.0. My users are not interested in changing 100 roles.
The below is the approach which I thought of doing but I don't know how to do it, please let me how to achieve this or is there any other way to do it.
When ever a object, role, IVIEW is created by default sort priority 100.0 is assigned to those object. I want to set that value to 90.0 So that when ever i create a new object the sort priority has the value 90.0.
Please let me know how to do this.
Thanks & Regards,
H.K.Hayath Basha.Hai Rasmus,
Thanks for the information.
If I am going to create Iview then I can use a template to create Iview.
I am using Role Upload function in portal to upload roles for SAP R/3, after I upload the role, the uploaded role has sort priory 100.0. I want to have a sort prioriy as 90.0 when ever I upload a role or create a role.
Please let me know how to do this.
Regards,
H.K.Hayath Basha. -
How to sort a column directly after data is filled into the grid?
Hello,
I have a unbound field X, which is filled on fly in the RowLoaded2 column. If I click on the column header, I am able to sort the column.
I want to sort the column directly, but all attempts have failed.
I have tried to call in <anchor>_OnUpdate
<anchor>.bcol.Sort( "X", "ASC") but it does not work as long as the property is not mapped to a Segment field of a bdoc. For this test i just created my property X on the Business Objects behind the tablegrid
I have used <tablegridcontrol>.sortCol = 2, but it results into a StackOverflowException even for any other column.
Is there no way to sort the colum in this special kind of situation?
Regards,
AndreasHi,
you have to consider that when loading a tile for the first time always rowloaded2 is fired (several times) and afterwards onload. Maybe rowloaded2 again afterwards. So it should work to sort in onload.
But when clicking the <back> button in the menue the order of the fired events might be different!
Do you want to sort by an unbound column which is readonly or is it also editable (see other thread)? In this case things might be much more complicate... Normally another sorting should be done in onsave event but unfortunately you don't save anything as it is unbound...
Regards,
Wolfhard -
How can I make iTunes sort on the first word by default, even though that word is "The" or "A"?
I myself think that (for instance) "A tribe called Quest" should be sorted under "A", not "T".
Now I can edit the sort options manually per track and/or per selection, but I would really like to just kill this "iTunes-knows-how-you-should-sort"-feature in iTunes.
Anyone any suggestion on how to do that?
ThanksHere is a modified version of one of Doug's Scripts. My modification was to add Sort Name to the list of tags that could be changed. I tried it on a single track and it worked. I recommend backing up your library first. Select the tracks you want to change (or all tracks) and run the script from the Applescript Editor. If it works as intended, save it so you can apply it to newly imported tracks. And, yes, I know this isn't the exact answer to your question, you want to change a preference setting in iTunes (if there is such a setting).
Original script can be forund at http://dougscripts.com/itunes/scripts/ss.php?sp=thistagthattag
Modified script is below. Start up Applescript Editor, paste it into a new window. Start up iTunes and select the tracks to modify. Click Run in the Applescript Editor. Follow the instructions.
(* Put This In That
v2.0 april 22 2008
- runs as universal binary
- adds "Show" tag
- consolidated code
- saved as script bundle
v1.7 October 3, 2006
- adds "Album Artist" as option
v1.6 October 28, 2004
- works around iTunes 4.7 selection bug
v1.5 ('04/1)-- adds "grouping" tag
Get more free AppleScripts and info on writing your own
at Doug's AppleScripts for iTunes
http://dougscripts.com/itunes/
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Get a copy of the GNU General Public License by writing to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
or visit http://www.gnu.org/copyleft/gpl.html
-- CONSTANTS
property allOptions : {"Song Name", "Artist", "Album", "Album Artist", "Composer", "Genre", "Comments", "Show", "Grouping", "Sort Name"}
property my_title : "Put This In That"
global thisTag, thatTag, theNewTags, theOriginalTags, yn
tell application "iTunes"
if selection is not {} then -- if tracks are selected...
set sel to selection
set numTracks to (length of sel)
set s to "s"
if numTracks is 1 then set s to ""
display dialog "The data from one tag REPLACES the data in another tag in all the selected tracks, with option to delete data in first tag." & return & return & (numTracks & " track" & s & " selected.") buttons {"Cancel", "Continue"} default button 2 with title my_title giving up after 30
if gave up of result is true then return
my choose_this_tag()
my choose_that_tag()
set yn to (button returned of (display dialog "Delete data in " & thisTag & " afterwards?" buttons {"Yes", "No"} default button 2 with title my_title giving up after 45) is "Yes")
set oldfi to fixed indexing
set fixed indexing to true
repeat with t from 1 to numTracks
tell contents of item t of sel
set theOriginalTags to {get name, get artist, get album, get album artist, get composer, get genre, get comment, get show, get grouping, get sort name}
set theNewTags to theOriginalTags
my do_put()
set {name, artist, album, album artist, composer, genre, comment, show, grouping, sort name} to theNewTags
end tell
end repeat
set fixed indexing to oldfi
else
display dialog "No tracks have been selected." buttons {"Cancel"} default button 1 with icon 0 giving up after 30
end if -- no selection
end tell
to choose_this_tag()
tell application "iTunes"
set n to (choose from list allOptions with prompt ("Select a tag to get data from:") with title my_title)
if n is false then error number -128
set thisTag to (n as text)
end tell
end choose_this_tag
to choose_that_tag()
set o to {}
repeat with t in allOptions
if (t as text) is not thisTag then copy t to end of o
end repeat
tell application "iTunes"
set n to choose from list o with prompt ("Use data from the " & thisTag & " tag to REPLACE data in...") with title my_title
if n is false then error number -128
set thatTag to n as text
end tell
end choose_that_tag
to do_put()
try
repeat with i from 1 to (length of allOptions)
if thisTag is (item i of allOptions) then
set thisTag_sto to (item i of theOriginalTags)
exit repeat
end if
end repeat
repeat with i from 1 to (length of allOptions)
if thatTag is (item i of allOptions) then
set (item i of theNewTags) to thisTag_sto
exit repeat
end if
end repeat
if yn then
repeat with i from 1 to (length of allOptions)
if thisTag is (item i of allOptions) then
set (item i of theNewTags) to ""
exit repeat
end if
end repeat
end if
end try
end do_put -
Cannot sort a column in Numbers for iPad
I have a Numbers IOS spreadsheet on my iPad which contains 6 worsheets. I can sort the columns in all but one worksheet. In the problem worsheet, when I tap on the grey bar above any column, the menu that appears excludes the "Sort" option. What is wrong?
Generally, you are more likely to get an answer if you post in the iWork for iOS forum at
https://discussions.apple.com/community/app_store/iwork_for_ios
Cheers, Tom -
In Alv table, a column is editable mode, but want few cells in read only
Hi All,
I have a ALV table which column A and B.
Both are in editable mode. I want to make fews in column B, to be read only.
How to make it. Please help me.
Thanks
Vimalrajhi,
refer this program,
*& Report ZALV_COLOR_DISPLAY_EDIT
REPORT zalv_color_display_edit.
TYPE-POOLS: slis.
TABLES : zcust_master2.
INTERNAL TABLE DECLARATION
TYPES : BEGIN OF wi_zcust_master2,
zcustid LIKE zcust_master2-zcustid,
zcustname LIKE zcust_master2-zcustname,
zaddr LIKE zcust_master2-zaddr,
zcity LIKE zcust_master2-zcity,
zstate LIKE zcust_master2-zstate,
zcountry LIKE zcust_master2-zcountry,
zphone LIKE zcust_master2-zphone,
zemail LIKE zcust_master2-zemail,
zfax LIKE zcust_master2-zfax,
zstat LIKE zcust_master2-zstat,
field_style TYPE lvc_t_styl,
END OF wi_zcust_master2.
DATA: it_wi_zcust_master2 TYPE STANDARD TABLE OF wi_zcust_master2
INITIAL SIZE 0,
wa_zcust_master2 TYPE wi_zcust_master2.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA: it_fieldcat TYPE lvc_t_fcat, "slis_t_fieldcat_alv WITH HEADER
line,
wa_fieldcat TYPE lvc_s_fcat,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE lvc_s_layo, "slis_layout_alv,
gd_repid LIKE sy-repid.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM set_specific_field_attributes.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
wa_fieldcat-fieldname = 'ZCUSTID'.
wa_fieldcat-scrtext_m = 'CUSTOMER ID'.
wa_fieldcat-col_pos = 0.
wa_fieldcat-outputlen = 10.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ZCUSTNAME'.
wa_fieldcat-scrtext_m = 'CUSTOMER NAME'.
wa_fieldcat-col_pos = 1.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ZADDR'.
wa_fieldcat-scrtext_m = 'ADDRESS'.
wa_fieldcat-col_pos = 2.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ZCITY'.
wa_fieldcat-scrtext_m = 'CITY'.
wa_fieldcat-col_pos = 3.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ZSTATE'.
wa_fieldcat-scrtext_m = 'STATE'.
wa_fieldcat-col_pos = 4.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ZCOUNTRY'.
wa_fieldcat-scrtext_m = 'COUNTRY'.
wa_fieldcat-col_pos = 5.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ZPHONE'.
wa_fieldcat-scrtext_m = 'PHONE NUMBER'.
wa_fieldcat-col_pos = 6.
wa_fieldcat-edit = 'X'. "sets whole column to be editable
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ZEMAIL'.
wa_fieldcat-scrtext_m = 'EMAIL'.
wa_fieldcat-edit = 'X'. "sets whole column to be editable
wa_fieldcat-col_pos = 7.
wa_fieldcat-outputlen = 15.
wa_fieldcat-datatype = 'CURR'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ZFAX'.
wa_fieldcat-scrtext_m = 'FAX'.
wa_fieldcat-col_pos = 8.
wa_fieldcat-edit = 'X'. "sets whole column to be editable
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'ZSTAT'.
wa_fieldcat-scrtext_m = 'STATUS'.
wa_fieldcat-col_pos = 9.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
FORM build_layout.
Set layout field for field attributes(i.e. input/output)
gd_layout-stylefname = 'FIELD_STYLE'.
gd_layout-zebra = 'X'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
FORM display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = gd_repid
is_layout_lvc = gd_layout
it_fieldcat_lvc = it_fieldcat
i_save = 'X'
TABLES
t_outtab = it_wi_zcust_master2
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
text
--> p1 text
<-- p2 text
FORM data_retrieval .
DATA: ld_color(1) TYPE c.
SELECT zcustid zcustname zaddr zcity zstate zcountry zphone zemail
zfax zstat UP TO 10 ROWS FROM zcust_master2 INTO CORRESPONDING FIELDS OF
TABLE it_wi_zcust_master2.
ENDFORM. "data_retrieval
*& Form set_specific_field_attributes
populate FIELD_STYLE table with specific field attributes
FORM set_specific_field_attributes .
DATA ls_stylerow TYPE lvc_s_styl .
DATA lt_styletab TYPE lvc_t_styl .
Populate style variable (FIELD_STYLE) with style properties
The following code sets it to be disabled(display only) if 'ZFAX'
is NOT INITIAL.
LOOP AT it_wi_zcust_master2 INTO wa_zcust_master2.
IF wa_zcust_master2-zfax IS NOT INITIAL.
ls_stylerow-fieldname = 'ZFAX' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
"set field to disabled
APPEND ls_stylerow TO wa_zcust_master2-field_style.
MODIFY it_wi_zcust_master2 FROM wa_zcust_master2.
ENDIF.
ENDLOOP.
ENDFORM. "set_specific_field_attributes
Regards,
K.Tharani. -
I have set a sort order column on one of A VARCHAR field, but the functionality is not working. The sorting is enabled in the table view and when I sort by the said column it still sorts based on the VARCHAR values of the column instead of the other INT column I want to sort by. The logical SQL and physical query never even includes the column to sort. Are there any exceptions for the 'Sort Order Column' setting? Is there a config setting or data connections setting that I need to check to make this work?
Thank You!
Edited by: VNC on Oct 3, 2011 9:08 AMhi,
can you give me more detailes like some sample column data like below kind
Like Ex: varchar month column it sould display based on month id
month : Fev-2011,Dec-2011,jan-2011 and month id 1 to 12
set your month id as sort order column of month name.
double click month name ->In general tab set the sort order column as month id
FYI...see the sample link
http://www.biconsultinggroup.com/obiee-tips-and-tricks/setting-a-sort-order-column.html
i hope helped you
THanks
Deva
Edited by: Devarasu on Oct 4, 2011 12:39 AM
Maybe you are looking for
-
Separate GR/IR clearing account for non material
HI, In the business, already an account is being used as GR/IR clearing account (WRX) for non material receipts (Non material means there is no material code exists in the system but at the time of PO a description is updated manually). There are in
-
I changed my Apple ID on my MacBook. My new Iphone5 seems to have my old Apple ID on it. Therefore I can't download apps. How do I 1) remove the old Apple ID on my Iphone and 2) install the new ID on the phone.
-
HP LaserJet Pro 400 prints highlighted text fields, instead of turning off highlights
I have an electronic medical record with highlighted fields which I fill in. When printing, every other printer only prints the text but not the highlighted background. Unfortunately, the HP laserjet prints the gray background. How do I turn that
-
Enhancement of Business Partner (Relationships) using BDT -Bus Data Toolset
Dear Experts, I have a requirement from my customer enhancing the Business Partner Relationships using BDT. I should add 2 fields namely salary, employer start date in the Business partner Relationships, it must be added in the characteristics of rel
-
Hi, i have a A1186 Mac Pro 2008 Tower. Im running windows 7 64Bit on it. Im not sure about what version of bootcamp should i use to get the drivers. Someone please help me.