Enterprise Resource
Planning Portal

 

Advertise | Founder BLOG

ERPGenie.COM ABAP Tips and Tricks Database

THE ultimate
ERP website

 

Forums | Vote for us |

Google    Other Search Options

Login

Login to view more content!!!





Lost Password?
No account yet? Register

Registered Access

Poll

What area of ABAP are you interested in?
 
Home arrow Tips and Tricks arrow General arrow Maths in ABAP
Maths in ABAP PDF Print E-mail
User Rating: / 2
PoorBest 
Written by Voice   
Wednesday, 02 September 2009
Being an Engineering student, I am bit inclined towards Mathematics. A few months ago when I wanted to write a program to find out prime numbers, I felt the need of ABAP command which can give me remainder (something like % in C). Finally I found it out and here are some compilations of such ABAP commands.


Finding the absolute value of a number: |a| -> ABS( a ).
Finding the lowest integer greater than a: CEIL( a ).
Finding the greatest integer less than a: FLOOR( a ).
For trigonometric operands, try ACOS, COS, etc
Finding the square root of a, a > 0: SQRT( a )
Finding the length of characters in the string: STRLEN( a )
Finding remainder a/b: a MOD b.

If you want to remove characters from any string which has both characters and numbers then there is an easy trick.

Suppose, you have an string like 12wer34op. Take a variable which is type NUMC and assign string to this variable and you will have only integers.

Data: v_string type char10,
v_num(10) type numc.

v_string = 12wer34op.
v_num = v_string.

Write: v_num.

Output: 1234.

Try it.

Related Items:

 
< Prev   Next >

Google Search

Statistics

Contribution Activity
Utilities: 41
Tips and Tricks: 362
Sample Code: 174
Total Contributions: 592

Member Activity
Members: 6795 since 2/1/2007!
New: 2 since yesterday!
Visitors: 2164065
We have 2 guests online

Newest Members

Welcome our newest members:

Google Ads