
As my colleague has outlined in this blog, there are 2 different possibilities for managing projects, Enterprise projects and Professional Services Projects, within S/4HANA Cloud public edition. Until now, a key user would use this approach Automatic Generation of Project IDs using BAdI in SAP S/4HANA Cloud to influence the generation of project IDs based on some key combinations, as mentioned in the blog Automatic Generation of Project IDs using BAdI in SAP S/4HANA Cloud. However, the above approach has a couple of shortcomings,
We now have a unified approach that can be applied to both types of project control activities using enterprise project APIs (yes, enterprise project APIs now can be used to create both professional services projects and enterprise projects! Yes, we have some areas to catch up.)
In this blog, I detail out project ID generation using the new approach and overcoming those challenges mentioned above.
Here you will learn:
How to generate Custom Project IDs based on customer name and project year. Typically, customers generate Project IDs based on the customer's short name and project year and then sequence numbers. For example, CUSTOMERNAME2023001.
How to debug Cloud BADI via ABAP Development Tools. (Only available in CE2402)
With the Customer Project functionality in SAP S/4HANA Cloud, customers can manually enter alphanumeric values for their internal and customer projects. But a unique number must be entered each time the Customer creates a new project.
For customer projects generated by solution order, the project ID is combination of solution order number and item number.
In this document, only covers Plan Customer Projects.
The creation of a new implementation of the BadI will be carried out in SAP S/4HANA Cloud under the Business User using Custom Logic without access to the Classic SAP GUI. The new implementation of BadI will generate a Project ID for Customer Project based on the short name of the client and the year of the project, and then serial numbers.
In order to achieve this task, you need the following Roles or copied roles assigned to your business user.
Business Role | Business Role ID |
Extensibility Specialist | SAP_BR_EXTENSIBILITY_SPEC |
Project Manager - Professional Services | SAP_BR_PROJECT_MANAGER_PROF |
If you don’t have the above roles, you need ask your administrator to request roles. Or follow the guide Maintain Business Users if you are the administrator.
To achieve our goal, we will need to create a new implementation of BadI based on the extension point /S4PPM/PROJECT_DETERMINATION_2 using the Custom Logic functionality and write code that will generate a new Project ID according to our requirements.
Or use App Finder
Set Extension point as /S4PPM/PROJECT_DETERMINATION_2.
Set Filter as PROJECTCATEGORY = 7.
For example,
**********************************************************************
*Generate Project ID with Specific Format: <Customer Name><Current Year><Next Sequence Number>
**********************************************************************
CONSTANTS:
cn_startcustproj(5) TYPE n VALUE '00001', "StartValue Counter CUSTOMER Projects
cs_cntmask(5) TYPE c VALUE '_____'. "Mask for select
DATA: ls_project TYPE /s4ppm/ts_ent_proj,
lv_projectid TYPE /cpd/mproj_id,
lv_sequence_num TYPE n LENGTH 5.
FIELD-SYMBOLS: <fs_number> TYPE c.
MOVE-CORRESPONDING enterpriseproject TO changedenterpriseproject .
MOVE-CORRESPONDING enterpriseproject TO ls_project.
CHECK ls_project-customer IS NOT INITIAL AND ls_project-customer <> '0000000000'
AND enterpriseproject-projectuuid IS INITIAL.
SELECT SINGLE customername
FROM i_customer
INTO @DATA(lv_customername)
WHERE customer = @ls_project-customer.
"Construct New Project ID Format
DATA(lv_curr_date) = cl_abap_context_info=>get_system_date( ).
changedenterpriseproject-project = lv_customername(6) && "Customer Name
lv_curr_date(4). "Current Year
* Select highest project ID created so far for this Numbering Scheme
ASSIGN changedenterpriseproject-project+10(5) TO <fs_number>."fs_number is the second part of the ID
<fs_number> = cs_cntmask.
DATA(lv_project_format) = changedenterpriseproject-project(10) && '%'.
CONDENSE lv_project_format NO-GAPS.
TRANSLATE lv_project_format TO UPPER CASE.
SELECT MAX( project )
FROM i_enterpriseproject
INTO @lv_projectid
WHERE project LIKE @lv_project_format.
IF lv_projectid IS INITIAL.
* Nothing found. Must be first such project.
<fs_number> = cn_startcustproj ."Second Part of ID
ELSE.
* Get next number
changedenterpriseproject-project = lv_projectid.
lv_sequence_num = <fs_number> + cn_startcustproj.
<fs_number> = lv_sequence_num.
ENDIF.
CONDENSE changedenterpriseproject-project NO-GAPS.
Now we are completely ready to test our new functionality that we have implemented. To do this, go to the Create Customer Projects application, create a Project, and save.
As you can see, Project ID contains: Short Name of the Customer + Current Year + sequence number.
As a programmer, it would be very convenient if debug is supported. With developer extensibility enabled, you are able to debug Cloud BADI
ABAP Development Tools (ADT) is installed.
Developer Extensibility is supported.
In order to achieve this task, you need the following Roles or copied roles assigned to your business user.
Business Role | Business Role ID |
Application Support Engineer - Development Support | SAP_BR_APPL_SUP_ENG_DEV_SUP |
Application Support Engineer | SAP_BR_APPL_SUPPORT_ENGINEER |
Open ADT-> Click on the select wizard (top left button under File tab) -> Choose ABAP Cloud Project and press “Next”.
Choose SAP S4/HANA Cloud ABAP Environment -> Enter URL of your system and click “Next” -> Click on the button “Open Logon Page in Browser” -> Log In to the system under your Business User in the Web Page.
The result of it must be successfully logged on to the System.
To continue creating the ABAP Service Instance Connection, click on the button “Next” -> Click on the button “Finish”.
Once all steps have been completed successfully. You should be able to log into your system using ADT.
ADT contains more advanced functionality for interaction with the SAP system. To find the new extension class YY1_GENERATEPROJECTID which was generated based on the new BadI Implementation we need to Open ABAP Development Object manually or use combination of the Cntrl+Shift+A. In this class you can see the code you wrote in Custom Logic.
Here you can set a breakpoint and debug the code.
To set a breakpoint, you need to double-click on the blue area to the left of the line numbering.
Conclusion:
In this blog, we looked at an example of how you can create an extension from scratch using Custom Logic for a Customer Projects, write code, access the code through ADT and test it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
8 | |
7 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 | |
4 |