Skip to Content
Technical Articles

Automatic Generation of Project IDs using BAdI in SAP S/4HANA Cloud

This blog is continuation of series where I am explaining about the BAdI implementations based on the Customer use-cases.

Previous blog of this series can be found here.

Here you will learn how to set up the automatic and sequential Project IDs while creating a Project in SAP S/4HANA Cloud Professional Services.

Default Functionality:

With given functionality of SAP S/4HANA Cloud, Customers can enter alpha numeric values manually for their Internal and Customer Projects. But a unique number has to be maintained every time a new project is created by a Customer.

Moreover, if a customer is looking for sequential Project IDs, this might be a difficult task to manually enter them in sequence.

Customization:

In order to address the above requirement, SAP S/4HANA Cloud provides a BAdI which can be implemented to generate the sequential project IDs automatically each time a project is created.

This BAdI can generate sequential Project IDs for both Customer and Internal projects. And we may define the unique identifier as a prefix to differentiate among the type of projects. In my example, I have a prefix ‘I’ for Internal Projects and ‘C’ for Customer Projects.

Let’s go through the implementation of this BAdI:

Step1: Go to Custom Fields and Logic App, navigate to Custom Logic tab and Create New Enhanced Implementation.

Step2: Select Business Context – ‘Engagement Project’, BAdI Description – ‘Generate Project IDs’ and give a description.

Step 3: Insert the following code snippet in logic:

*********************************************************************

data(lr_badi_utility) = new /cpd/cl_sc_badi_utility( ).

lr_badi_utility->generate_project_id(

IMPORTING

ev_mp_id =    ls_projectid-engagementproject ” Master Project ID(used in BAdi)

).

IF ls_projectid-customer = ”.

ls_projectid-engagementproject = ‘I’ && ls_projectid-engagementproject.

ELSE.

ls_projectid-engagementproject = ‘C’ && ls_projectid-engagementproject.

ENDIF.

********************************************************************

In the above code we are putting a logic to generate project ID starting with ‘I’ if it is an internal project and ‘C’ if it a Customer project.

Customers can do further modifications based on their requirement.

 

Let’s look at above logic in action in a demo video.

I have structured the demo as following:

  •            Create a Customer Project when the BAdI is not implemented
  •           Create a Internal Project when the BAdI is not implemented
  •           Implement the BAdI
  •           Create Customer Project and notice the automatic Project ID generation
  •        Create Internal Project and notice the automatic Project ID generation

https://youtu.be/z9erk2aOUyI

Stay tuned for more.

Happy Learning!

/
3 Comments
You must be Logged on to comment or reply to a post.
  • Dear Akshay,

     

    thank you for sharing! I used the same way like you did. In release 2008 the class you refer to is getting deprecated and the one who they refer to (/cpd/cl_sc_badi_utility_1) is not allowed to get used outside the class.

    Any ideas how to solve that ;-)!?

     

    Greetings, Cedric

  • Hi Akshay,

    thanks for your blog entry.

    I get the same error message as Cedric. Can you help us with this?

    I would also like to start the Project ID with the first four digits of the service organization. Is that possible? And how does this change the code?

    Thanks for your support.
    Best Regards, Bianca