Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Calculate weighted return for a simple portfolio.
DATA: weights TYPE STANDARD TABLE OF f WITH DEFAULT KEY,
returns TYPE STANDARD TABLE OF f WITH DEFAULT KEY.
weights = VALUE #( ( 0.6 ) ( 0.4 ) ).
returns = VALUE #( ( 0.02 ) ( 0.03 ) ).
DATA(pReturn) = 0.
LOOP AT weights INTO DATA(w) INDEX DATA(i).
pReturn = pReturn + w * returns[ i ].
ENDLOOP.
WRITE: / 'Portfolio Return:', pReturn.SAP ABAP (Advanced Business Application Programming) is a high-level programming language developed by SAP for building enterprise applications on SAP systems, enabling customization, data processing, and business workflow automation.
Origin & Creator
Developed by SAP SE, Germany, originally in the 1980s for SAP R/2 and later SAP R/3 systems.
Industrial Note
Extensively used in enterprise software development, SAP module customization, and large-scale business process automation.