Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Dynamic Formula Selection

Former Member
0 Likes
2,094

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

BoxL+B
RectL*B
SquareW*B

Thanks and Regards,

Uma

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,472

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

6 REPLIES 6
Read only

Former Member
0 Likes
1,473

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

Read only

SimoneMilesi
Active Contributor
0 Likes
1,472

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

Read only

Former Member
0 Likes
1,472

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)

Read only

0 Likes
1,472

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.

Read only

0 Likes
1,472

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

Read only

0 Likes
1,472

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!