SAP BAPIObjectBAPI_PROJECT_MAINTAINModulePS

BAPI_PROJECT_MAINTAIN — BAPI for Maintaining Project Definitions and WBS Elements

BAPI_PROJECT_MAINTAIN creates and changes project definitions and WBS elements, the same data CJ01 and CJ02 maintain online. It uses a method-table interface: one table says what to do, separate tables carry the field values, and new WBS elements are addressed by a caller-assigned temporary number until the system hands back the real one. It does not commit automatically.

This page covers the interface structure of BAPI_PROJECT_MAINTAIN, how its method-table and temporary-number design differs from a simple create/change BAPI, and the RETURN-handling mistakes that cause silent partial creates in project interfaces. It also covers commit behaviour, common pitfalls in real integrations, and where responsibility sits between developer and PS consultant.

Published 16 Sept 2026· 1,073 words

What it does

BAPI_PROJECT_MAINTAIN maintains the project definition and its WBS element hierarchy, the same objects created and changed through CJ01 and CJ02. A single call can build an entire new project structure, extend an existing one with additional WBS elements, or update basic dates, responsible cost centre, plant, user fields and status-relevant attributes on elements that already exist. It does not touch networks, activities or milestones - those are maintained through the separate network BAPI family. The interface follows the same multi-method pattern used elsewhere in PS and PM: an instruction table tells the BAPI what operation to perform against which object, and one or more data tables carry the actual field values, linked together through temporary numbers the caller assigns, because the real WBS element internal number does not exist yet at the moment the call is built.

Important parameters

  • I_METHOD - instruction table: object type (project definition or WBS element), method (add, update, delete), the object key or temporary key that links this instruction to a row in the data tables, and an activity flag controlling whether the row is processed.
  • I_PROJECT_DEF - project definition fields: project ID, description, start and finish dates, project profile, person responsible, currency and planning attributes.
  • I_WBS_ELEMENT - WBS element fields: WBS code, short and long text, dates, responsible cost centre, plant, user-defined fields; new elements are identified here by the temporary number set in I_METHOD, not by the eventual real WBS internal number.
  • RETURN - standard return table, one row per message, carrying message type, number, and the object reference the message applies to, correlated back to the method-table row that caused it.
  • An export mapping table returning, for each temporary number used in the create call, the real WBS element number the system actually assigned - this is the only place the caller learns the final numbering, since it is typically internal.

Commit behaviour

BAPI_PROJECT_MAINTAIN does not commit. Like most BAPIs it writes to the update task within the current LUW and leaves the decision to commit or roll back with the caller, who must call BAPI_TRANSACTION_COMMIT (or the equivalent in the calling program) after inspecting RETURN. Forgetting the commit does not raise an error - the call appears to succeed, RETURN may even come back clean, but nothing is persisted to the database once the session ends, and any object numbers reported in the export mapping table become invalid. This is a frequent cause of interfaces that report success to a monitoring log while the project was never actually created.

Return handling

RETURN must be scanned as a full table, not sampled from the first row. A batch call that creates a project definition plus several WBS elements can produce a mix of message types across different method-table rows: one WBS element fails a required-field check while the others succeed, or a warning fires on a date shift that is easy to mistake for informational noise. Reading only the first entry, or checking whether RETURN is initial instead of scanning for message type E or A, is the classic interface bug - it lets the caller commit a partially built structure. Because each RETURN row correlates to a specific method-table entry, the caller has to map messages back to the object key or temporary number they reference to know precisely which WBS element failed; skipping that mapping means the calling program either commits everything indiscriminately or rejects a batch that in fact mostly succeeded. Function-module return code (sy-subrc) is not a substitute for this - the BAPI itself will return 0 even when RETURN carries fatal errors.

ECC vs S/4HANA

BAPI_PROJECT_MAINTAIN remains the standard integration point for classic project definitions and WBS elements on S/4HANA on-premise; no released public API has fully superseded it for this scope. S/4HANA also introduces separate project types for enterprise-style project management, which are maintained through a different set of objects and are not addressed by this BAPI. When a project shows up as an enterprise project rather than a classic PS project, confirm which project type is in use before assuming this BAPI applies.

Common pitfalls

  • Hardcoding assumed WBS numbering instead of reading the temporary-to-real number mapping - internal numbering means the caller cannot predict the final WBS element number before the call returns.
  • Committing without checking RETURN for type E rows buried among warnings, leaving a half-built project structure that downstream postings then reference incorrectly.
  • Trying to change a status-controlled field (dates, responsible cost centre) on a WBS element that is already released - the status check fails and the resulting message is often misread by a functional user as an authorization problem.
  • Sequencing add-methods incorrectly within one call, so a child WBS element's method row is processed before its parent project definition or parent WBS element exists in the same table, causing a silent dependency failure.
  • Running BAPI_PROJECT_MAINTAIN and a network-maintenance BAPI against the same project in parallel batch jobs - the project or WBS element is enqueue-locked by the other call, and the resulting lock error is not always distinguishable from a genuine data error in the log.

Whose problem this is

Interface correctness - method-table sequencing, commit logic, RETURN parsing - is a developer problem. A PS consultant's job is to confirm what the equivalent manual action in CJ02 does and produce the project profile, status, and field values that reproduce the block, since most failures trace back to a status or configuration restriction the interface is running into, not a code defect.

Related SAP objects

Reviewed pages this object connects to in the ERPClimb knowledge graph.

Source: ERPClimb — https://erpclimb.com/sap-bapis/bapi-project-maintainERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.