on 02-10-2009 3:50 PM
Hi Experts,
I am new to WebDynpro ABAP.
I want to assign a search help to one of the UI elements in WebDynpro ABAP component.
The search help is attached as a value table in a domain LAND1.
Now while creating an attribute i am creating it from a data element which is attached to this domain.
Still i can not see the value help being shown.
May be i am missing something.
Can you please help me to find out what am i missing?
Regards,
Ashish Shah
Go to The WebDynpro Components Context , Select the Attribute for which you have attached the Search. Then select from the properties
'Input Help Mode' - Automatic.
once you do this 'Determined Input Help' - should start showing up.
Greetings
Prashant
P.S. Points Welcome.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prashant,
I am sorry i forgot to add this name of the UI element - Dropdownby Key UI element.
I have already kept the "input help mode"property as "Automatic"
and i can also see "Determined input help".
when i bind this attribute to Input UI element , i can see Input help,
however i want to bind this help to Dropdown by key UI element.
How can i show these values in dropdownby key ui element.?
Regards,
Ashish Shah
Hi Ashish,
For getting a search help for the drop down by key UI element, here i am mentioning the logic using the flight demo.
1.Add attribute PLANETYPE to the context of the component controller.
Locate the Component Controller node in the project structure that is located immediately under the component. Double click on Component Controller to open the Custom Controller editor.
- Add attribute PLANETYPE to context node FLIGHTINFO
Hint: Select Create Using Wizard -> Attributes form Components of Structure from context menu of node FLIGHTINFO.
2.Navigate to the Context tab of view controller Iof your view. Choose Update Mapping from the context menu of node FLIGHTINFO to add the attribute PLANETYPE.
3.Add Label and DropDownByKey for PLANETYPE to the layout of ur view.
Go to tab Layout and add a label named PLANETYPE_LABEL_1 and a DropDownByKey named PLANETYPE_DROPDOWN_1 to group GROUP_1. The two new elements should be placed between the input field for the Date and the button. Bind the DropDownByKey to the context attribute PLANETYPE.
4..Adjust component controller method FLIGHTTAB_FILL
Navigate to the Methods tab of the component controller and double-click on the method FLIGHTTAB_FILL to open the editor.
Adjust the method:
- Get also the context value for PLANETYPE
- Use PLANETYPE also in the where clause of the select statement
METHOD flighttab_fill .
DATA:
cond(72) TYPE c,
itab_where LIKE TABLE OF cond,
context_node TYPE REF TO if_wd_context_node,
elem_flightinfo TYPE REF TO if_wd_context_element,
stru_flightinfo TYPE if_componentcontroller=>element_flightinfo ,
item_carrid LIKE stru_flightinfo-carrid,
item_connid LIKE stru_flightinfo-connid,
item_fldate like stru_flightinfo-fldate,
item_planetype like stru_flightinfo-fldate,
itab_flighttab TYPE if_componentcontroller=>elements_flighttab.
navigate to <FLIGHTINFO>
context_node = wd_context->get_child_node( name = `FLIGHTINFO` ).
get element at lead selection
elem_flightinfo = context_node->get_element( ).
get connid
elem_flightinfo->get_attribute(
EXPORTING
name = `CARRID`
IMPORTING
value = item_carrid ).
get carrid
elem_flightinfo->get_attribute(
EXPORTING
name = `CONNID`
IMPORTING
value = item_connid ).
get fldate
elem_flightinfo->get_attribute(
EXPORTING
name = `FLDATE`
IMPORTING
value = item_fldate ).
get planetype
elem_flightinfo->get_attribute(
EXPORTING
name = `PLANETYPE`
IMPORTING
value = item_planetype ).
create where condition
IF NOT item_carrid EQ ''.
CONCATENATE 'CARRID = ''' item_carrid '''' INTO cond.
APPEND cond TO itab_where.
ENDIF.
IF NOT item_connid EQ '0000'.
CONCATENATE 'CONNID = ''' item_connid '''' INTO cond.
IF item_carrid NE ''.
CONCATENATE 'AND' cond INTO cond separated by space.
ENDIF.
APPEND cond TO itab_where.
ENDIF.
IF NOT item_fldate is initial.
CONCATENATE 'FLDATE = ''' item_fldate '''' INTO cond.
IF not itab_where is initial.
CONCATENATE 'AND' cond INTO cond separated by space.
ENDIF.
APPEND cond TO itab_where.
ENDIF.
IF NOT item_planetype eq ''.
CONCATENATE 'PLANETYPE = ''' item_planetype '''' INTO cond.
IF not itab_where is initial.
CONCATENATE 'AND' cond INTO cond separated by space.
ENDIF.
APPEND cond TO itab_where.
ENDIF.
read data
IF itab_where IS NOT INITIAL.
SELECT * FROM sflight
INTO CORRESPONDING FIELDS OF TABLE itab_flighttab
WHERE (itab_where).
ELSE.
SELECT * FROM sflight
INTO CORRESPONDING FIELDS OF TABLE itab_flighttab.
ENDIF.
navigate to <FLIGHTTAB>
context_node = wd_context->get_child_node( name = `FLIGHTTAB` ).
Bind table to context node <FLIGHTTAB>
CALL METHOD context_node->bind_table
EXPORTING
new_items = itab_flighttab.
ENDMETHOD.
5.Navigate to the Methods tab of the ur view and create a new method with the name VS_PLANETYPE. Double-click on the name of the newly created method to navigate in the editor.
Add coding for:
- Get nodeinfo for node FLIGHTINFO
- Build the value set table. Create the following entries:
Key Value
747-400 747-400
A310-300 A310-300
A319 A319
DC-10-10 DC-10-10
- Set the values to context attribute PLANETYPE of node FLIGHTINFO
method VS_PLANETYPE .
data:
lr_node_flightinfo type ref to if_wd_context_node,
lr_nodeinfo_flightinfo type ref to if_wd_context_node_info,
lt_value_set type wdy_key_value_table,
ls_value_set type wdy_key_value.
get nodeinfo of node flightinfo
lr_node_flightinfo = wd_context->get_child_node( name = `FLIGHTINFO` ).
lr_nodeinfo_flightinfo = lr_node_flightinfo->get_node_info( ).
fill values into value set table
ls_value_set-key = '747-400'.
ls_value_set-value = '747-400'.
append ls_value_set to lt_value_set.
ls_value_set-key = 'A310-300'.
ls_value_set-value = 'A310-300'.
append ls_value_set to lt_value_set.
ls_value_set-key = 'A319'.
ls_value_set-value = 'A319'.
append ls_value_set to lt_value_set.
ls_value_set-key = 'DC-10-10'.
ls_value_set-value = 'DC-10-10'.
append ls_value_set to lt_value_set.
set values to context attribute
lr_nodeinfo_flightinfo->set_attribute_value_set( name = 'PLANETYPE' value_set = lt_value_set ).
endmethod.
6.Invoke method VS_PLANETYPE in method WODOINIT in ur view.
Hint: Use Web Dynpro Code Wizard.
method WDDOINIT .
DATA:
node_flightinfo TYPE REF TO if_wd_context_node,
elem_flightinfo TYPE REF TO if_wd_context_element,
stru_flightinfo TYPE if_input_view=>element_flightinfo,
item_carrid LIKE stru_flightinfo-carrid.
navigate from <CONTEXT> to <FLIGHTINFO> via lead selection
node_flightinfo = wd_context->get_child_node( name = `FLIGHTINFO` ).
get element via lead selection
elem_flightinfo = node_flightinfo->get_element( ).
set single attribute
elem_flightinfo->set_attribute(
EXPORTING
name = `CARRID`
value = 'AA' ).
Create Value Selector for PLANETYPE
wd_this->vs_planetype( ).
endmethod.
Regards
Manoj Kumar
If you want values in Dropdownby Key UI element. Then simple chose the Dropdownby Key UI element
and for the attribute thats bound to this DropDownByKey
perform the below steps as stated
Go to The WebDynpro Components Context , Select the Attribute for which you have attached the Search. Then select from the properties
'Input Help Mode' - Automatic.
once you do this 'Determined Input Help' - should start showing up.
Greetings
Prashant
Hi Prashant,
The search help is attached as a value table in a domain LAND1.
I already tried binding DropDown by keyto the attribute with Data element LAND1.
'Input Help Mode' is Automatic.
and values start showing up in 'Determined Input Help'.
However since the value is determined from Value Table in Domain, values do not show up in Dropdownby key.
Any suggestions?
Regards,
Ashish Shah
Hi Manoj Kumar,
Isn't there a direct way of doing it?
I remember in WebDynpro Java if i attach an attribute to Input UI element and to Dropdown, in both it shows the same value help.
However here in WDA when i assign a attribute to Input UI Element it shows value help but not when i bind same attribute to drop down by key.
One more thing that i noticed is Value Table is assigned to LAND1 Domain.
and this is the source of Value help data.
U can also check LAND1 Domain in your system and check whether you are able to see value help for LAND1 attribute binded to DropDown by key.
Regards,
Ashish Shah
Hi Ashish,
In this case you would require to code. this coding should execute inside the WDDOINIT of the view that has this DropDownbyKey( DDK) element.
Get the values from your VALUE TABLE into a table of TYPE WDY_KEY_VALUE_LIST. Which can be binded to the Attribute thats bound to your DDK.
i would write method in my assistance class example get countries code below:
method get_countries.
" RETURNING PARAMETER rt_countries TYPE WDY_KEY_VALUE_LIST.
select distinct land1 as 'KEY' landx as 'VALUE' into table rt_countries from t005t where spras = sy-langu order by landx ascending.
endmethod.
then call this in the wddoinit of the view as
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.
lt_valueset = wd_assist->get_countries( ).
lr_node = wd_context->get_child_node( name = if_componentcontroller=>wdctx_shipaddress ).
lr_nodeinfo = lr_node->get_node_info( ).
lr_nodeinfo->set_attribute_value_set(
exporting
name = 'COUNTRY'
value_set = lt_valueset ).
so effectively i have DDK for Countries. You can take similar approach & put values for your DDK and it WILL work.
Greetings
Prashant
Hi Ashish,
For the domain LAND1, if there are values in the values range tab then those values can be available directly for the drop down by idx ui element , but not for the drop down by key.
Since for domain LAND1 there are no such values in the value range , so nothing can be populated for both the UI element drop down by idx as well.
Since there is a value table T005 is attached to the domain. so within table for field LAND1 there is a search help attached to it called - H_T005_LAND.
so if we use the inputfield UI element and bind the value property of the attributes of the context node - land1,then even for inputfield no search help will be populated if we take the type - land1 for that attribute .
Spo first of all we have to change the type of the attribute to OF TYPE - T005-LAND1, then automatically the search help will be populated for the inputfield.
But in case of Dropdown by key there is no direct way. So for that we have to write the logic.
So in the WDDOINIT METHOD of the view, First of all
we have to select the record from the table T005 into an internal table. the internal table should be of type
WDY_KEY_VALUE_LIST and after that just bind the table to the node attribute as mention by prashant.
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.
lt_valueset = wd_assist->get_countries( ).
lr_node = wd_context->get_child_node( name = if_componentcontroller=>wdctx_shipaddress ).
lr_nodeinfo = lr_node->get_node_info( ).
lr_nodeinfo->set_attribute_value_set(
exporting
name = 'COUNTRY'
value_set = lt_valueset ).
Regards
Manoj Kumar
Hi,
make the input help mode of that attribute to Dictionary search help.
it will show the value from that domain.
thanks,
Subhasis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.