As you can know from the title, there will be a series of our blogs about some cases in SAP S/4HANA Cloud, public edition, ABAP Environment. Before we start, I'd like to suggest that you can read two blogs,
one written by Marco, and the other
one written by Vincent. Marco provides a great summary of all extensibility techniques used in SAP S/4HANA Cloud, public edition. Vincent introduces some cases to us and I'd like to write some blogs to show the details of our cases. I hope that can bring some insights for you in 3SL Exploration. Enjoy it!
1. Scenario Requirements
1.1 Case Background
Based on the physical situation of goods, our warehouse colleague wants to pass information about the goods receipt such as damage of intrinsic matter, product validity exception, etc. to QA quality inspector at goods receipt. The warehouse clerk fills in the header text field of the material document resulting from the goods receipt posting at goods receipt posting and this field is not passed from the goods receipt material document to the automatically generated inspection lot of the goods receipt via standard functionality. So we want to achieve this business requirement by way of development.
1.2 System Action
Front office condition: The material master quality attempt requires the corresponding inspection type to be activated, and the configuration of the QM module needs to be improved.
When creating a Material Document based on a Purchase Document, an Inspection Lot is automatically generated on the selected item with an empty Short Text for the automatically created Inspection Lot. You want to pass some information downstream, so when creating an Inspection Lot, call the BAdI to modify the Short Text.
1.2.1 Create Material Document
With
Post Goods Receipt for Purchase Document APP, when you create a Material Document, you fill in the Note field, which is reflected on the automatically created Inspection Lot.
Create Material Document
1.2.2 Display Inspection Lot
Use
Display Inspection Log App to see that the Short Text field in the automatically created Inspection Lot has been set to be filled in the Note of the Material Document.
Display Inspection Lot
2. Detailed Steps
2.1 BAdI for Release-Out Found
Enhancements Spots MMIM_GR4XY_FIORI
- MMIM_GR4XY_CHECK_DATA Change Header and Item Data in Goods Receipts
When creating a Material Document, save the value of the Note field for further use.
The BAdI can be found under
Release Objects >
Enhancements >
MM >
MM-IM >
Enhancements Spots.
BAdI - MMIM_GR4XY_CHECK_DATA
Enhancements Spots QPL1_INSPLOT_CHANGE
- QPL1_INSPLOT_CHANGE Change Inspection Lot Header During Lot Creation
When creating an Inspection Lot automatically, assign the value of the Note field you just saved to Short Text.
You find the BAdI under
Release Objects >
Enhancements >
QM >
QM-IM >
Enhancements Spots.
BAdI - QPL1_INSPLOT_CHANGE
2.2 Define Implementations for BAdI Enhancements
First create a
Package, right-click
ZLOCAL >
New >
ABAP Package.
Fill in
Name and
Description of the Package and check
Add to favorite packages for easy follow-up. Click
Next.
Then lick
Next >
Finish to complete
package creation.
New ABAP Package
Right-click the newly created
Package and click
New >
Other ABAP Repository Object.
Enter
BAdI to search, check
BadI Enhancement Implementation and click
Next.
Enter
Name and
Description and click
Browse to the right of
Enhancement Spot.
Enter
MMIM_GR4XY_FIORI to search and select, click
OK.
Click
Next >
Finish to complete the creation of the first BAdI enhancement implementation.
New BAdI Enhancement Implementation
The creation of the second BAdI enhancement implementation is done in the same step, choose
QPL1_CHANGE_AT_CREATE4CLD as
Enhancement Spot.
2.3 Add BAdI Definition for Enhancement Extension Point on Material Document
Open the first enhancement implementation you created in the previous step, click
Add BAdI Implementation, click
Browse to the right of
BAdI Definition, search for it, select
MMIM_GR4XY_CHECK_DATA, and click
OK.
Then fill in
BAdI Implementation Name and click
Add.
Add BAdI Implementation
When you have finished adding
BAdI Definition, we are prompted that the implementing class is missing.
Class Missing
Add a
BAdI Definition for the second enhancement implementation using the same steps to create the section. Select
BADI_QPL1_CHANGE_AT_CREATE4CLD as
the BAdI Definition for the second enhancement implementation.
2.4 Custom implementation logic in ABAP classes
Right-click the
package you created and click
New >
ABAP Class.
After entering
Name and
Description for the class, click
Next.
Click
Finish to finish creating the class.
New ABAP Class
In the created class, customize the implementation logic. When the
Material Document is saved, a variable is used to store the
Note field of the
Material Document for subsequent use.
Save and click
🕯 in the upper menu bar to activate the class.
CLASS zcl_gr4xy_check_data DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-DATA headertext TYPE string.
INTERFACES if_badi_interface .
INTERFACES if_mmim_gr4xy_check_data .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_GR4XY_CHECK_DATA IMPLEMENTATION.
METHOD if_mmim_gr4xy_check_data~check.
headertext = gr4xy_header-materialdocumentheadertext.
ENDMETHOD.
ENDCLASS.
Add the class you just created as an implementation class to the
BAdI Implementation you created earlier. Click
Browse, select the
BAdI Implementation you created earlier, and click
OK.
Add
an implementation class for the second BAdI Implementation with the same steps. In the created class, customize the implementation logic. When creating
an Inspection Lot automatically, assign the
value of the Note field you just saved to
Short Text.
Save and click
🕯 in the upper menu bar to activate the class.
CLASS zcl_change_at_create4cld DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_badi_interface .
INTERFACES if_ex_qpl1_change_at_create4cl .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_CHANGE_AT_CREATE4CLD IMPLEMENTATION.
METHOD if_ex_qpl1_change_at_create4cl~execute_change.
* Test BADI in Lot Change during Creation
inspectionlottext = zcl_gr4xy_check_data=>headertext.
ENDMETHOD.
ENDCLASS.
2.5 Activate BAdI enhancement
Mark
Active Implementation, save it, click
🕯 in the upper menu bar, and
the implementation will be called below will indicate that the BAdI enhancement activation has been completed.
BAdI Enhancement Implementation - MMIM_GR4XY_CHECK_DATA
BAdI Enhancement Implementation - QPL1_INSPLOT_CHANGE
3. More Information on SAP S/4HANA Cloud, Public Edition
- SAP S/4HANA Cloud, public edition, release info here
- Latest SAP S/4HANA Cloud, public edition, release blog posts here and previous release highlights here
- Product videos on our SAP S/4HANA Cloud, public edition and SAP S/4HANA YouTube playlist
- SAP S/4HANA PSCC Digital Enablement Wheel here
- Early Release Webinar Series here
- Inside SAP S/4HANA Podcast here
- openSAP Microlearnings for SAP S/4HANA here
- Best practices for SAP S/4HANA Cloud, public edition, here
- SAP S/4HANA Cloud, public edition, Community: here
- Feature Scope Description here
- What’s New here
- Help Portal Product Page here
- SAP S/4HANA Cloud ABAP Environment Community here
Follow us via
@SAP and #S4HANA or follow
summer23