on 04-29-2009 7:02 AM
Hi Community,
I need the possibility of a calculator while the user works on the site. How can I implement a calculator within a WD ?
Did you ever have such a similar req?
Thx in advance for your efforts
Reagrds
ilhan
the question is solved for me, because there is no solution existing inside wd to implement a
calculator.
I'd like learn Flash Iceland but unfortunately I am very bussy.
The colleague gets the 10 points because he responded briefly.
Regards
ertas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>
> the question is solved for me, because there is no solution existing inside wd to implement a
> calculator.
>
>
> I'd like learn Flash Iceland but unfortunately I am very bussy.
> The colleague gets the 10 points because he responded briefly.
>
> Regards
> ertas
Perhaps you gave up to easily. You say there is no solution within WD to implement a calculator, yet no one said that. We said that there was a solution in classic dynpro. It is used in the travel and expense management transaction. Here is a screen shot:
http://www.flickr.com/photos/tjung/3488066649/
The fact that it exists in classic dynpro seemed to me like you should be able to replicate the same thing in Web Dypnro ABAP. I took a few minutes and was able to recreate the funtionality as a freely programmed value help in WDA:
http://www.flickr.com/photos/tjung/3488066657/in/photostream/
I used a freely programmed value help. You can read more on that topic in general here:
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/9ef8cc9b5e3c5ce10000000a421937/frameset.htm
There are also some samples in the sytem you can study.
Your component that will implement the value help gets an interface and method that gets called by the value help framework on initialization. I wanted to be able to support a variety of source data types so I use this method to inspect the data type of the source attribute and to generate a local attribute matching this. I've got a dummy check for data type as a place holder right now, but it needs to be expanded:
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 cl_abap_typedescr=>typekind_numeric.
ENDIF.
DATA lo_nd_calculator TYPE REF TO if_wd_context_node.
DATA lo_el_calculator TYPE REF TO if_wd_context_element.
data dyn_node_info type ref to if_wd_context_node_info.
* navigate from <CONTEXT> to <CALCULATOR> via lead selection
lo_nd_calculator = wd_context->get_child_node( name = wd_this->wdctx_calculator ).
dyn_node_info = lo_nd_calculator->get_node_info( ).
dyn_node_info->add_attribute( wd_this->value_help_listener->f4_attribute_info ).
ENDMETHOD.
You can then layout the user interface in the view pretty much like normal - expect for the inputField. That I had to dynamically generate because the context attribute was dynamic. You can do that in the WDDOMODIFYVIEW of the view:
method WDDOMODIFYVIEW .
data lo_tc type ref to cl_wd_transparent_container.
data lo_inputfield type ref to cl_wd_input_field.
if first_time = abap_true.
lo_tc ?= view->get_element( 'TC_INPUTFIELD' ).
data l_binding_string type string.
CONCATENATE `CALCULATOR.` WD_COMP_CONTROLLER->value_help_listener->f4_attribute_info-name
into l_binding_string.
lo_inputfield = cl_wd_input_field=>new_input_field(
bind_value = l_binding_string
enabled = abap_true
id = 'VH_INPUT'
* length = '20'
read_only = abap_true
view = view
* visible = E_VISIBLE-VISIBLE
* width = width
).
data flow type ref to CL_WD_FLOW_DATA.
flow = CL_WD_FLOW_DATA=>new_flow_data(
* cell_design = E_CELL_DESIGN-PADLESS " CELL_DESIGN
element = lo_inputfield
id = 'FLOW_ID'
* v_gutter = E_V_GUTTER-NONE " V_GUTTER
).
lo_inputfield->set_layout_data( flow ).
lo_tc->add_child( lo_inputfield ).
endif.
endmethod.
I 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 you would implement the memory and actual calculation functions. Since I was just prototyping I only implemented one button, but that is enough to prove how it works. Now it just needs some time to expand this logic to support all the buttons:
METHOD onactiononbuttonpress .
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.
I tested this with integers, but it might need some additional logic on the concatenation if it supports Float (exponent notation).
Hi Thomas,
because of this line the program is dumping
CONCATENATE `CALCULATOR.` WD_COMP_CONTROLLER->value_help_listener->f4_attribute_info-name
Furthermore
in your example with the calculator you have the action method
METHOD onactiononbuttonpress
Is it necessary to insert a button in order to pass him this method. If not
how can I assign this method to any button or something like that
Regards
ertas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Its dumping on the CONCATENATE itself? What exactly is the message of the dump. I don't really see anything there that should cause a dump.
>Is it necessary to insert a button in order to pass him this method. If not
how can I assign this method to any button or something like that
When you define a button in the layout, you have the onAction property. You can choose an existing event handler method or create a new one to assign to the onAction event property.
Hello,
If someone enters a number then klicks the 'plus' button for addition, enters a number again and clicks
the plus button again he gets the result of this addition.
Now it must be possible contining this additon with entering a new number
to get the new result by klicking on the addition button finally.
This works in my coding not properly as well.
Can someone give a hint me a hint how the implement this requirement.
method onactionpress
* * * * ADDITION * * * * * * * * * * * * * * * * * * * * * * * * *
WHEN 'BTN_PLUS'.
WD_COMP_CONTROLLER->OPERATION = 'ADDIT'.
IF WD_COMP_CONTROLLER->merker EQ 'X' AND NOT WD_COMP_CONTROLLER->firstNr IS INITIAL.
<wa_numeric> = WD_COMP_CONTROLLER->erg + <wa_numeric>.
lo_el_calculator->set_attribute(
EXPORTING
value = <wa_numeric>
name = WD_COMP_CONTROLLER->value_help_listener->f4_attribute_info-name ).
WD_COMP_CONTROLLER->COMP = 'X'.
clear WD_COMP_CONTROLLER->firstNr.
ENDIF.
IF WD_COMP_CONTROLLER->firstNr IS INITIAL.
WD_COMP_CONTROLLER->firstNr = <wa_numeric>.
ENDIF.
IF WD_COMP_CONTROLLER->merker IS INITIAL.
WD_COMP_CONTROLLER->merker = 'X'.
CLEAR l_string .
CLEAR <wa_numeric>.
lo_el_calculator->set_attribute(
EXPORTING
value = <wa_numeric>
name = WD_COMP_CONTROLLER->value_help_listener->f4_attribute_info-name ).
ENDIF.
endmethod.
hi Thomas,
how must the method set_value_help_listener be implemented and where.
When do you call this method ?
I would be glad if you could help me in this matter.
Regards
ertas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
Refer this :
The SET_VALUE_HELP_LISTENER method for the interface controller of IWD_VALUE_HELP can be called only by Web Dynpro Framework. The framework uses this method to pass a callback interface to the input help component. The input help component can use this interface to tell the framework that it is to be closed, for example, if data has been selected, if Cancel has been pressed, or if an error has occurred. This interface contains the two attributes F4_CONTEXT_ELEMENT and F4_ATTRIBUTE_INFO as well.
Above extract is taken from SAP Online help :
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/9ef8cc9b5e3c5ce10000000a421937/frameset.htm
I would suggest you to implement Freely programme Value help. That would help you in understanding more clearly the code given by Thomas.
Refer Standard component : Demp_value_help for that.
Thanx.
Thomas thank you many times. Indeed I gave up easly.
how did you defined listener ?
METHOD set_value_help_listener .
wd_this->value_help_listener = listener.
I will spent some time on it before saying anythhing. You will hear very soon a feedback
after having implemented the calulator (hopefully)
Regards
ertas ilhan
Edited by: Ilhan Ertas on Apr 30, 2009 5:01 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try to implement standard value help for OVS.
When you use the standard OVS you will get the value help listeners.
Please check out the example - DEMO_VALUE_HELP
Check out this examples -
/people/shruti.rathour/blog/2008/05/05/ovs-help-in-web-dynpro-abap
http://help.sap.com/saphelp_nw04s/helpdata/en/47/9ef8c99b5e3c5ce10000000a421937/frameset.htm
Regards,
Lekha.
>
> Hi,
>
> Try to implement standard value help for OVS.
> When you use the standard OVS you will get the value help listeners.
>
>
> Please check out the example - DEMO_VALUE_HELP
> Check out this examples -
> /people/shruti.rathour/blog/2008/05/05/ovs-help-in-web-dynpro-abap
>
> http://help.sap.com/saphelp_nw04s/helpdata/en/47/9ef8c99b5e3c5ce10000000a421937/frameset.htm
>
>
>
>
> Regards,
> Lekha.
I disagree with your assesment that OVS applies here. With the design required to create a calculator and the custom logic needed, OVS simply won't meet those needs. I stand by my recommendation that Freely Programmed Value Help is necessarily in this case.
Hi Thomas,
I have searched and couldn't find the mentioned calculator value help .
Where can I find it ? Please help.
Regards
ertas ilhan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is a calculator value help implemented in classic dynpro. It doesn't seem like it would be that difficult to replicate such a design in Web Dynpro. The drawback would be that you would need a server round trip every time a button is pressed. This wound't make for the most responsive calculator UI. For a more client side calculator, I would agree with the earlier suggestion of using FlashIslands if you are on NetWeaver 7.0 EnhP 1.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
has somebody never implemented yet such a req
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
This is a peculiar requirement. usually the WDA is not ment for this type of requirement.
It's mainly used for implmenting the business logic for large companies.
You can still achieve this.......using table control with each cell as the Button, but the layout should be well designed.
You can stil acheive this active Xcontrol for this using FlashIslands UI element.
Regards,
Lekha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.