The SAP BW planning engine can either have read access to the database or can use internal routines in the database for in-memory optimized planning using the ABAP Planning Applications Kit.
Planning Engine
Implementing Characteristic Relationships and Data Slices on the SAP HANA Database
Implementing Business Logic for Planning Function Types on the SAP HANA Database