ABAP Programs: Arithmetic Expressions and Mathematical Functions
REPORT ZSOURCE0707.
* Self-explanatory formulas
DATA: A TYPE P, B LIKE A, X LIKE A, Y LIKE A,
INCOME TYPE I, TAX TYPE P, NET_INCOME TYPE P,
ALPHA TYPE P.
Y = A * X + B.
NET_INCOME = INCOME * ( 1 - TAX ).
Y = X * COS( ALPHA ).
* Arithmetic expressions
DATA: BLACK_SWANS TYPE I,
WHITE_SWANS TYPE I.
DATA PERCENTAGE TYPE P DECIMALS 2.
PERCENTAGE = BLACK_SWANS * 100 / ( BLACK_SWANS + WHITE_SWANS ).
* Associative law
DATA: N1 TYPE P, N2 TYPE P, N3 TYPE P, N4 TYPE P, N5 TYPE P.
N5 = ( ( N1 - ( N2 / N3 ) ) * ( N4 + N1 ) / N5 ).
N5 = ( N1 - N2 / N3 ) * ( N4 + N1 ) / N5.
* More formulas including mathematical functions
DATA: W TYPE P, D TYPE I, N TYPE P, Q TYPE I, R TYPE P.
Y = X * COS( ALPHA ).
A = 1.
W = EXP( B * LOG( A ) ).
D = N DIV Q.
———————
ABAPer, mail: abap.community@gmail.com http://abaplearner.blogspot.com
If you like this post, you may as well like these too:
- Important ABAP Functions Download Here Contributed by Rajagopalan M ~~~ end of post ~~~ ———————ABAPer, mail: abap.community@gmail.com http://abaplearner.blogspot.com ...
- ABAP Programs: Special conversions REPORT ZSOURCE0709. * Converting type c to type nDATA: SCN(4) VALUE ‘12×4′, T1CN(2) TYPE N, T2CN(6) TYPE N.MOVE: SCN TO T1CN, SCN TO T2CN.* Converting type n to type...
- ABAP Source Code: Syntax of ABAP/4 Programs * Declaration of the program name REPORT ZSOURCE0301. * Displaying the words 'Customer list' on the screen WRITE / 'Customer list'. * Using an addition of the write command...
- ABAP Programs: Converting number fields * Using numeric texts and packed numbersDATA: NO_EMPLOYEES(4) TYPE N, NO_ROOMS TYPE P, EMPLOYEES_PER_ROOM TYPE P DECIMALS 2.EMPLOYEES_PER_ROOM = NO_EMPLOYEES / NO_ROOMS. * Rounding with integers and packed numbersDATA:...
- ABAP Programs: Classifying parameters REPORT ZSOURCE1005. * Data declarations for later useDATA: A1 TYPE P VALUE 2, A2 TYPE P VALUE 4, A3 TYPE P VALUE 8.* Calling a form with different parameter...

















Leave a Reply