BAPI BOM upload integration fails with 'Material not found' error in SAP PLM

Our middleware system is uploading BOMs to SAP PLM 2021 using BAPI_MATERIAL_BOM_GROUP_CREATE but consistently fails with return message ‘Material XXXXXXXX does not exist or is not activated’.

The materials definitely exist - I can see them in MM03. The BAPI call structure looks correct and works fine in our test system with the same material numbers.


CALL FUNCTION 'BAPI_MATERIAL_BOM_GROUP_CREATE'
  EXPORTING
    material = '100000123'
    plant = '1000'
    bom_usage = '1'
  IMPORTING
    return = ls_return.
* ls_return-type = 'E'
* ls_return-message = 'Material 100000123 does not exist'

We’re calling the BAPI via RFC from our Java middleware. Material master data was extended to PLM views last month. Could this be related to material master extension timing or middleware mapping?

I’ve dealt with this exact scenario before. The BAPI has strict authorization and validation checks. Make sure your RFC user has authorization object C_STUE_BER (BOM authorization) with proper activity and plant assignments. Also check if you’re passing the BOM_USAGE parameter correctly - for PLM BOMs, you typically need usage ‘1’ or ‘5’. Verify your middleware is not accidentally passing empty strings or null values for required fields like VALID_FROM date. The BAPI is less forgiving than the GUI transactions.

Check transaction MMPI to see if the materials are properly activated in PLM. When you extend materials to PLM views, they need to be activated in the PLM context. Also verify table MARA field LVORM (deletion flag) and VPSTA (maintenance status) - if these are set incorrectly, the BAPI will reject the material even though it exists. Run SE16 on table MARA with your material number and check these fields.

Good point about leading zeros. I added the padding logic but still getting the same error. I noticed in our test system the materials were created more recently. Could there be a timing issue with material master extension? The materials were extended to PLM views only last month. Do I need to wait for some background job to complete or is there a material activation step I’m missing?

This smells like a leading zeros issue in your middleware mapping. SAP internal material numbers are 18 characters with leading zeros, but external systems often store them without padding. Your middleware might be sending ‘100000123’ when SAP expects ‘000000000100000123’. Check your Java RFC client configuration and ensure you’re using proper material number conversion. The JCo library has specific methods for this - look at the material number conversion exits in your SAP system (transaction OMSL) and implement the same logic in your middleware.