Introduction
SAP TM optimizer uses the Planning Profile to plan the Freight Units into Freight Order using the best possible way on available Vehicles via available routes.
Planning profiles are created to check how system needs to do the planning and what we do in planning profile that system use to get the desired result for optimization.
A Planning Profile can contain many different settings like:
- Capacity Selection Settings
- Capacity Availability Settings
- Optimizer Settings
- Cost & Constraints Settings
- Load Planning Settings
- Incompatibility Settings
- Carrier Selection Settings
- Manual Planning Settings
Now, there can be requirements where we need to know where the planning profile information resides in the SAP System. For example, we need to see the Resource assigned in the Capacity Selection Settings in the ABAP code to get the resource calendar.
This blog explains how to find the planning profiles and the settings in the SAP backend tables.
Technical Details for Planning Profiles and Settings
The planning Profile and the associated settings assigned all are stored as Business Objects in the SAP System. And to view them , you need to go to the BOBF Transaction and look under the Metadata Object Section as shown in the screenshot below.
Now back to our use case,
We need to find the resource assigned to Capacity Selection Settings for a Planning Profile .
- We have the Planning Profile Name , and we can use this to find the Capacity Selection Settings for the same.
- Business Object for Planning Profile: /SCMTMS/VSR_PLANNING_PROFILE
- Now we can directly find the table – /SCMTMS/D_PLAPRO from the root node to fetch the data or use the BOPF methods to get the root data. Check the BOBT testing using the alt key PROFILE_ID
- The screenshot below shows the Planning Profile details and the Field UUID043 holds the Capacity Selection Settings Name
- Now once you get the Capacity Selection Settings name, we can use the Business Object for Capacity Selection Settings to get the data stored.
- Business Object for Capacity Selection Settings – /SCMTMS/VSR_CAPA_SEL_PROF
- Again, either you can traverse the nodes directly using tables (ROOT – /SCMTMS/D_CAPAPR, Node –RES_BY ATTRIBUTE– /SCMTMS/D_CARESA or use BOPF to do so (recommended).
- Check the BOBT test screen to see where the resources are stored.
- The resources are stored in the child node RES_BY_ATTRIBUTE.
BOPF Retrieve Logic to Fetch the Planning Profile Details
- Instead of using the tables, the better approach is to use the BOPF retrieves.
- Get the Planning Profile Key by using the class /SCMTMS/CL_PROF_ACC by passing the Planning Profile Name and the Planning Profile BO Name.
*" Fetch planning profile key for planning profile id / Can be any other settings to
CALL METHOD /scmtms/cl_prof_acc=>get_prof_key_by_name
EXPORTING
iv_bo_name = /scmtms/if_vsr_planprof_c=>sc_bo_name
iv_profile_id = lv_plan_profileid
RECEIVING
ev_profile_key = DATA(lv_profile_key).
*"Prepare Planning profile key
IF lv_profile_key IS NOT INITIAL.
APPEND INITIAL LINE TO lt_profile_key ASSIGNING FIELD-SYMBOL(<fs_profile_key>).
<fs_profile_key>-key = lv_profile_key.
ENDIF.
*" Get Service Manager for Planning profile
DATA(lo_svc) = /bobf/cl_tra_serv_mgr_factory=>get_service_manager( iv_bo_key = /scmtms/if_vsr_planprof_c=>sc_bo_key ).
*" Get the Capacity Selection Profile information
CALL METHOD lo_svc)->retrieve_by_association
EXPORTING
iv_node_key = /scmtms/if_vsr_planprof_c=>sc_node-root
iv_association = /scmtms/if_vsr_planprof_c=>sc_association-root-capa_root
it_key = lt_profile_key
iv_fill_data = abap_true
IMPORTING
et_data = lt_capa_prof
eo_message = lo_message.
*" DO further retrieve for the capacity selection using another retrieve.
Conclusion
We found the resource/resources assigned to the Planning profile via Capacity Selection Settings. Similarly, we can use the Business Objects for each profile setting to get the details.
For a one-stop check, I have listed the business objects for each setting.
Profile/Settings | Business Objects |
Planning Profile | /SCMTMS/VSR_PLANNING_PROFILE |
Capacity Selection Settings | /SCMTMS/VSR_CAPA_SEL_PROF |
Optimizer Settings | /SCMTMS/VSR_OPT_SETTING_PROF |
Cost & Constraints Settings | /SCMTMS/VSR_OPT_PLANCOSTS |
Load Planning Settings | /SCMTMS/LSO_OPT_SETTING_PROF |
Incompatibility Settings | /SCMTMS/INCOMP_SETTINGS |
Carrier Selection Settings | /SCMTMS/TSPS_PROFILE |
Manual Planning Settings | /SCMTMS/VSR_MP_SETTINGS |
Capacity Availability Settings | /SCMTMS/VSR_CAPA_AVAIL_PROF |
I Hope this blog would be helpful to someone. Until next time, Adios!