on 08-29-2008 12:13 PM
hi ,
i have a table with 4 columns and 5 rows..i have a custom search help attached to the 2nd column ..but wen i select the search help and click apply values ..the selected field gets binded only to the first row's 2nd column even if i had used it for the 2nd rows 2nd column..
is there any way to track the index of the selected cell of the column for which am using the search hep??
pls help
Anurupa.
In your custom search help how are you copying back the value? Can you please show us your code. It is difficult to comment without having any idea what logic you are using.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi thomas ,
my code is as follows....
DATA: l_node TYPE REF TO if_wd_context_node,
l_data_selected TYPE if_v_destpoint=>element_value_selected.
l_node = wd_context->get_child_node( 'VALUE_SELECTED' ).
l_node->get_static_attributes(
IMPORTING
static_attributes = l_data_selected ).
l_node = wd_context->get_child_node( 'ORG_LEVEL' ).
l_node->set_attribute( name = 'DEST_POINT_VAL'
value = l_data_selected-location ).
*******************
i know that this code will always fill the first row's first column...
thats y i want to know how to track the index of the cell...
Regards
Anurupa
Is this a freely programmed search help? If so why are you reading the source context directly? In a freely programmed value help you have access to the value help listener (IF_WD_VALUE_HELP_LISTENER). The listner object has an attribute called f4_context_element. This provides you with the exact context element that triggered the value help.
Yes Thomas it is a freely programmed search help.
and i have the F4_context_element as parameter for IF_WD_CONTEXT element..
Can you pls tell me the code of how to capture the value of this parameter so that when i write the prebios code i can put the value in the required place..
i have an event handlermethod (ON_VH_OPENED) whose event is VH_WINDOW_OPENED... in my application's view where i am using this search help as a component usage...
in this event handler i see the F4_context_element ...
i am new to WDA so it would extremely helpful if you could explain more explicitely with the code..
Thanks
Anurupa.
If you are creating a Freely Programmed Value Help you must include the interace IWD_VALUE_HELP in your component. This interface has one method (SET_VALUE_HELP_LISTENER) that you get inherited into your Component. During initialization, the value help framework will call this method automatically and pass in the listener object. This is your opportunity to store a reference to this listener in your component. I generally create an attribute of my component controller to store it. Here is a sample implementation of the SET_VALUE_HELP_LISTENER method:
This is also an excellent opportunity to read meta data about the source and the current value of the originating field as well. For example in my source I am testing to make sure the data type is time - otherwise I issue an error message. I also then read the current value.
METHOD set_value_help_listener .
wd_this->value_help_listener = listener.
****Check the data type of the source field - it must be a date data type.
IF wd_this->value_help_listener->f4_attribute_info-rtti->type_kind NE 'T'.
DATA: error TYPE string.
error = wd_assist->if_wd_component_assistance~get_text( key = 'E01' ).
* get message manager
DATA: l_current_controller TYPE REF TO if_wd_controller,
l_message_manager TYPE REF TO if_wd_message_manager.
l_current_controller ?= wd_this->wd_get_api( ).
l_message_manager = l_current_controller->get_message_manager( ).
* report message
l_message_manager->report_fatal_error_message(
message_text = error
).
me->set_ddlb_values( ).
wd_this->value_help_listener->close_window( ).
ENDIF.
DATA: item_time TYPE syuzeit.
wd_this->value_help_listener->f4_context_element->get_attribute(
EXPORTING
name = wd_this->value_help_listener->f4_attribute_info-name
IMPORTING
value = item_time
).
DATA:
node_internal_node TYPE REF TO if_wd_context_node,
elem_internal_node TYPE REF TO if_wd_context_element,
stru_internal_node TYPE if_componentcontroller=>element_internal_node .
* navigate from <CONTEXT> to <INTERNAL_NODE> via lead selection
node_internal_node = wd_context->get_child_node( name = if_componentcontroller=>wdctx_internal_node ).
* get element via lead selection
elem_internal_node = node_internal_node->get_element( ).
* get all declared attributes
elem_internal_node->get_static_attributes(
IMPORTING
static_attributes = stru_internal_node ).
stru_internal_node-time = item_time.
* set all declared attributes
elem_internal_node->set_static_attributes(
EXPORTING
static_attributes = stru_internal_node ).
me->set_ddlb_values( ).
ENDMETHOD.
As you can see you have full access to the source context (without having to do any context mapping into your value help component). You follow normal procedures for reading/writing to/from the source context. When you are ready to copy your selected values back from the value help - here is a sample of that:
method onactionselect .
* move selected value to special context attribute
wd_comp_controller->select( ).
* close popup
wd_comp_controller->value_help_listener->close_window( ).
endmethod.
method select .
data:
node_internal_node type ref to if_wd_context_node,
elem_internal_node type ref to if_wd_context_element,
stru_internal_node type if_componentcontroller=>element_internal_node .
* navigate from <CONTEXT> to <INTERNAL_NODE> via lead selection
node_internal_node = wd_context->get_child_node( name = if_componentcontroller=>wdctx_internal_node ).
* get element via lead selection
elem_internal_node = node_internal_node->get_element( ).
* get all declared attributes
elem_internal_node->get_static_attributes(
importing
static_attributes = stru_internal_node ).
data: l_time type syuzeit.
if stru_internal_node-hour_mode_24 = abap_true.
l_time+0(2) = stru_internal_node-hours.
else.
if stru_internal_node-am_pm = 'PM'.
if stru_internal_node-hours eq '12'.
l_time+0(2) = stru_internal_node-hours.
else.
l_time+0(2) = stru_internal_node-hours + 12.
endif.
else.
if stru_internal_node-hours eq '12'.
l_time+0(2) = '00'.
else.
l_time+0(2) = stru_internal_node-hours.
endif.
endif.
endif.
l_time+2(2) = stru_internal_node-minutes.
l_time+4(2) = stru_internal_node-seconds.
* set single attribute
wd_this->value_help_listener->f4_context_element->set_attribute(
exporting
name = wd_this->value_help_listener->f4_attribute_info-name
value = l_time
).
endmethod.
Hi thomas ,
this id my code in the method.. SET_VALUE_HELP_LISTNER
wd_this->value_help_listener = listener.
DATA: dist_id TYPE string.
wd_this->value_help_listener->f4_context_element->get_attribute(
EXPORTING
name = wd_this->value_help_listener->f4_attribute_info-name
IMPORTING
value = dist_id
).
DATA:
node_internal_node TYPE REF TO if_wd_context_node,
elem_internal_node TYPE REF TO if_wd_context_element,
stru_internal_node TYPE if_componentcontroller=>element_help_node .
navigate from <CONTEXT> to <INTERNAL_NODE> via lead selection
node_internal_node = wd_context->get_child_node( name = if_componentcontroller=>wdctx_help_node ).
get element via lead selection
elem_internal_node = node_internal_node->get_element( ).
get all declared attributes
elem_internal_node->get_static_attributes(
IMPORTING
static_attributes = stru_internal_node ).
stru_internal_node-dist_id = dist_id.
set all declared attributes
elem_internal_node->set_static_attributes(
EXPORTING
static_attributes = stru_internal_node ).
me->set_ddlb_values( ).
ENDMETHOD.
______________________________________________________________________
i think 'me' is not defined..
pls help
Anurupa
Hi Thomas,
I have the following two pieces of code:
method SET_VALUE_HELP_LISTENER .
wd_this->value_help_listener = listener.
******************************************
DATA: dist_id TYPE string.
wd_this->value_help_listener->f4_context_element->get_attribute(
EXPORTING
name = wd_this->value_help_listener->f4_attribute_info-name
IMPORTING
value = dist_id
).
DATA:
node_internal_node TYPE REF TO if_wd_context_node,
elem_internal_node TYPE REF TO if_wd_context_element,
stru_internal_node TYPE if_componentcontroller=>element_help_node .
navigate from <CONTEXT> to <INTERNAL_NODE> via lead selection
node_internal_node = wd_context->get_child_node( name = if_componentcontroller=>wdctx_help_node ).
get element via lead selection
elem_internal_node = node_internal_node->get_element( ).
get all declared attributes
elem_internal_node->get_static_attributes(
IMPORTING
static_attributes = stru_internal_node ).
stru_internal_node-dist_id = dist_id.
set all declared attributes
elem_internal_node->set_static_attributes(
EXPORTING
static_attributes = stru_internal_node ).
*****************
in the method of ONDATASELECT ....( action on select button in view .)
move selected value to special context attribute
wd_comp_controller->select( ).
close popup
wd_comp_controller->value_help_listener->close_window( ).
****************
in method SELECT of component controller:
data:
node_internal_node type ref to if_wd_context_node,
elem_internal_node type ref to if_wd_context_element,
stru_internal_node type if_componentcontroller=>element_help_node .
navigate from <CONTEXT> to <INTERNAL_NODE> via lead selection
node_internal_node = wd_context->get_child_node( name = if_componentcontroller=>wdctx_help_node ).
get element via lead selection
elem_internal_node = node_internal_node->get_element( ).
get all declared attributes
elem_internal_node->get_static_attributes(
importing
static_attributes = stru_internal_node ).
data: lv_dist type string.
set single attribute
wd_this->value_help_listener->f4_context_element->set_attribute(
exporting
name = wd_this->value_help_listener->f4_attribute_info-name
value = lv_dist
).
*****************************************************
when i execute the search help..it gives me a dump..Access via 'NULL' object reference not possible.
Can u pls help.
Anurupa
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.