BAPI Part 8: EXTENSIONIN — Saving Custom Fields with BAPIs
Preview · a free account unlocks the full lesson
Pass custom (ZZ) fields through BAPIs: EXTENSIONIN with BAPIPAREX, the BAPE structures (e. g. BAPE VBAK/BAPE VBAKX, BAPE VBAP/BAPE VBAPX for sales orders), appending fields to the right structures, filling VALUEPART1–4, and the typical reasons why custom fields are not saved.
In this lessonShow sectionsHide sections
Visual overview
Explanation
Part 6 covered mapping standard fields into a BAPI call, but many projects also need to carry their own custom fields on orders, purchase orders, or FI documents, and that's what EXTENSIONIN is for. EXTENSIONIN is a table of BAPIPAREX entries, where STRUCTURE names the extension structure and VALUEPART1 through VALUEPART4 carry that structure's content as plain text.
For sales orders specifically, you add ZZ fields to VBAK and VBAP through an append, and matching fields to BAPE_VBAK/BAPE_VBAKX and VBAKKOZ/VBAKKOZX at header level, or BAPE_VBAP/BAPE_VBAPX and VBAPKOZ/VBAPKOZX at item level. The X structure, such as BAPE_VBAKX, needs an 'X' flag for each custom field, exactly the way standard X structures work.
When custom fields come back "not saved," the usual cause is a missing append structure somewhere, a wrong key (VBELN or POSNR), or a missing entry in the X structure.
The reason EXTENSIONIN exists at all is that the BAPI interface itself can't change for every customer's custom fields, so custom data instead travels as generic text inside BAPIPAREX: one entry sets STRUCTURE to 'BAPE_VBAK', and VALUEPART1 holds the content of a BAPE_VBAK structure — VBELN plus your ZZ fields — moved across as plain characters. The BAPI then maps that text back into the custom fields of the actual document.
Create a free account to keep reading
You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.
- Full explanation
- Code example
- Real project scenario
- Common mistakes
- Best practices
- Interview angle
One tap with Google works too. Every topic keeps its first lesson open to everyone.
Keep exploring
Interview questions on this topic
Related SAP topics
Referenced SAP objects
Reviewed reference pages for the objects this page mentions.
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.