Skip to Content
Product Information
Author's profile photo Akshay Kumar

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

Demo Video:

Stay tuned for more.

Happy Learning!

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.