Insert data in drop down in alv at run time.
Hi Gurus,
I have to insert data in the dropdown wich is in alv at run time.According to my requirement i have i fill my drop down in the init but depend upon some conditions i have to insert one more vaule in the drop down at the run time.
My problem is that i have filled the drop down with new data but it is not displayed in at the alv output.It is working fine without alv.
Thanks & Regards.
Hi,
As per my understanding you want to update values in the drop down, on enter event of some other field.
For that you have written the code for drop down twice 1) in the init method 2) in the on enter event of one field, right?
If the code is not working in the on enter event, I think you can still use 'WDDOMODIFYVIEW' method. Follow the below steps:
1) create one attribute of type char1 in the attributes tab of the view
2) Set the value of that attribute to 'X' in the on enter event of other field (where you have written the code for drop down)
3) In 'WDDOMODIFYVIEW' method, check the value of attribute. If this is 'X' run the code for updating drop down, then clear the value of attribute
Regards,
Saket.
Similar Messages
-
This occurred when I made a custom menu but deleted it and replaced the menu with the default.
ThanksIn LabVIEW 6 go to VI Properties>Window Appearance>Customize>Show Menu Bar. In LabVIEW 5 it's VI Setup>Window Options>Show Menu Bar.
-
Hi,
i have a problem to insert value in drop down list in ALV. (I want to use this call function CALLFUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC' or 'REUSE_ALV_GRID_DISPLAY)
How can i insert directly in ABAP 3 value. Example of code you can test this :
report ZCO_AFFACT_TEST.
* type pools
TYPE-POOLS: SLIS.
* declarations for alv and internal tables
DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
WA_FIELDCAT TYPE LVC_S_FCAT,
WA_LAYOUT TYPE LVC_S_LAYO,
V_POSITION TYPE I ,
LS_CELLCOLOR TYPE LVC_S_SCOL,
L_INDEX TYPE SY-TABIX.
DATA: BEGIN OF IT_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
flag LIKE ztypfac-flag,
CELLCOLOR TYPE LVC_T_SCOL,
END OF IT_VBAP.
* start of selection
start-of-selection .
*---get data from db table
perform get_data .
*---build layout for alv
perform build_layout .
*---build fieldcat for alv
perform build_fieldcat .
*---modify fieldcat for colors in alv
Perform modify_fieldcat .
*---display alv
perform display_alv .
*& Form get_data
FORM get_data .
SELECT VBELN
POSNR
UP TO 25 ROWS
INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
FROM VBAP.
ENDFORM. " get_data
*& Form build_fieldcat
FORM build_fieldcat .
WA_FIELDCAT-FIELDNAME = 'VBELN'.
WA_FIELDCAT-REPTEXT = 'VBELN'.
WA_FIELDCAT-edit = 'X'.
WA_FIELDCAT-drdn_hndl = '1'. "I have had
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'POSNR'.
WA_FIELDCAT-REPTEXT = 'POSNR'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'FLAG'.
WA_FIELDCAT-REPTEXT = 'FLAG'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. " build_fieldcat
*& Form build_layout
FORM build_layout .
WA_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
WA_LAYOUT-ZEBRA = 'X'.
ENDFORM. " build_layout
*& Form modify_fieldcat
FORM modify_fieldcat .
LOOP AT IT_VBAP.
L_INDEX = SY-TABIX.
if l_index = 5 or l_index = 15.
LS_CELLCOLOR-FNAME = 'VBELN'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '1'.
APPEND LS_CELLCOLOR TO IT_VBAP-CELLCOLOR.
MODIFY IT_VBAP INDEX L_INDEX TRANSPORTING CELLCOLOR.
endif.
if l_index = 10 or l_index = 20.
LS_CELLCOLOR-FNAME = 'VBELN'.
LS_CELLCOLOR-COLOR-COL = '4'.
LS_CELLCOLOR-COLOR-INT = '1'.
APPEND LS_CELLCOLOR TO IT_VBAP-CELLCOLOR.
MODIFY IT_VBAP INDEX L_INDEX TRANSPORTING CELLCOLOR.
endif.
if it_vbap-VBELN is initial .
delete it_vbap.
endif.
ENDLOOP.
ENDFORM. " modify_fieldcat
*& Form display_alv
FORM display_alv .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT_LVC = WA_LAYOUT
IT_FIELDCAT_LVC = IT_FIELDCAT
TABLES
T_OUTTAB = IT_VBAP .
ENDFORM. " display_alv
Thank you for your answers!
Edited by: Emilien P. on Jun 30, 2010 10:42 AMFinaly i have user OO because all the example use the Object...
With my old ALV i have used User command and Hotspot, it is very easy to use.
Now with the OO i have a problem to manage the hot spot and a cell, when i am in mode debug /h when i click on the cell with the hotspot nothing happen !!! I don't undertand what is missing
report ZCO_AFFACT_TEST.
Tables : VBRK, VBRP,ZTYPFAC.
*-- Global data definitions for ALV
*--- ALV Grid instance reference
DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid .
*--- Name of the custom control added on the screen
DATA gc_custom_control_name TYPE scrfname VALUE 'CC_ALV' .
*--- Custom container instance reference
DATA gr_ccontainer TYPE REF TO cl_gui_custom_container .
*--- Field catalog table
DATA gt_fieldcat TYPE lvc_t_fcat .
*--- Layout structure
DATA gs_layout TYPE lvc_s_layo.
types : begin of wls_facture,
... END OF wls_facture.
types : begin of wls_resultat,
... END OF wls_resultat.
data : wlt_facture type TABLE OF wls_facture,
wls_facture type wls_facture,
wlt_final type TABLE OF wls_resultat,
wls_final type wls_resultat.
PERFORM BUILD_DATA.
PERFORM display_alv.
end-of-selection.
call SCREEN 1000.
"display_alv OUTPUT
*& Form display_alv
* text
FORM display_alv .
IF gr_alvgrid IS INITIAL .
*----Creating custom container instance
CREATE OBJECT gr_ccontainer
EXPORTING
container_name = gc_custom_control_name
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
*----Creating ALV Grid instance
CREATE OBJECT gr_alvgrid
EXPORTING
i_parent = gr_ccontainer
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5.
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
*----Preparing field catalog.
PERFORM prepare_field_catalog CHANGING gt_fieldcat .
*----Preparing layout structure
PERFORM prepare_layout CHANGING gs_layout .
PERFORM prepare_drilldown_values.
*----Here will be additional preparations
*--e.g. initial sorting criteria, initial filtering criteria, excluding
*--functions
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_outtab = wlt_final
it_fieldcatalog = gt_fieldcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4 .
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
ELSE .
CALL METHOD gr_alvgrid->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2 .
ENDIF .
ENDFORM . "display_alv
If anybody have an idea Thanks a lot !
Emilien
Edited by: Emilien P. on Jul 1, 2010 4:21 PM -
Drop down in ALV for Webdynpro ABAP
Hi Experts,
I was trying to implement one Web dynpro ABAP application that will show one ALV and ALV will content one dropdown so that user can select data from the drop down. Addtion to that, my dropdown should have data based on another column of ALV.
I have followed one article which is available in Net.
At the end of development, ALV is displayed with dropdown. Also dropdown has data binded. However, no data is visible in dropdown.
I have created one context node having four dictionary element and one elemt for dispplaying the dropdown.
In the DoInit method of view, i have written below code:
Data Declaration
DATA:
lo_node_cskt TYPE REF TO if_wd_context_node,
lo_el_cskt TYPE REF TO if_wd_context_element,
ls_cskt TYPE wd_this->element_cskt,
lt_cskt TYPE wd_this->elements_cskt,
lo_cmp_usage TYPE REF TO if_wd_component_usage,
lv_value TYPE REF TO cl_salv_wd_config_table,
lr_column TYPE REF TO cl_salv_wd_column,
lr_drdn TYPE REF TO cl_salv_wd_uie_dropdown_by_idx,
ls_value_set TYPE wdr_context_attr_value,
lv_tabix TYPE sy-tabix,
lv_count(2) TYPE c,
lo_interfacecontroller TYPE REF TO iwci_salv_wd_table.
Navigate from <CONTEXT> to <CSKT> via lead selection:
lo_node_cskt = wd_context->get_child_node( name = wd_this->wdctx_cskt ).
get element via lead selection
lo_el_cskt = lo_node_cskt->get_element( ).
Get Data:
SELECT kokrs kostl datbi ktext FROM cskt INTO CORRESPONDING FIELDS OF TABLE lt_cskt.
lv_count = 0.
Populate value set
LOOP AT lt_cskt INTO ls_cskt.
lv_tabix = sy-tabix.
CLEAR ls_cskt-ktext.
DO 3 TIMES.
lv_count = lv_count + 1.
CONCATENATE 'TEST' lv_count INTO ls_value_set-text.
CONCATENATE 'TEST' lv_count INTO ls_value_set-value.
if lv_tabix = 2.
if sy-index = 2.
EXIT.
endif.
endif.
APPEND ls_value_set TO ls_cskt-valueset.
ENDDO.
MODIFY lt_cskt FROM ls_cskt INDEX lv_tabix TRANSPORTING ktext valueset.
ENDLOOP.
Bind data
lo_node_cskt->bind_table( lt_cskt ).
Instantiate ALV
lo_cmp_usage = wd_this->wd_cpuse_alv( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
Bind Data to Interface Controller Node
lo_interfacecontroller->set_data(
r_node_data = lo_node_cskt
Get ALV reference table
lv_value = lo_interfacecontroller->get_model( ).
Make KTEXT column as drop down
CALL METHOD lv_value->if_salv_wd_column_settings~get_column
EXPORTING
id = 'KTEXT'
RECEIVING
value = lr_column.
Create Object for Drop down
CREATE OBJECT lr_drdn
EXPORTING
selected_key_fieldname = 'KTEXT'.
CALL METHOD lr_drdn->set_valueset_fieldname
EXPORTING
value = 'VALUESET'.
CALL METHOD lr_drdn->set_type
EXPORTING
value = IF_SALV_WD_C_UIE_DRDN_BY_INDEX=>TYPE_KEY_CONVERT_TO_VALUE.
CALL METHOD lr_column->set_cell_editor
EXPORTING
value = lr_drdn.
CALL METHOD lv_value->if_salv_wd_table_settings~set_read_only
EXPORTING
value = abap_false.
I am still finding the answer why data in drop down is not visible. However, I can select by clicking dropdown and blank elements (since data is not visible) can be selected.Hey
i am using the same code except i have just modified little bit the select statement to restrict the number of entries.
and also besides writing the code in wddoinit i have added the compenent usage of alv component and added the node
having the structure ckst and after that deleting the dictionary reference to add the attribute valueset in both places
component controller and view controller and mapped them and mapped the data node of interface controller of comp
usage to this node in comp contrlr.
and adding the view container and embeding table view of alv comp there.
that's it
and here is the code which is almost same as yours except small change in select statement.
method WDDOINIT .
DATA:
lo_node_cskt TYPE REF TO if_wd_context_node,
lo_el_cskt TYPE REF TO if_wd_context_element,
ls_cskt TYPE wd_this->element_cskt,
lt_cskt TYPE wd_this->elements_cskt,
lo_cmp_usage TYPE REF TO if_wd_component_usage,
lv_value TYPE REF TO cl_salv_wd_config_table,
lr_column TYPE REF TO cl_salv_wd_column,
lr_drdn TYPE REF TO cl_salv_wd_uie_dropdown_by_idx,
ls_value_set TYPE wdr_context_attr_value,
lv_tabix TYPE sy-tabix,
lv_count(2) TYPE c,
lo_interfacecontroller TYPE REF TO iwci_salv_wd_table.
* Navigate from <CONTEXT> to <CSKT> via lead selection:
lo_node_cskt = wd_context->get_child_node( name = wd_this->wdctx_cskt ).
* get element via lead selection
lo_el_cskt = lo_node_cskt->get_element( ).
* Get Data:
SELECT kokrs kostl datbi ktext FROM cskt INTO CORRESPONDING FIELDS OF TABLE lt_cskt up to 10 rows .
lv_count = 0.
* Populate value set
LOOP AT lt_cskt INTO ls_cskt.
lv_tabix = sy-tabix.
CLEAR ls_cskt-ktext.
DO 3 TIMES.
lv_count = lv_count + 1.
CONCATENATE 'TEST' lv_count INTO ls_value_set-text.
CONCATENATE 'TEST' lv_count INTO ls_value_set-value.
if lv_tabix = 2.
if sy-index = 2.
EXIT.
endif.
endif.
APPEND ls_value_set TO ls_cskt-valueset.
ENDDO.
MODIFY lt_cskt FROM ls_cskt INDEX lv_tabix TRANSPORTING ktext valueset.
ENDLOOP.
* Bind data
lo_node_cskt->bind_table( lt_cskt ).
* Instantiate ALV
lo_cmp_usage = wd_this->wd_cpuse_alv( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
* Bind Data to Interface Controller Node
lo_interfacecontroller->set_data(
r_node_data = lo_node_cskt
* Get ALV reference table
lv_value = lo_interfacecontroller->get_model( ).
* Make KTEXT column as drop down
CALL METHOD lv_value->if_salv_wd_column_settings~get_column
EXPORTING
id = 'KTEXT'
RECEIVING
value = lr_column.
* Create Object for Drop down
CREATE OBJECT lr_drdn
EXPORTING
selected_key_fieldname = 'KTEXT'.
CALL METHOD lr_drdn->set_valueset_fieldname
EXPORTING
value = 'VALUESET'.
CALL METHOD lr_drdn->set_type
EXPORTING
value = IF_SALV_WD_C_UIE_DRDN_BY_INDEX=>TYPE_KEY_CONVERT_TO_VALUE.
CALL METHOD lr_column->set_cell_editor
EXPORTING
value = lr_drdn.
CALL METHOD lv_value->if_salv_wd_table_settings~set_read_only
EXPORTING
value = abap_false.
endmethod.
thanks
sarbjeet -
Adding a *Not* Null Entry to a Data-Bound Drop Down List
How do I add a not null entry to a data-bound drop down list? I am supposed to have something like this:
<html:select property="Korisnik1" >
<html:option value="0000">
(Not null value)
</html:option>
<html:option value="-1">
(Null value)
</html:option>
<html:optionsCollection label="prompt" value="index" property="Korisnik1.displayData" />
</html:select >
In case the value 0000 is marked the value should be inserted in to the database. The code above displays the value but insert doesn't work.I think that in this case that article is not what's required Shay as the question related to a "No Null" entry. The answer would be to add it into the list that is used to populate the list in the first place - generally by adding a "union select from dual" to the query that generates the list values.
-
How does one come to know this..drop down in ALV in WD
Hello Friends,
I had a requirement of adding a drop down in ALV, i eventually got it but I have some questions about it
I used the following code and got the drop down
lr_column = lr_column_settings->get_column( 'BWART' ).
CREATE OBJECT lr_input_field
EXPORTING
value_fieldname = 'BWART'.
lr_column->set_cell_editor( lr_input_field ).
DATA : LR_DROPDOWN TYPE REF TO CL_SALV_WD_UIE_DROPDOWN_BY_KEY.
CREATE OBJECT LR_DROPDOWN EXPORTING SELECTED_KEY_FIELDNAME = 'BWART'.
LR_COLUMN->SET_CELL_EDITOR( LR_DROPDOWN ).
DATA: LT_VALUESET TYPE TABLE OF WDR_CONTEXT_ATTR_VALUE,
LS_VALUESET TYPE WDR_CONTEXT_ATTR_VALUE,
LR_NODE TYPE REF TO IF_WD_CONTEXT_NODE,
LR_NODEINFO TYPE REF TO IF_WD_CONTEXT_NODE_INFO.
LR_NODE = WD_CONTEXT->GET_CHILD_NODE( 'RETURN_NODE' ).
LR_NODEINFO = LR_NODE->GET_NODE_INFO( ).
LS_VALUESET-VALUE = '973'.
LS_VALUESET-TEXT = '973'.
APPEND LS_VALUESET TO LT_VALUESET.
LS_VALUESET-VALUE = '222'.
LS_VALUESET-TEXT = '222'.
APPEND LS_VALUESET TO LT_VALUESET.
LR_NODEINFO->SET_ATTRIBUTE_VALUE_SET( EXPORTING NAME = 'BWART' VALUE_SET = LT_VALUESET ).
My question is ... how does 1 know which class to use? how to use that class... most of concepts about OOPS are clear.. but i still cant figure out how does 1 find out which class to use.. is it all by expericence..In short: Yes, by experience. Then again, for WD4A there is a class for each UI-Element available. Once you know this, you can easily search se24 for CLWD<UI-NAME>* or the like.
-
Unable to capture data from drop down list in custom added field in migo tcode at item level
Hi guys,
need bit help in resolving query related to custom added field in Tcode migo.
i have added a field in migo at item level ,in this i have used drop down list
to get data but unable to capture data from drop down list.gown through
many blogs in scn but unable to resolve.
Please help me out in this.
Thanks,
Umakant.Hi,
U can use following code to fill the list box
write this code in PBO
In layout editor please select listbox in dropdown attribute of input field and put some fctcode attribute
TYPE-POOLS vrm.
DATA values TYPE vrm_values WITH HEADER LINE.
TABLES: <ur custom Database table>.
clear values, values[].
SELECT * FROM <ur custom Database table>.
values-text = <TABLE FIELD TO DISPLAY IN DROPDOWN> .
values-key = <TABLE KEY FIELD TO DISPLAY IN DROPDOWN>.
APPEND values.
ENDSELECT.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = '<SCREEN INPUT FIELD NAME>'
values = values[]
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
Also please define the following before accessing the listbox value
data: <listbox input field name> type <table field name>,
<inputfield name where text to display> type string in top include
In PAI, select the text from the table into <inputfield name where text to display> depending on value selected which will be called when enter key is pressed or any vale is selected -
Workflows table is not showing up in Data Manager drop down table list
Hi,
I am able to see Workflows table in Console but not able to see it Data Manager drop down table list in record mode for selection.
Even not allowed to create another workflow table.
Thanks for any tips/clue
-reoReo,
You will not be able to create another workflow table. There is only a single workflow table that will hold all the workflows you create through the Data Manager.
As Vito mentioned, please make sure to load the corresponding MDMWorkflow component on the client machines running the Data Manager that you wish to create and view workflows from.
Once the workflow component is installed you should see it as a new tab in the Data Manager. You will need Visio to create workflows.
Thanks,
Tim -
How to check data type of the field symbol at run time
Hi,
My code is as following:
LOOP AT <fs> ASSIGNING <wa_covp_ext>.
ASSIGN COMPONENT 86 OF STRUCTURE <wa_covp_ext> TO <f_zzname>.
IF sy-subrc = 0.
ASSIGN COMPONENT 158 OF STRUCTURE <wa_covp_ext> TO <f_pernr>.
IF sy-subrc = 0.
SELECT SINGLE sname INTO <f_zzname> FROM pa0001
WHERE pernr = <f_pernr>
AND endda GE sy-datum
AND begda LE sy-datum.
ENDIF.
ENDIF.
ENDLOOP.
This query is giving dump when <f_zzname> is type P length 8 and decimals 2, because it tries to put PA0001-sname into it which is type C length 30. So I want to check the type of <f_zzname> before the select statement. If it is character 30, then I will write the select statement else not.
How to check data type of the field symbol at run time? If it's not possible, then can somebody suggest a workaround? Thanks.check this ...
write describe statement ...
field-symbols : <f_zzname> .
data : sname like pa0001-sname,
typ(10).
assign sname to <f_zzname>.
describe field <f_zzname> type typ.
write : typ. <-- typ contains character type in this case ..
U can check if typ is of character(C) if so .. write the select statement ... -
Drop down in alv based on data in other calumn of same row
Hi Guys,
I need to provide drop down in an ALV based on data in other calumn in same row.
if i have two calumns country and region in my alv then drop down values for region should come depending upon country value.
i went through lot of blogs and forum threads but none seems to solve my problem.
I'm able to achieve this in Table but not in ALV. I'm using DropdownbyIndex Ui element.Hi Guys finally i am able to get my dropdown data visible.
I am posting the code here so that others can make use of it.
In your context node add an attribute type WDR_CONTEXT_ATTR_VALUE_LIST
after getting data into your context node table fill the above attribute as shown in the below code
LOOP AT lt_mara INTO ls_mara.
clear: lv_indx.
lv_indx = sy-tabix.
clear ls_valueset.
*refresh: lt_valueset.
ls_valueset-value = ls_mara-mtart.
ls_valueset-text = ls_mara-mtart.
APPEND ls_valueset to ls_mara-valueset.
clear ls_valueset.
*ls_valueset-text = ls_mara-matnr.
APPEND ls_valueset to ls_mara-valueset.
*lr_element = lo_nd_mara->get_element( lv_indx ).
*lr_child_node = lr_element->get_child_node( 'DDVALUE' ).
*lr_child_node->bind_table( lt_valueset ).
MODIFY lt_mara FROM ls_mara INDEX lv_indx.
CLEAR ls_mara.
ENDLOOP. lo_nd_mara->bind_table( lt_mara ).
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
*---set data
lo_interfacecontroller->set_data( r_node_data = lo_nd_mara ).
DATA lv_value TYPE REF TO cl_salv_wd_config_table.
lv_value = lo_interfacecontroller->get_model(
*----dropdown logic
data: lr_col type ref to CL_SALV_WD_COLUMN,
lr_ddn type ref to cl_salv_wd_uie_dropdown_by_idx.
CALL METHOD lv_value->if_salv_wd_column_settings~get_column
EXPORTING
id = 'MTART'
receiving
value = lr_col
*lr_ddn ?= lr_col->get_cell_editor( ).
CREATE OBJECT lr_ddn
EXPORTING
selected_key_fieldname = 'MTART'
CALL METHOD lr_ddn->set_valueset_fieldname
EXPORTING
value = 'VALUESET'
lr_ddn->set_selected_key_fieldname( value = 'MTART' ).
CALL METHOD lr_ddn->set_type
EXPORTING
value = IF_SALV_WD_C_UIE_DRDN_BY_INDEX=>type_key_value
CALL METHOD lr_col->set_cell_editor
EXPORTING
value = lr_ddn
lv_value->if_salv_wd_table_settings~set_read_only( abap_false ).
Just follow the above code you will be able to achieve dropdown by index in your alv. -
Abt Drop Down For ALV Data cells
Hi,
I m unable to create drop down for each cell of ALV table.
Reply me as soon as possible.
Thks.You need to create an object of type CL_SALV_WD_UIE_DROPDOWN_BY_KEY, which is the UI element for dropdown by key, and set that to be your individual cell editor.
For whichever column you want a dropdown box, use the method set_cell_editor to make the editor as a dropdown box. Hope this helps.
Regards
Nithya -
Drop Down in ALV ABAP and NOT in OO - ABAP
Hello Everyone....
I m workin on an ALV which is in simple ABAP and not in OO-ABAP. There is some selection criteria on the first screen , as soon as the user fulfills the requirement an ALV GRID is displayed in which the last column is editable.
But the Problem is that i wanna make that editable field in ALV as drop down which would contain values from the database table.
Suggest me some method , so that i dont have to do much changes in my code .
A Sample code will be very benificial .
Thanx n Regards,
Harpreet.Hi Harpreet,
[compiled from sap online help - always a good chice]
To make an input/output field into a list box, you must set the value L or LISTBOX in the Dropdown attribute in the Screen Painter. The visLg attribute determines the output width of the list box and the field. You can assign a function code to a list box field. In this case, the PAI event is triggered as soon as the user chooses a value from the list, and the function code is placed in the SY-UCOMM and OK_CODE fields. If you do not assign a function code, the PAI event must be triggered in the usual way that is, when the user chooses a pushbutton or an element from the GUI status.
If you have assigned a list box to an input/output field, you can use the Value list attribute of the screen element to determine how the value list should be compiled. There are two options:
Value list from input help (recommended)
If you do not enter anything in the value list attribute, the text field uses the first column displayed in the input help assigned to the screen field. The input help can be defined in the ABAP Dictionary, the screen, or a POV dialog module. It should be laid out in two columns. The key is automatically filled.
Value list from PBO modules (not recommended).
If you enter A in the value list attribute, you must fill the value list yourself before the screen is sent (for example, in the PBO event) using the function module VRM_SET_VALUES. When you do this, you must pass an internal table with the type VRM_VALUES to the import parameter VALUES of the function module. VRM_VALUES belongs to the type group VRM. The line type is a structure consisting of the two text fields KEY (length 40) and TEXT (length 80). In the table, you can combine possible user entries from the KEY field with any texts from the TEXT component. You specify the corresponding input/output field in the import parameter ID.
Examples
Example
Dropdown box with a value list from input help (recommended)
*& Report DEMO_DROPDOWN_LIST_BOX *
REPORT demo_dropdown_list_box.
*& Global Declarations *
* Screen Interfaces
TABLES sdyn_conn.
DATA ok_code TYPE sy-ucomm.
* Global data
TYPES: BEGIN OF type_carrid,
carrid type spfli-carrid,
carrname type scarr-carrname,
END OF type_carrid.
DATA itab_carrid TYPE STANDARD TABLE
OF type_carrid WITH HEADER LINE.
*& Processing Blocks called by the Runtime Environment *
* Event Block START-OF-SELECTION
START-OF-SELECTION.
CALL SCREEN 100.
* Dialog Module PBO
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
ENDMODULE.
* Dialog Modules PAI
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'SELECTED'.
MESSAGE i888(sabapdocu) WITH sdyn_conn-carrid.
ENDCASE.
ENDMODULE.
* Dialog Module POV
MODULE create_dropdown_box INPUT.
SELECT carrid carrname
FROM scarr
INTO CORRESPONDING FIELDS OF TABLE itab_carrid.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'CARRID'
value_org = 'S'
TABLES
value_tab = itab_carrid
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
ENDMODULE.
The next screen (statically defined) for screen 100 is 100. The only input field on the screen is the component SDYN_CONN-CARRID. Its Dropdown attribute is set to L, and it has the output length 20. The Value list attribute is empty, and it has the function code SELECTED. The function codes of the buttons EXECUTE and CANCEL. CANCEL are defined in the GUI status as having the function type E.
The screen flow logic is as follows:
PROCESS BEFORE OUTPUT.
MODULE status_0100.
PROCESS AFTER INPUT.
MODULE cancel AT EXIT-COMMAND.
MODULE user_command_0100.
PROCESS ON VALUE-REQUEST.
FIELD sdyn_conn-carrid MODULE create_dropdown_box.
Users cannot enter any values into the screen fields. When they choose the input field on screen 100, the system displays a list box. The Value list attribute is empty, so the system launches the input mechanism. In this case, the event block PROCESS ON VALUE-REQUEST is created in the screen flow logic. This event block controls all other mechanisms. A two-column internal table is filled in the appropriate dialog module and passed to the input help using the F4IF_INT_TABLE_VALUE_REQUEST function module. The system inserts the two columns of the table into the list box.
When the user chooses a line in the list box, the PAI event is triggered using the function code SELECTED and the value in the first column of the internal table is copied to the input field.
Regards,
Clemens -
Issue in value set Drop down for ALV in Webdynpro with Index
Hi Experts,
We are unable to get the Drop down values in the ALV Table as shown below.
Code:
DATA lo_nd_table TYPE REF TO if_wd_context_node.
DATA lt_table TYPE wd_this->elements_table.
DATA ls_table TYPE wd_this->element_table.
DATA: lr_input TYPE REF TO cl_salv_wd_uie_input_field,
lr_column TYPE REF TO cl_salv_wd_column,
lt_node_info TYPE wdr_context_attr_info_map,
ls_node_info TYPE wdr_context_attribute_info,
lr_dropdown TYPE REF TO cl_salv_wd_uie_dropdown_by_idx,
lr_info TYPE REF TO if_wd_context_node_info.
DATA:lt_columns TYPE salv_wd_t_column_ref,
ls_columns TYPE salv_wd_s_column_ref,
lv_tabix TYPE sy-tabix,
lv_count TYPE c.
DATA: ls_valueset TYPE wdr_context_attr_value,
lt_valueset TYPE wdr_context_attr_value_list.
TYPES:BEGIN OF ty_name,
name TYPE string,
END OF ty_name.
DATA: lt_name TYPE TABLE OF ty_name,
ls_name TYPE ty_name.
* navigate from <CONTEXT> to <TABLE> via lead selection
lo_nd_table = wd_context->get_child_node( name = wd_this->wdctx_table ).
SELECT * FROM zemp_table INTO CORRESPONDING FIELDS OF TABLE lt_table UP TO 10 ROWS.
LOOP AT lt_table INTO ls_table.
lv_tabix = sy-tabix.
CLEAR: ls_table-leave_values.
DO 1 TIMES.
lv_count = lv_count + 1.
CONCATENATE 'Open' lv_count INTO ls_valueset-value.
CONCATENATE 'Open' lv_count INTO ls_valueset-text.
APPEND ls_valueset TO ls_table-leave_values.
CLEAR ls_valueset.
CONCATENATE 'Approved' lv_count INTO ls_valueset-value.
CONCATENATE 'Approved' lv_count INTO ls_valueset-text.
APPEND ls_valueset TO ls_table-leave_values.
CLEAR ls_valueset.
CONCATENATE 'Rejected' lv_count INTO ls_valueset-value.
CONCATENATE 'Rejected' lv_count INTO ls_valueset-text.
APPEND ls_valueset TO ls_table-leave_values.
CLEAR ls_valueset.
ENDDO.
MODIFY lt_table FROM ls_table INDEX lv_tabix TRANSPORTING leave_status leave_values.
ENDLOOP.
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_alv( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
DATA lo_value TYPE REF TO cl_salv_wd_config_table.
lo_value = lo_interfacecontroller->get_model(
* lo_interfacecontroller->set_data( r_node_data = lo_nd_value_set ).
**Get the context node information
lr_info = lo_nd_table->get_node_info( ).
lt_node_info = lr_info->get_attributes( ).
LOOP AT lt_node_info INTO ls_node_info.
ls_name-name = ls_node_info-name.
APPEND ls_name TO lt_name.
ENDLOOP.
*Get all the columns to make row editable
CALL METHOD lo_value->if_salv_wd_column_settings~get_columns
RECEIVING
value = lt_columns.
* Make the field dropdown
CALL METHOD lo_value->if_salv_wd_column_settings~get_column
EXPORTING
id = 'LEAVE_STATUS'
RECEIVING
value = lr_column.
* Create Object for dropdown
CREATE OBJECT lr_dropdown
EXPORTING
selected_key_fieldname = 'LEAVE_STATUS'.
CALL METHOD lr_dropdown->set_valueset_fieldname
EXPORTING
value = 'LEAVE_VALUES'.
CALL METHOD lr_dropdown->set_type
EXPORTING
value = if_salv_wd_c_uie_drdn_by_index=>type_key_convert_to_value.
CALL METHOD lr_column->set_cell_editor
EXPORTING
value = lr_dropdown.
*Set the table Editable
lo_value->if_salv_wd_table_settings~set_read_only( value = abap_false ).
lo_nd_table->bind_table( new_items = lt_table ).
Please suggest me where we are going wrong.
Thanks in advance...!!!
Best Regard's,
Shashi KanthHi Shashi,
Your code looks okay. Debug & check if everything goes fine and all the required list of values getting bound to node.
Is any code after this logic, which sets data to table ? if so, that logic is wiping out the drop down list values from context node.
Final check point:
Read the context node 'TABLE' and fetch records into internal table in WDDOMODIFYVIEW( ) method to make sure that, every row of your table contains the drop down list entries in "LEAVE_VALUES" attribute
Hope this helps you.
Regards,
Rama -
Check box and Drop down in ALV
Hi all ,
I am using ALV to display my output . I am narrating my question in a example ,
For eg : In my ALV in 1st column i am getting check boxes in all the rows but i want the check boxes oly in specific line no's and in the 3rd column i want to use dropdown list , so user can select some datas from the list , Depend upon the user selection in the drop down list i want to display the values in the 4th column .For every selection in a drop down list
4th column should refresh and give the values . So kindly provide some inputs to finish this task .
Note : I am using set table for 1st display and Function Module LVC_FIELDCATALOG_MERGE .Hi Saravanan.
FOLLOW THIS .
data : gd_layout TYPE lvc_s_layo, "slis_layout_alv,
gd_repid LIKE sy-repid.
TYPES: BEGIN OF TY_ITAB,,
LINE TYPE CHAR10,
CHECK TYPE CHAR1,
.....................................END OF TY_ITAB..
DATA: ITAB TYPE TABLE OF TY_ITAB,
WA TYPE TY_ITAB.
wa_fieldcat-fieldname = 'CHECK'.
wa_fieldcat-scrtext_m = 'CHECK BOX'.
wa_fieldcat-col_pos = 8.
wa_fieldcat-edit = 'X'.
wa_fieldcat-checkbox = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
loop at itab into wa.
if wa-line <> 3 or 6 or 7.
ls_stylerow-fieldname = 'CHECK' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
"set field to disabled
APPEND ls_stylerow TO wa-field_style.
MODIFY itAB FROM wa.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = gd_repid
i_callback_user_command = USER_COMMAND
is_layout_lvc = gd_layout " Use this Parameter
it_fieldcat_lvc = it_fieldcat
i_save = 'X'
TABLES
t_outtab = ITAB
EXCEPTIONS
program_error = 1
OTHERS = 2.
REGARDS
MURTHY. -
Drop Down in ALV Flashes and Disappears.
Hi All,
I have a strange issue going on. In an ALV (built on CL_GUI_ALV_GRID) I have got an editable field with a drop down option.Now lets say I have 10 rows in an ALV. I chose an entry from the drop down in one of the rows (this happens OK) and immediately after that I go on a click on drop down for any other row. What happens is that the drop down for the new row that I am in flashes and disappears. Now if I click for the drop down again the drop down appears. Basically whenever an entry is selected in one of the rows, drop down function immediately after that does not work. I have a feeling that it has something to do with the data _changed event but I am not sure how to handle that event.
I saw a similar thread [ALV Menu Flash|ALV HANDLE_DATA_CHANGED_FINISHED; but could not figure it out.
Any suggestions ?
Thanks
AnujHi,
Let us see the code and check it
Make the necessary changes at the fieldcatalog
clear ls_fcat.
ls_fcat-fieldname = 'COURSE'.
ls_fcat-col_pos = 5.
ls_fcat-coltext = 'Course'.
ls_fcat-outputlen = 10.
ls_fcat-DRDN_HNDL = 25.
ls_fcat-edit = 'X'.
APPEND ls_fcat to lt_fcat.
and in the class cl_gui_alv_grid we have one method SET_DROP_DOWN_TABLE
and it is having one parameter called iT_DROPDOWN of type LVC_T_DROP
generate the internal table and call the method set_drop_down_table
clear ls_drop.
ls_drop-handle = '25'.
ls_drop-value = 'ABAP'.
append ls_drop to lt_drop.
clear ls_drop.
ls_drop-handle = '25'.
ls_drop-value = 'CRM'.
append ls_drop to lt_drop.
clear ls_drop.
ls_drop-handle = '25'.
ls_drop-value = 'WEBDYNPRO'.
append ls_drop to lt_drop.
CALL METHOD o_grid->set_drop_down_table
EXPORTING
it_drop_down = lt_drop.
Thanks & Regards.
Raghunadh.K
Maybe you are looking for
-
I can't download the InDesign trial - Exit Code:6
Exit Code: 6 Please see specific errors below for troubleshooting. For example, ERROR: -------------------------------------- Summary -------------------------------------- - 0 fatal error(s), 2 error(s) ----------- Payload: Microsoft Visual C++ 2012
-
Embedding Fonts in Acrobat 9 Pro
I'm using the trial version of Acrobat to work on a project, and I'm having trouble embedding the fonts. I'm following the instructions provided in the online documentation, and I can select the text with the Touchup Text Tool, but that's where I get
-
Unit Tester: Bug in Export/Import of Suites
I was moving my Unit Test repository from one schema to another, so I first exported all of my suites and then imported them into a new repository. But, when I imported them into their new repository, all of the tests forgot what specific function/pr
-
Ipad 1 wifi connection problem
I cannot get my ipad 1 to join in my network. When I try to enter my wifi infoi get a message that says could not scan for wireless networks. I have tried turning it on and off. resetting the network and even restored it in itunes but nothing fixes t
-
I bought a time capsule. I've hooked it to the internet WAN to modem via ethernet. I've hooked it to my macbook pro via ethernet. I've hooked it to my printer via USB. I turned the time capsule on. I opened airport utility which made me make up