This is a detailed step-by-step technical guide document to introduce a Developer Extensibility case followed by this
blog.
1. Case Background:
There are some customers who require to see the BOM all level data, and they would also request to download the BOM all level data in batch. We do have standard App "Display BOM level by level" which can see/download the BOM all level data for single material. But there is no such app can view the same data for multiple materials.
standard App Display BOM level by level can only view the data for single Material
With developer extensibility, we have built a custom app which allow to select multiple materials, and view/download all nodes level data for the selected materials.
BOM Batch Extraction
2. Backend Service Development:
2.1 Create Data Definition
Create new data definition: Z_BOM_BATCH_EXTRACTION
2.2 Create Query Implementation Class
Create the class ZCL_BOM_DISPLAY. The class contains the detailed logic for data query.
METHOD get_bom_hierarchy.
*get BOM Link and BOM hierarchy based on condition
SELECT *
FROM I_BOMComponentWithKeyDate( p_keydate = @rp_keydate ) AS Bom
JOIN I_MaterialBOMLink AS Bomlink
ON Bom~BillOfMaterialCategory = Bomlink~BillOfMaterialCategory
AND Bom~BillOfMaterialVariant = Bomlink~BillOfMaterialVariant
AND Bom~BillOfMaterial = Bomlink~BillOfMaterial
WHERE Bomlink~BillOfMaterialCategory = 'M'
AND Bomlink~BillOfMaterialVariant = '01'
AND Bomlink~Material IN @rt_material
AND Bomlink~Plant IN @rt_plant
INTO TABLE @DATA(lt_BOMlist).
IF sy-subrc = 0.
rv_resp = abap_true.
CLEAR pt_materialhierarchy.
ENDIF.
LOOP AT lt_BOMlist ASSIGNING FIELD-SYMBOL(<lfs_bomlist>).
MOVE-CORRESPONDING <lfs_bomlist>-bomlink TO ps_response.
MOVE-CORRESPONDING <lfs_bomlist>-bom TO ps_response.
"Get product descrption saperatelly since CDS view does not have it.
SELECT SINGLE ProductName FROM I_producttext
WHERE Product = @ps_response-material AND Language = @sy-langu INTO @ps_response-materialDesc.
APPEND ps_response TO pt_response.
CLEAR ps_response.
ps_material-sign = 'I'.
ps_material-option = 'EQ'.
ps_material-low = <lfs_bomlist>-bom-BillOfMaterialComponent.
APPEND ps_material TO pt_materialhierarchy.
CLEAR ps_material.
ENDLOOP.
ENDMETHOD.
2.3 Create Service Definition and Service Binding
Create Service Definition
Create Service Binding
And we can preview the service like below:
3. Frontend App Development
First, Configure the destination on BTP.
Then, open the SAP Business Application Studio service:
Choose List Report Page template from Application Generator:
Deploy the app to SAP S/4HANA cloud system:
Copy Launchpad App Description Item Name to IAM App:
With the new app, we can not only select multiple materials to view the BOM nodes level data, but also can download the data into Excel file.
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
vincent.zhu