Evaluate multiple selected rows within ABAP WD ALV
Hi,
I am using ALV within WebDynpros for ABAP. It's easily possible for users to select multiple rows. Subsequently I'd like to process only the selected rows further. How would I find out, which rows were selected?
There should be a standard way via wd_this or wd_context, I don't seem to have found it yet.
All ideas are appreciated.
Regards, Rene
Hi Rene,
If you use external context binding to pass the table, the information of the selected rows should be available in the context node you passed (Get_Selected_elements).
Ciao, Regina
Similar Messages
-
How to display multiple selected rows in a table inside a popup?
Hi,
I have a table on which multiple selection is enabled. I am able to get hold of multiple selected rows i.e. i am able to iterate over the selected row keys and print their values. Now, my problem is how to display the contents of all the selected rows in a popup? I get the details of only one row when I launch the popup.
Thanks
KaranHi,
Not confident if this works or not but just try it...
1. create a ViewLink between the same view Object.
The source and destination wil be the same Vo and the source and destination attribute will be the pk of both Vos.
2. Update the changes in Appln Module.
Open the AM and in DataModel tab .
select the Same VO from which you created table in the DataModel Listbox and select the VL in the "Avaible View Objects" List Box. Add under it(selected vo in datamodel listbox).
3. Refresh DataControl accordion.
4. in your jsff page drag and drop the child vo as a table..
See if it works
Regards,
Santosh. -
Hi all,
I need to get all the selected row of a table and pass it to another node .I followed the thread Re: How to Select Multiple Rows from a Table in Webdynpro Abap
but i am getting errors in the following code
LOOP AT lt_temp INTO wa_temp.
CALL METHOD wa_temp->get_static_attributes
IMPORTING
static_attributes = ls_node1.
APPEND ls_node1 TO lt_node1.
CLEAR ls_node1.
ENDLOOP.
it is throwing move-corresponding error.
Is there any other way of doing it?
Thanks,wa_temp->get_static_attributes(
IMPORTING
static_attributes = ls_node1 ).
ls_node1 is of type node1
and
above declaration implies ls_node1 is type IF_WD_CONTEXT_NODE
wa_temp is of type wa_temp type ref to if_wd_context_element.
above declaration implies wa_temp is of type IF_WD_CONTEXT_ELEMENT
i tell you the easy way, use the CTRL+F7 wizard to Read Context attribute from the context. This will generate the correct code for you to understand exactly how to fetch the attribute value.
for example if i want to read value of attribute STATUS_VISIBILITY from a NODE say NODE_UTILITY
generated code looks like below.
DATA:
node_utility TYPE REF TO if_wd_context_node,
elem_utility TYPE REF TO if_wd_context_element,
stru_utility TYPE if_v_podetails=>element_utility ,
item_status_visibility LIKE stru_utility-status_visibility.
* navigate from <CONTEXT> to <UTILITY> via lead selection
node_utility = wd_context->get_child_node( name = if_v_podetails=>wdctx_utility ).
* get element via lead selection
elem_utility = node_utility->get_element( ).
* get single attribute
elem_utility->get_attribute(
EXPORTING
name = `STATUS_VISIBILITY`
IMPORTING
value = item_status_visibility ).
greetings
Prashant -
How to use DirectCast for multiple selected rows?
Hi<o:p></o:p>
Me.SecondBindingSource.DataSource = DirectCast(parentForm.FirstBindingSource.Current, DataRowView) works perfect for single items but how do I do it if I've selected multiple rows on datagridOne and want to pass only the selected rows to datagridTwo using DirectCast?
Me.SecondBindingSource.DataSource = DirectCast(main.FirstBindingSource.Current, DataRowCollection) does not work??<o:p></o:p>You have to put the rows into a datatable. It is usually best if your original source is a datatable. The filter the original datatable. The selected rows of the datagrid are the same row numbers in the source datatable.
jdweng -
OBIEE - Using Multiple Select Rows In Grid As Parameters
Hello All,
First post from an OBI Newbie. I am getting used to creating dashboards and have got my head around drilling with values, but I have a user requirement that I am not sure is possible.
A standard query returns the following datagrid information ("," = column divider):
Product Id, Product Description, Colour, Total Sales
1, Chair, Red, 4
2, Chair, Blue, 3
3, Chair, Black, 5
I know that I can enable a drill on a specific colour to give a datagrid such as (if Red Selected):
Order Reference, Product Id, Product Description, Colour, Units
687678657, 1, Chair, Red, 3
687678658, 1, Chair, Red, 1
The user requirement is to select multiple rows (possible by holding Ctrl) and to then effectively "drill" with the multiple selected values. Eg Red, Blue:
Order Reference, Product Id, Product Description, Colour, Units
687678657, 1, Chair, Red, 3
687678658, 1, Chair, Red, 1
687678660, 2, Chair, Blue, 3
I presume that a separate report will be required, but I am not sure how to trigger and/or pass the multiple product id's. Can anyone help with a solution?
Edited by: 885689 on 16-Sep-2011 06:27I got this working by changing the signature of the Application Module method to use ArrayList rather than String[], then you can marshal the Struts FormBean contents into an ArrayList to pass up.
To do this, subclass the DataAction by using "Go To Code" off of the context menu and then override the initializeMethodParameters() method:
protected void initializeMethodParameters(DataActionContext actionContext, JUCtrlActionBinding actionBinding)
//Get the String Array from the Form Bean
String[] selection = (String[])((DynaActionForm)actionContext.getActionForm()).get("multiSelect");
//convert that to an ArrayList
ArrayList selectionArr = new ArrayList( Arrays.asList(selection));
//Add that object to the Arg List for the AM method
ArrayList params = new ArrayList();
params.add(selectionArr);
actionBinding.setParams(params);
} -
Multiple selection lists in abap report
I need to populate a multiple selection list and then read the selection in an ABAP report. A parameter with list box is not solving my purpose.
Please give any suggestion on this.Hi
If you can't use the SELECT-OPTION statament, there's no standard solution.
U can only try to create a table control with only one colunm and every hit of the table control is a single hit for the selection.
To insert a table control in a selection-screen u need to use the statament:
SELECTION-SCREEN BEGIN OF TABBED (see the help)
In order to create a TAB where u can load a subscreen where u can insert a table control.
The u need to transfer the hit from table control to a range.
Max -
How to change the selected row color in an alv grid display ?
Hello ,
I WANT TO CHANGE THE COLOR OF THE SELECTED RECORDS IN AN ALV GRID DISPLAY ?
ITS URGENT..
WILL BE REWARDED...hai Ssnagh Samala
EXicut This report >
Hope It Will Meet U r Requirement.
If Found Helpfull Reward.
REPORT zcuitest_alv_07.
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
color_cell TYPE lvc_t_scol, " Cell 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_column AS CHECKBOX,
p_line AS CHECKBOX,
p_cell AS CHECKBOX.
START-OF-SELECTION.
PERFORM get_data.
END-OF-SELECTION.
PERFORM fill_catalog.
PERFORM fill_layout.
CALL SCREEN 2000.
*& Module status_2000 OUTPUT
text
MODULE status_2000 OUTPUT.
SET PF-STATUS '2000'.
ENDMODULE. " status_2000 OUTPUT
*& Module user_command_2000 INPUT
text
MODULE user_command_2000 INPUT.
DATA : w_okcode LIKE sy-ucomm.
MOVE okcode TO w_okcode.
CLEAR okcode.
CASE w_okcode.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " user_command_2000 INPUT
*& Module alv_grid OUTPUT
text
MODULE alv_grid OUTPUT.
IF w_docking_container IS INITIAL.
PERFORM create_objects.
PERFORM display_alv_grid.
ENDIF.
ENDMODULE. " alv_grid OUTPUT
*& Form create_objects
text
--> p1 text
<-- p2 text
FORM create_objects.
Ratio must be included in http://5..95
CREATE OBJECT w_docking_container
EXPORTING
ratio = 95
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.
ENDFORM. " create_objects
*& Form display_alv_grid
text
--> p1 text
<-- p2 text
FORM display_alv_grid.
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. " display_alv_grid
*& Form get_data
text
--> p1 text
<-- p2 text
FORM get_data.
SELECT * FROM mara UP TO 5 ROWS.
CLEAR : wa_mara-color_line, wa_mara-color_cell.
MOVE-CORRESPONDING mara TO wa_mara.
ADD 1 TO wa_mara-counter.
MOVE 'Blabla' TO wa_mara-free_text.
IF wa_mara-counter = '0002'
AND p_line = 'X'.
Color line
MOVE 'C410' TO wa_mara-color_line.
ELSEIF wa_mara-counter = '0004'
AND p_cell = 'X'.
Color cell
MOVE 'FREE_TEXT' TO wa_color-fname.
MOVE '5' TO wa_color-color-col.
MOVE '1' TO wa_color-color-int.
MOVE '1' TO wa_color-color-inv.
APPEND wa_color TO it_color.
wa_mara-color_cell] = it_color[.
ENDIF.
APPEND wa_mara TO it_mara.
ENDSELECT.
ENDFORM. " get_data
*& Form fill_catalog
text
--> p1 text
<-- p2 text
FORM fill_catalog.
Colour code : *
Colour is a 4-char field where : *
- 1st char = C (color property) *
- 2nd char = color code (from 0 to 7) *
0 = background color *
1 = blue *
2 = gray *
3 = yellow *
4 = blue/gray *
5 = green *
6 = red *
7 = orange *
- 3rd char = intensified (0=off, 1=on) *
- 4th char = inverse display (0=off, 1=on) *
Colour overwriting priority : *
1. Line *
2. Cell *
3. Column *
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.
Color column
IF p_column = 'X'.
MOVE 'C610' TO wa_fieldcat-emphasize.
ENDIF.
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. " fill_catalog
*& Form fill_layout
text
--> p1 text
<-- p2 text
FORM fill_layout.
Field that identify color line in internal table
MOVE 'COLOR_LINE' TO is_layout-info_fname.
Field that identify cell color in inetrnal table
MOVE 'COLOR_CELL' TO is_layout-ctab_fname.
ENDFORM. " fill_layout
Regards.
Eshwar. -
Unable to selelct a Row in ABAP Webdynpro ALV table
Hi,
I have a ALV Table in webdynpro and I need to choose a Row in that table. But the table is not allowing me to choose the row.
Row_selectable is at 'X'.
Row selection type is at 8.
Still.. the grid looks like it is in display mode..
pls helpHi
You explicitly need to make the table editable.
DATA lo_table_setings TYPE REF TO if_salv_wd_table_settings.
lo_table = lo_interfacecontroller->get_model( ).
lo_field_settings ?= lo_table.
lo_table_setings->set_cell_action_event_enabled( value = abap_true ).
lo_table_setings->set_read_only( value = abap_false ).
lo_table_setings->set_enabled( value = abap_true ).
have u written thse lines in ur code??
Regards,
Arvind -
Action on selected row in Web dynpro ALV grid
Hello,
i'm pretty new on web dynpro development, and i need some help.
I have a working grid alv and i would like to create an event when i select a row (not editable).
I have looked around and didn't find anything interesting.
Do you have a solution?
Thanks a lot.
CedricHi.,
U have to use onLeadSelection Event Handler.,
Check this tutorial.,: [ALV onLead Selection another ALV|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/7020c76f-c40e-2e10-a795-d88e67740ee4?quicklink=index&overridelayout=true]
hope this helps u.,
Thanks & Regards
Kiran. -
How to colour specific rows within an WebDynpro ALV
Hi everyone,
I need to colour only specific rows of an ALV. I've already scoured sdn and implemented the solutions that I found but none of them seems to be working okay.
I have an ALV table and I want to highlight only a few rows based on a certain logic.
I've defined a context node that defines 2 attributes: textview_design and cell_design.
LOOP AT ft_out_purchase_order_temp INTO ls_out_purchase_order_temp.
if ....
ls_out_purchase_order_temp-textview_design = cl_wd_text_view=>e_design-standard.
ls_out_purchase_order_temp-cell_design = cl_wd_table_column=>e_cell_design-standard.
else.
ls_out_purchase_order_temp-cell_design = cl_wd_table_column=>e_cell_design-total.
ls_out_purchase_order_temp-textview_design = cl_wd_text_view=>e_design-emphasized.
endif.
ENDLOOP.
lr_column_settings ?= po_alv_config_table.
lr_column = lr_column_settings->get_column( 'EBELN' ).
lr_column = po_alv_config_table->if_salv_wd_column_settings~get_column( 'EBELN' ).
lr_column->set_cell_design_fieldname( value = 'CELL_DESIGN' ).
This code works but the thing is that the whole column named 'EBELN' is coloured light green. This is strange because I've instructed the system that the design of the column EBELN is controlled by the field CELL_DESIGN and this field has the following values:
10 (light green)
33 (light blue)
10
10
10
33
10
33
Any ideas?Hii,
To color a particular row you need to follow two things.
1. Specify condition based on which the row will be colored i.e. set the value for the attribute 'CELL_DESIGN'.
2. Get all column references and set the cell design field name with 'CELL_DESIGN'.
Get all column reference.
DATA : LT_COLUMNS TYPE SALV_WD_T_COLUMN_REF,
LS_COLUMNS TYPE SALV_WD_S_COLUMN_REF.
LT_COLUMNS = LR_COLUMN_SETTINGS->GET_COLUMNS( ).
configure column
LR_COLUMN_SETTINGS ?= LV_VALUE. " column functions
LT_COLUMNS = LR_COLUMN_SETTINGS->GET_COLUMNS( ).
set cell design for all.
In your case if a single column is getting colored the then the reason might be
1.every record satisfying your if condition specified.
2.you have set cell design in that particular field name.
Regards,
Monishankar C -
Multiple selection in table not returning all selected rows
I am unable to obtain multiple selected rows from a table. I only get a single row no matter how many I select.
I have the following table
<af:table value="#{bindings.TargetSelectorTargets1.collectionModel}"
var="row"
rows="#{bindings.TargetSelectorTargets1.rangeSize}"
emptyText="#{bindings.TargetSelectorTargets1.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.TargetSelectorTargets1.rangeSize}"
rowBandingInterval="0"
filterModel="#{bindings.ImplicitViewCriteriaQuery2.quickQueryDescriptor}"
queryListener="#{bindings.ImplicitViewCriteriaQuery2.processQuery}"
filterVisible="true" varStatus="vs"
selectedRowKeys="#{bindings.TargetSelectorTargets1.collectionModel.selectedRow}"
selectionListener="#{bindings.TargetSelectorTargets1.collectionModel.makeCurrent}"
rowSelection="multiple"
partialTriggers="::qryId1" id="t3"
styleClass="AFStretchWidth"
binding="#{testbean.targetselectortable}">
<af:column sortProperty="Name" filterable="true"
sortable="true"
headerText="#{bindings.TargetSelectorTargets1.hints.Name.label}"
id="c2">
<af:outputText value="#{row.Name}" id="ot33"/>
</af:column>
<af:column sortProperty="Type" filterable="true"
sortable="true"
headerText="#{bindings.TargetSelectorTargets1.hints.Type.label}"
id="c11">
<af:outputText value="#{row.Type}" id="ot34"/>
</af:column>
</af:table>
and I have the following bean method to get the selected rows
RowKeySet rks = targetselectortable.getSelectedRowKeys();
Iterator itr = rks.iterator();
Object key;
while(itr.hasNext())
key = (Object)itr.next(); targetselectortable.setRowKey(key);
Object o = targetselectortable.getRowData();
JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding) o;
Row row = rowData.getRow();
System.out.println(row.getAttribute("Name").toString());
and I only get one row.
Note: selectedRowKeys="#{bindings.TargetSelectorTargets1.collectionModel.selectedRow}"
shows a warning that "reference selectedRow" not found.
Can I do something to make it work?can u change the logic like
RowKeySet rowSet = targetselectortable.getSelectedRowKeys();
Iterator rowSetIter = rowSet.iterator();
> while (rowSetIter.hasNext()) {
> List l = (List)rowSetIter.next();
> Key key = (Key)l.get(0);
>
FacesContext fc = FacesContext.getCurrentInstance();> BindingContainer bindings =
> (BindingContainer)fc.getApplication().evaluateExpressionGet(fc,
> "#{bindings}",
> BindingContainer.class);
>
DCBindingContainer bindings = (DCBindingContainer)bindings ;> DCIteratorBinding iter =
> bindings.findIteratorBinding("TargetSelectorTargets1Iterator");
>
> iter.setCurrentRowWithKey(key.toStringFormat(true));
> Row r = iter.getCurrentRow();
> System.out.println(row.getAttribute("Name").toString());
> } -
How to capture a selected row in a table control in screen
Hello,
I have a table in a screen and hv data in it also from a table.Now i want if a user selects a row n clicks a display button , i should display the same fields in empty text fields created outside the table on the same screen.
Rite now i m lookin for single selection but any help on multiple selection is also welcomed.
I have given a line-selection element name as 'LSELECT1' to the table in screen painter n have declared a variable also with the same name of type C(1) in my abap prog.But dont know wat to write in PAI now to caputure the selected row.
THANKSHi,
Use ALV to display your table records from FM 'REUSE_ALV_GRID_DISPLAY'.
In your internal table add a field with char1. This will show you the selected records by 'X' or ' '. Use this field in your layout like g_layout-box_fieldname = 'CHK'.
Here i used CHK TYPE CHAR1 added to internal table to display. Now ur ALV will be showing u a column to select records. U can select multiple records also. Evry selected record will reflect into internal table by modifying value of CHK as 'X'. Add button to ALV by creating PF-STATUS and add code its behavior when executed.
DATA: BEGIN OF ls_ekko,
ebeln TYPE ekko-ebeln, " this is my internal table showed in alv
bukrs TYPE ekko-bukrs,
bstyp TYPE ekko-bstyp,
bsart TYPE ekko-bsart,
lifnr TYPE ekko-lifnr,
ekorg TYPE ekko-ekorg,
ekgrp TYPE ekko-ekgrp,
waers TYPE ekko-waers,
chk(1) TYPE c, " check field
END OF ls_ekko.
DATA it_ekko LIKE TABLE OF ls_ekko.
DATA : gt_fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
g_layout TYPE slis_layout_alv,
gt_fcat1 TYPE slis_t_fieldcat_alv WITH HEADER LINE,
g_layout1 TYPE slis_layout_alv.
g_layout-colwidth_optimize = 'X'.
g_layout-box_fieldname = 'CHK'. " adding check field to alv
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'PF_STATUS_ALV'
i_callback_user_command = 'USER_COMMAND_ALV'
IT_EXCLUDING =
I_GRID_TITLE =
I_GRID_SETTINGS =
is_layout = g_layout
it_fieldcat = gt_fcat[]
i_default = 'X'
i_save = 'A'
TABLES
t_outtab = it_ekko
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form PF_STATUS_ALV
Subroutine for PF status
-->RT_EXTAB text
FORM pf_status_alv USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'SELOBJ' EXCLUDING rt_extab.
ENDFORM. "PF_STATUS_ALV
Hope this help -
How to obtain the selected rows in the model with af:Table using selectMany
Hi ,
I am using multi select af:Table and it is based on a programmatically populated view. When the table is single select I can use the getCurrentRow at the view implementation. I wonder whether there is a way to get list of selected rows within the view implementation for the multi-select scenario.
I saw some ways of doing it in the page's backing bean but it will be more appropriate if I could do it at the model project.
Thanks
My environment is JDeveloper 10.1.3.3 and jdk 1.4Thanks for your reply.
What you say makes sense. I thought there might be way of setting the selected rows in the model also as we do woth the current row.
But looks like these two different things.
Anyway I am doing it by passing the values through the backing bean.
Thanks -
How to apply List box for multiple selection of rows in ALV report ?
Hi Exprots,
1: How to apply List box for multiple selection of rows in ALV report ?
Thanking you.
Subashhi,
check the below program.
REPORT zalv_dropdowns.
*Type pools declarations for ALV
TYPE-POOLS : slis.
*data declarations for ALV container,ALV grid, Fieldcatalogues & layout
DATA: g_grid TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container,
gt_fieldcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo.*INTERNAL TABLE AND WA DECLARATIONS FOR t517 A table
DATA: gt_outtab TYPE STANDARD TABLE OF t517a INITIAL SIZE 0,
wa_outtab TYPE t517a.
START-OF-SELECTION.*Call to ALV
CALL SCREEN 600.*On this statement double click it takes you to the screen painter SE51.
*Create a Custom container and name it CCONT and OK code as OK_CODE.
*Save check and Activate the screen painter.
*Now a normal screen with number 600 is created which holds the ALV grid.
PBO of the actual screen , Here we can give a title and customized menus
Here we also call the subroutine for ALV output.
MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
PERFORM alv_output.
ENDMODULE. "pbo OUTPUT
MODULE PAI INPUT *
MODULE pai INPUT.
ENDMODULE. "pai INPUT
*& Form BUILD_FIELDCAT
FORM build_fieldcat.
DATA ls_fcat TYPE lvc_s_fcat.
*Build the field catalogue
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'T517A'
CHANGING
ct_fieldcat = gt_fieldcat.
To assign dropdown in the fieldcataogue
LOOP AT gt_fieldcat INTO ls_fcat.
CASE ls_fcat-fieldname.
WHEN 'SLART'.
*is the first list box
ls_fcat-drdn_hndl = '1'.
ls_fcat-outputlen = 15.
MODIFY gt_fieldcat FROM ls_fcat.
is the second list box
WHEN 'ABART'.
ls_fcat-drdn_hndl = '2'.
ls_fcat-outputlen = 15.
MODIFY gt_fieldcat FROM ls_fcat.
ENDCASE.
ENDLOOP.
ENDFORM. "build_fieldcat
*& Form ALV_OUTPUT
FORM alv_output .*Create object for container
CREATE OBJECT g_custom_container
EXPORTING container_name = 'CCONT'.
*create object for grid
CREATE OBJECT g_grid
EXPORTING i_parent = g_custom_container.
Build fieldcat and set column
*Assign a handle for the dropdown listbox.
PERFORM build_fieldcat.
*Build layout
PERFORM build_layout.
Define a drop down table.
PERFORM dropdown_table.
*fetch values from the T517A table
SELECT * FROM t517a INTO TABLE gt_outtab.
*Display ALV output
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_fieldcatalog = gt_fieldcat
it_outtab = gt_outtab.ENDFORM. "ALV_OUTPUT
*& Form dropdown_table
text
--> p1 text
<-- p2 text
FORM dropdown_table.*Declarations for drop down lists in ALV.
DATA: lt_dropdown TYPE lvc_t_drop,
ls_dropdown TYPE lvc_s_drop.
First SLART listbox (handle '1').
ls_dropdown-handle = '1'.
ls_dropdown-value = '01 Primary school'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '1'.
ls_dropdown-value = '02 Lower Secondary'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '1'.
ls_dropdown-value = '03 Upper Secondary'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '04 Professional School'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '05 College'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '06 University'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '09 Other Establishment'.
APPEND ls_dropdown TO lt_dropdown.* Second ABART listbox (handle '2'). ls_dropdown-handle = '2'.
ls_dropdown-value = '10 Primary School certificate'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '2'.
ls_dropdown-value = '20 Lower secondary/Junior high'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '30 High school diploma(B-levels)'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '2'.
ls_dropdown-value = '31 Vocational'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '32 Matriculation'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '40 Specialist vocational certificate'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '50 College degree Level1'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '51 College degree Level2'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '52 Masters degree'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '60 Univ Degree level1'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '61 Bachelors degree'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '62 Masters degree'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '63 Licenciate'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '64 Doctors Degree Ph.D'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '89 None'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '90 Unknown'.
APPEND ls_dropdown TO lt_dropdown.*method to display the dropdown in ALV
CALL METHOD g_grid->set_drop_down_table
EXPORTING
it_drop_down = lt_dropdown.ENDFORM. " dropdown_table
*& Form build_layout
text
*layout for ALV output
FORM build_layout . gs_layout-cwidth_opt = 'X'.
gs_layout-grid_title = 'ALV DROPDOWN LISTS'.
gs_layout-no_toolbar = 'X'.ENDFORM. " build_layout
endform.
Edited by: S.r.v.r.Kumar on Jun 1, 2009 2:48 PM -
Multiple selection of rows in alv output list
experts,
using 'REUSE_ALV_GRID_DISPLAY'
the following is the sample code ,without using ctrl or shift key i am unable to select multiple rows .
any resolvable answers.
REPORT zpushbutton1.
type-pools : slis.
*structure declarations
types : begin of ty_mara,
matnr type matnr,
ernam type ernam,
mbrsh type mbrsh,
CHKBOX TYPE CHAR1,
end oF ty_mara.
types : begin of ty_marc,
matnr type matnr,
werks type werks_d,
pstat type pstat_d,
end of ty_marc.
*internal table declarations
DATA : gi_mara TYPE STANDARD TABLE OF TY_MARA INITIAL SIZE 0.
data : gi_fieldcat type slis_t_fieldcat_alv.
*workarea declarations
DATA : gs_mara TYPE TY_MARA,
gs_fieldcat type slis_fieldcat_alv.
SELECT matnr
ernam
mbrsh
FROM mara
INTO TABLE gi_mara
UP TO 10 ROWS.
perform build_fieldcat using :
'1' 'CHKBOX' 'GI_MARA' 'SELECT' 'X' ,
'2' 'MATNR' 'GI_MARA' 'MATEIRALNO' ' ',
'3' 'ERNAM' 'GI_MARA' 'PERSON CREAT' ' ',
'4' 'MBRSH' 'GI_MARA' 'INDUSTRY' ' '.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = GI_FIELDCAT
TABLES
t_outtab = GI_MARA
*& Form BUILD_FIELDCAT
form BUILD_FIELDCAT using
PCOL TYPE CHAR2
PFLDNAME TYPE CHAR10
PTABNAME TYPE CHAR10
PSELTEXT TYPE CHAR15
PINPUT TYPE CHAR1.
GS_FIELDCAT-COL_POS = PCOL.
GS_FIELDCAT-FIELDNAME = PFLDNAME.
GS_FIELDCAT-TABNAME = PTABNAME.
GS_FIELDCAT-SELTEXT_M = PSELTEXT.
GS_FIELDCAT-EDIT = PINPUT.
APPEND GS_FIELDCAT TO GI_FIELDCAT.
CLEAR GS_FIELDCAT.
endform. " BUILD_FIELDCAT
thanks and regardsexperts,
can we set cursor properties during the output display
ex : i have used function module reuse_alv_grid_display to display a list of records with passing parameter
is_layout-box_fieldname and is_layout-box_tabname to list the first column as pushbutton.
when i select a row ,gets selected now when i move the
cursor (mouse) to the other row and select the row, the row previously selected will be deselected.
solution to the above problem is to hold the ctrl or shift key for
multiple selections.
is there any other alternative procedure so that without holding
ctrl or shift key multiple rows get selected.
thks and rgrds
Maybe you are looking for
-
URGENT - How to send purchase order as an attachment in email?
Hi, I have a requirement to send PO as an attachment to the user. How to achieve the same using workflows? Regards, Shaurya
-
I am unable to open my PDF attachment in mail.
I cannot open my PDF attachment in mail. I am able to on all of my other apple products but not my air. Is there a setting that i might have wrong?
-
Dear all if i make Ud of an insp lot and in stock posting only post 2 out of 10 to return delivery then save ,where it 'll post the remaining 8 quantity and in which store
-
Query on File Adapter - HeaderLine
Hi All, I've a query related to FCC - header line for the following structure. <?xml version="1.0" encoding="UTF-8"?> <ns0:MT_Testxmlns:ns0="urn:test:file"> <Record> <Record1><field1>X</field1><field2>B</field2></Record1> <Record2><field2>C</fie
-
How do i run a class which has too many dependencies/class/jar file
i am very new in java environment, i have developed a class which has to many jar file, it works fun when i run it from ide but problem arise which i wanna run it from command promt like java classname here is my code import java.sql.Connection; impo