05-04-2009 2:47 PM
Hello ABAP experts,
I have to generate a file with a o lot of fields that are calculated from other fields. I have a list to detailed each rule.
For example : field 09 = field 05+ field 06+ field 07+ field 08
field 15 = (field 05+ field 06) * 0.15
...
I wanted to stored the description of each rule in a table in order not to hard code these rules in the program. As the rules are dirfferents, I thought that the best solution was to write directly the ABAP code for the calculation in an external table z_table like this :
Field Instruction
f_09 f_09 = f_05 + f_06 + f_07 + f_08
f_15 f_15 = (f_05 + f_06) * 0.15
...
I ask me if it is then possible to execute the content of the string z_table-instruction ?
I hope to be clear. don't hesitate to ask me question if I am unclear.
Many thanks in advance.
05-04-2009 3:14 PM
You might get there by generating a dynamic, temporary program using the ABAP statement GENERATE SUBROUTINE POOL (see online help).
You will have to add data declarations to make an executable subroutine out of these calculations, which will return the final result to the calling program.
Thomas
P.S. you should make sure that the table holding the ABAP code does not contain malicious statements like "DELETE FROM BSEG WHERE..." or similar
05-04-2009 3:14 PM
You might get there by generating a dynamic, temporary program using the ABAP statement GENERATE SUBROUTINE POOL (see online help).
You will have to add data declarations to make an executable subroutine out of these calculations, which will return the final result to the calling program.
Thomas
P.S. you should make sure that the table holding the ABAP code does not contain malicious statements like "DELETE FROM BSEG WHERE..." or similar
01-19-2010 4:35 PM
01-19-2010 4:41 PM
Could you please tell us the solution you used or the way you found to solve it?
Regards,
Matías.