on 05-18-2009 12:34 PM
Hello,
how can I define the variable "id" at CASE check below. Which type is it String, float ??????
CASE id.
....
....
ENDCASE
It is undefined. I have found this
code somewhere else.
I want to display the number which a user is pressing in the textinput field. Textinputfield
The programmer of this code recommends also:
To map all the buttons to the same event handler when a numberic button is pressed it has to
append the value to the current displayed value. Also this is where I would implement the memory
and actual calculation functions.
Any idea what he ments.
method ONACTIONBUTTONPRESS .
DATA lo_nd_calculator TYPE REF TO if_wd_context_node.
DATA lo_el_calculator TYPE REF TO if_wd_context_element.
lo_nd_calculator = wd_context->get_child_node( name = wd_this->wdctx_calculator ).
lo_el_calculator = lo_nd_calculator->get_element( ).
data lr_value type ref to data.
lr_value = lo_el_calculator->get_attribute_ref( WD_COMP_CONTROLLER->value_help_listener->f4_attribute_info-name ).
FIELD-SYMBOLS <wa_numeric> type numeric.
ASSIGN lr_value->* to <wa_numeric>.
data l_string type c LENGTH 60.
CASE id.
WHEN 'BTN_7'.
move <wa_numeric> to l_string.
CONCATENATE l_string `7` into l_string. CONDENSE l_string NO-GAPS.
<wa_numeric> = l_string.
lo_el_calculator->set_attribute(
EXPORTING
value = <wa_numeric>
name = WD_COMP_CONTROLLER->value_help_listener->f4_attribute_info-name ).
ENDCASE.
endmethod.
Hi,
You have must have bounded an action with that button. then You can proceed in the following manner.
data lo_api_controller type ref to if_wd_view_controller.
data lo_action type ref to if_wd_action.
lo_api_controller = wd_this->wd_get_api( ).
lo_action = lo_api_controller->get_current_action( ).
if lo_action is bound.
case lo_action->name.
when 'ACTION_NAME'. " Pass the action name here and do Your coding inside When.
endcase.
endif.
I hope it helps.
Regards,
Rohit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Rohit
you mean for each button I need an action.
Originally I want to implement a simple calculator.
My problem is how to handle it properly so it calculates the result
an shows it in the textinpiutfield with the property 'read only'
Is it difficult to do that
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
It means You have assigned only one action to all your buttons and you find which button has been pressed and then if it is any particular button you want to perform whatever you have written in WHEN clause , then use code given by arjun in following way.
data: id type string.
id = wdevent->GET_string( 'ID' ).
CASE id.
WHEN 'BTN_7'.
move <wa_numeric> to l_string.
CONCATENATE l_string `7` into l_string. CONDENSE l_string NO-GAPS.
<wa_numeric> = l_string.
lo_el_calculator->set_attribute(
EXPORTING
value = <wa_numeric>
name = WD_COMP_CONTROLLER->value_help_listener->f4_attribute_info-name ).
ENDCASE.
Regards,
Rohit
Hi,
Suppose with button BTN_7 You have action BUTTONPRESS_7 then you can do your coding inside the when in following way.
WHEN 'BUTTONPRESS_7'.
move <wa_numeric> to l_string.
CONCATENATE l_string `7` into l_string. CONDENSE l_string NO-GAPS.
<wa_numeric> = l_string.
lo_el_calculator->set_attribute(
EXPORTING
value = <wa_numeric>
name = WD_COMP_CONTROLLER->value_help_listener->f4_attribute_info-name ).
I hope it helps.
Regards,
Rohit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Rohit,
you are saying Pass the action name here and do Your coding inside When.
What can stay there ?
if lo_action is bound.
case lo_action->name.
when 'BUTTONPRESS'.
?????????????
The content of ONACTIONBUTTONPRESS ??? or ?????
endcase.
endif.
I don t understand you clearly ?
Do you mean if My Action_name is BUTTONPRESS (in my case)
then the method ONACTIONBUTTONPRESS must be performed.
My Action_name is BUTTONPRESS (pls. see the code above)
Lets say when 'ACTION_NAME' is BUTTONPRESS
What should happen usually ?
Rohit is this beforeaction method the same as PBO Process before Output (classic Dynpro)
Regards
ertas
Edited by: Ilhan Ertas on May 18, 2009 2:36 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I think you are trying to get the ID if the UI element.
Use the code below:
data: val type string.
val = wdevent->GET_string( 'ID' ).
CASE val.
....
....
ENDCASE.
I hope it helps.
Regards
Arjun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
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.