‎2016 Jul 25 7:05 AM
Hi Team,
I have a database table with formula as shown below(this table contains around 100 formulaes).My Input parameters to the program are Length,breadth and width and design.Based on the these input values how to do the caliculation dynamically. Please suggest solution.
Design Formulae
| Box | L+B |
| Rect | L*B |
| Square | W*B |
Thanks and Regards,
Uma
‎2016 Jul 25 7:37 AM
Dear Uma,
Please try the below link :
Program to evaluate formula in a string - ABAP Development - SCN Wiki
I think that it can help for your case.
Regards,
Yance
‎2016 Jul 25 7:37 AM
Dear Uma,
Please try the below link :
Program to evaluate formula in a string - ABAP Development - SCN Wiki
I think that it can help for your case.
Regards,
Yance
‎2016 Jul 25 7:38 AM
Hi Uma,
you can read your table with your input "design" and associate L, B, W to input parameters.
Finally you can check this tech to do the calculations
Program to evaluate formula in a string - ABAP Development - SCN Wiki
Exactly as Yance also said
‎2016 Aug 11 10:23 AM
Hi team,
The above metioned link is not working this kind of cases when if there are numeric values present in the formulae. Can any one suggest solution how to calicultate this kind of formulae.
| Material area =(W+D)x(2L+2W+2) |
| Material area =(W+D+2)x(2L+2W+2) |
| Material area =(0.5W+D)x(2L+2W+2) |
| Material area =(2W+D)x(2L+2W+2) |
Material area = (L+D)x(2L+2W+2) |
‎2016 Aug 11 11:39 AM
Not exactly: numbers are accepted, but not in front of variables without the '*' operator, i.e. it won't work for 2L, 0.5W and 2W. You should write it 2*L, 0.5*W and 2*W. You need to execute a transformation of the formula using regular expression for instance, before using the EVAL_FORMULA function module.
‎2016 Aug 11 12:46 PM
Hi Sandra,
Thanks for your input.When I am using this function Module in Webdynpro method I am getting error because of form and end form.Could you please suggest any other way to use in webdynpro.
Thanks and Regards,
Uma
‎2016 Aug 11 3:30 PM
Here, the issue is not about formula, it's just a simple ABAP problem. You cannot have a form in a class pool, so just define the callback form in a report or function group!