SAP Planning - Flexible Data Slices in SAP BPC With ABAP and SQL Script
SAP Planning - Flexible Data Slices in SAP BPC With ABAP and SQL Script
SAP Planning - Flexible Data Slices in SAP BPC With ABAP and SQL Script
En
SAP PLANNING - FLEXIBLE DATA SLICES IN SAP BPC WITH ABAP AND SQL SCRIPT
In our example, we want to lock a company code for planning. In doing so, the users have
the option of entering data in DSO using a query. For example, a 1 or 0 is entered for the
company code.
https://www.nextlytics.com/blog/sap-planning-flexible-data-slices-in-sap-bpc-with-abap-and-sql-script 1/16
9/24/23, 11:45 AM SAP planning - flexible data slices in SAP BPC with ABAP and SQL script
This information is read out via the customer exit. If there is a company code with the En
flag 1, this company code is considered as locked. In our example, company code 1000
is considered as locked.
https://www.nextlytics.com/blog/sap-planning-flexible-data-slices-in-sap-bpc-with-abap-and-sql-script 2/16
9/24/23, 11:45 AM SAP planning - flexible data slices in SAP BPC with ABAP and SQL script
You can use the existing example class CL_RSPLS_DS_EXIT_BASE as a template. This
class contains the interfaces and predefined methods required for the ABAP En
implementation.
The sample class is located in the package RSPLS. To make the class easier to find, you
can add the package to favorites.
https://www.nextlytics.com/blog/sap-planning-flexible-data-slices-in-sap-bpc-with-abap-and-sql-script 3/16
9/24/23, 11:45 AM SAP planning - flexible data slices in SAP BPC with ABAP and SQL script
Select the class CL_RSPLS_DS_EXIT_BASE and right-click. Then select Duplicate from
the context menu.
En
Then determine the package and the name of the new class.
In the new class, select the method IS_PROTECTED. This method checks whether a data
record is protected against changes.
https://www.nextlytics.com/blog/sap-planning-flexible-data-slices-in-sap-bpc-with-abap-and-sql-script 4/16
9/24/23, 11:45 AM SAP planning - flexible data slices in SAP BPC with ABAP and SQL script
In our example we use a buffer and an additional method to read the DSO. If an entry with En
the flag 1 is found for a company code, it is considered as locked.
IF sy-subrc NE 0.
* This record is not checked before
* Now we check if the record is locked
CALL METHOD me->get_locked_entries
EXPORTING
i_s_data = i_s_data
IMPORTING
e_s_mesg = o_r_s_mesg->*
e_noinput = o_r_protected->*.
ENDMETHOD.
METHODS get_locked_entries
IMPORTING
!i_s_data TYPE any
EXPORTING
!e_s_mesg TYPE if_rspls_cr_types=>tn_s_mesg En
!e_noinput TYPE rs_bool .
CHECK sy-subrc EQ 0.
CLEAR lv_compcode.
SELECT SINGLE comp_code FROM /bic/azd011lock7
INTO lv_compcode
WHERE comp_code = <fs_compcode>
AND /bic/zdflag = 1.
ENDMETHOD.
https://www.nextlytics.com/blog/sap-planning-flexible-data-slices-in-sap-bpc-with-abap-and-sql-script 6/16
9/24/23, 11:45 AM SAP planning - flexible data slices in SAP BPC with ABAP and SQL script
En
En
https://www.nextlytics.com/blog/sap-planning-flexible-data-slices-in-sap-bpc-with-abap-and-sql-script 8/16
9/24/23, 11:45 AM SAP planning - flexible data slices in SAP BPC with ABAP and SQL script
must first be created in the ABAP Dictionary. If this parameter is not set, no
additional information is sent from the application server.
E_HAS_SQL_MESG - Boolean operator, whether the SQL script procedure outputs
messages.
Then switch to the Sample Characteristic Relationship/Data tab. Then select the
InfoProvider and the number of the relevant data slice. Also select theWith coding hints
option.
https://www.nextlytics.com/blog/sap-planning-flexible-data-slices-in-sap-bpc-with-abap-and-sql-script 9/16
9/24/23, 11:45 AM SAP planning - flexible data slices in SAP BPC with ABAP and SQL script
En
When you then click on Execute, the system generates a proposal. You can use the
generated source code directly at the relevant places in your class. The fields marked in
yellow are for navigation purposes. They allow you to jump directly to the respective
InfoProvider, class or InfoObject.
Follow the generated comments and insert the code suggestions into your ABAP class.
types:
begin of tn_s_data,
https://www.nextlytics.com/blog/sap-planning-flexible-data-slices-in-sap-bpc-with-abap-and-sql-script 10/16
9/24/23, 11:45 AM SAP planning - flexible data slices in SAP BPC with ABAP and SQL script
METHODS AMDP_GET_PROTECTED_RECORD
En
IMPORTING
VALUE(i_t_data) TYPE tn_t_data
EXPORTING
VALUE(e_t_data) TYPE tn_t_data.
METHOD if_rspls_ds_exit_hdb~get_sqlscript_info.
e_procedure_name_protected = 'ZDRCL_RSPLS_DS_EXIT_BASE=>AMDP_GET_PROTE
ENDMETHOD.
Then we define the logic of the AMDP method in SQL Script. Thereby we read out the
checked company codes from the ADSO. If an entry with the flag 1 is found, these
company codes are considered as locked.
ENDMETHOD.
To output messages from your SQL script logic you need to make the following
adjustments. In DEFINITION part we define the table for the messages and extend the
AMDP method:
En
TYPES:
BEGIN OF tn_s_mesg,
msgid TYPE syst-msgid,
msgno TYPE syst-msgno,
msgty TYPE syst-msgty,
msgv1 TYPE syst-msgv1,
msgv2 TYPE syst-msgv2,
msgv3 TYPE syst-msgv3,
msgv4 TYPE syst-msgv4,
END OF tn_s_mesg,
tn_t_mesg TYPE STANDARD TABLE OF tn_s_mesg
WITH NON-UNIQUE DEFAULT KEY.
METHODS amdp_get_protected_record
IMPORTING
VALUE(i_t_data) TYPE tn_t_data
EXPORTING
VALUE(e_t_data) TYPE tn_t_data
VALUE(e t mesg) TYPE tn t mesg.
In the IMPLEMENTATION part we specify that the method outputs messages.
METHOD if_rspls_ds_exit_hdb~get_sqlscript_info.
e_procedure_name_protected = 'ZDRCL_RSPLS_DS_EXIT_BASE=>AMDP_GET_PROTE
e_has_sql_mesg = abap_true. "Flag: SQLscript returns messages
ENDMETHOD.
https://www.nextlytics.com/blog/sap-planning-flexible-data-slices-in-sap-bpc-with-abap-and-sql-script 12/16
9/24/23, 11:45 AM SAP planning - flexible data slices in SAP BPC with ABAP and SQL script
In the ADMP method itself, we fill the message table. Please note that all four variables
must be passed, even if they do not have any values.
e_t_mesg = select
'ZDR' as MSGID,
'000' as MSGNO,
'W' as MSGTY,
COMP_CODE as MSGV1,
'' as MSGV2,
'' as MSGV3
If you use a planning sequence, you can test the ABAP and SQL implementations
separately. If you start the planning function with the Execute Step button, the SQL
implementation is used. If, on the other hand, you use the Execute Step with Trace
button, the ABAP implementation is executed.
https://www.nextlytics.com/blog/sap-planning-flexible-data-slices-in-sap-bpc-with-abap-and-sql-script 13/16
9/24/23, 11:45 AM SAP planning - flexible data slices in SAP BPC with ABAP and SQL script
En
Summary
Now you know how to create data slices quite flexibly using ABAP or SQL. This
procedure can be extended at will by the programming freedom you have in both worlds.
For example, you could easily and quickly activate the lock only on certain days.
Furthermore, thanks to the implementation with SQL Script you have the full potential of
the HANA database.
Do you need help defining your planning strategy or are you looking for experienced
developers with SQL Script know how? Please do not hesitate to contact us.
Topics: SAP HANA, SAP BW/4HANA, SAP Planning, SAP HANA SQL
as SAP BSP, SAP BW-IP, SAP BPC, SAP BW Embedded BPC. He has gained experience
primarily as a developer, architect, project manager and team leader. He enjoys playing
basketball and barbecue whenever possible.
Blog - NextLytics AG En
Welcome to our blog. In this section we regularly report on news and background
information on topics such as SAP Business Intelligence (BI), SAP Dashboarding with
Lumira Designer or SAP Analytics Cloud, Machine Learning with SAP BW, Data Science
and Planning with SAP Business Planning and Consolidation (BPC), SAP Integrated
Planning (IP) and SAC Planning and much more.
Last name
Email*
Nextlytics AG is committed to protecting and respecting your privacy. We use your personal information only to provide the products
and services you have requested and for further communication. From time to time, we may want to inform you about our products
and services and other content that may be of interest to you.
I agree that my contact data given here will be stored and processed by Nextlytics AG for the purpose of further communication.*
You want to get the latest news monthly? Subscribe to our newsletter.*
You can unsubscribe from these notifications at any time via a link in our emails. Further information on our data protection
procedure and how we protect and respect your privacy can be found in our Privacy Statement.
By clicking "Submit", you consent to the storage and processing of your personal information.
SUBMIT
https://www.nextlytics.com/blog/sap-planning-flexible-data-slices-in-sap-bpc-with-abap-and-sql-script 15/16
9/24/23, 11:45 AM SAP planning - flexible data slices in SAP BPC with ABAP and SQL script
Related Blogs
» September 21, 2023 : SAP Datasphere: SQL Or Graphical Views? Making An Educated Decision
» August 17, 2023 : Integrated Comment Functions In SAP Analytics Cloud And BW4/HANA
» July 20, 2023 : Leveraging Apache Airflow For SAP BW/4HANA Change Data Capture
En
» June 22, 2023 : SAP Analytics Cloud Calendar Administrator
More...
Recent Posts
» SAP Datasphere: SQL Or Graphical Views? Making An Educated Decision
» SAC Translation: Multi Language Reports In SAP Analytics Cloud
» SAP BW: Identification Of Request Numbers In ADSOs
» Integrated Comment Functions In SAP Analytics Cloud And BW4/HANA
» How To Create Planning Applications Quickly & Cost-Effectively
Posts by Tag
» SAP Analytics Cloud (49)
» SAP BW/4HANA (44)
» Machine Learning (42)
» Dashboarding (40)
» SAP HANA SQL (25)
See All
Legal Notice
Privacy Protection
https://www.nextlytics.com/blog/sap-planning-flexible-data-slices-in-sap-bpc-with-abap-and-sql-script 16/16