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

Formule

Former Member
0 Likes
640

Hi !

Folks, I need create a formula which has to be render for one program ABAP, you all know if exist any module of function which do this?

Exemple: if field1 > field2 then 5.

Field1 = ‘3’ and field2 = ‘2’.

Thanks.

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
619

Can you please explain with more detail. I don't follow you.

REgards

Rich Heilman

Read only

0 Likes
619

Example of function module:

Input Fields

Input Code = "if field1 > field2 then 5"

Output Fields

Result

Tables

Field Name | Field Value

Field1 3

Field2 2

The function should understand the codes ( if, else, than, etc… )

Thanks.

Read only

0 Likes
619

If I understand the situation you would pass just the input code and you wish to output the table with possible values of field1 and field2 ?

Can you please confirm if that is your requirement ????

<b>If that is the case --->

input = 'If field1 > field2 then 5'.

U can try the below logic.

1. Find the string length of input.

2. Search for 'then' in the input string.

3. Calculate the difference between strlen(input) and sy-fdpos from the previous step.

4. Initialise lvalue using the positions from 3.

5. Similarly find the Operator.

6. Do lval times.

field1 = sy-index.

field2 = lval - sy-index.

if field11 > field2.

move field1, field2 to itab.

append itab.

endif.</b>

Message was edited by: Anurag Bankley

Message was edited by: Anurag Bankley

Read only

0 Likes
619

Yes !

Read only

0 Likes
619

Nevermind.

Regards,

Rich Heilman

Message was edited by: Rich Heilman