ERPClimb logoERPClimb
BAPI
ABAP Developmentadvanced 8 min read

BAPI Part 8: EXTENSIONIN — Saving Custom Fields with BAPIs

Preview · a free account unlocks the full lesson

Key takeaway

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 sections

Visual overview

BAPI Part 8: EXTENSIONIN — Saving Custom Fields with BAPIs — learning sheetFlow: In a sandbox, append ZZPROJECT (CHAR10) to VBAK, BAPE_VBAK, VBAKKOZ and CHAR1 to BAPE_VBAKX, VBAKKOZX → Extend the Part 2 program with EXTENSIONIN (code example) → Verify VBAK-ZZPROJECT after creation. Key ideas: HOW EXTENSIONIN WORKS; SALES ORDER SETUP (BAPI_SALESORDER_CREATEFROMDAT2 / _CHANGE); FILLING THE EXTENSION; OTHER APPLICATIONS. Watch out: Custom fields are "not saved" mostly because an append structure is missing somewhere, the key (VBELN/POSNR) is wrong or the X entry is missing.ERPClimb.com / ABAP / LESSON 8/10 / LEARNING SHEETBAPI Part 8: EXTENSIONIN — Saving Custom Fields with BAPIs1 · HOW IT FLOWS1In a sandbox, appendZZPROJECT (CHAR10) toVBAK, BAPE_VBAK, VBAKKOZ…2Extend the Part 2 programwith EXTENSIONIN (codeexample)3Verify VBAK-ZZPROJECTafter creation2 · KEY IDEAS EXPLAINEDHow Extensionin WorksSTRUCTURE = 'BAPE_VBAK'VALUEPART1 = content of a BAPE_VBAK structure(VBELN + ZZ fields), moved as characters.Sales Order Setup…Append ZZ field to VBAK (SE11).Append the same field to BAPE_VBAK and VBAKKOZ(type as in VBAK).Filling The ExtensionBAPE_VBAK-VBELN: empty for create (or the ordernumber for change); ZZ field value.Move the structure to VALUEPART1 (character-likefields only — for packed/decimal fields usecharacter-typed append fields or the application's…Other ApplicationsPurchase orders (BAPI_PO_CREATE1):BAPI_TE_MEPOHEADER/…X, BAPI_TE_MEPOITEM/…X withCI_EKKODB/CI_EKPODB includes.FI (BAPI_ACC_DOCUMENT_POST): EXTENSION2 + BAdIACC_DOCUMENT or EXTENSION1 + BTE RWBAPI01.3 · REMEMBER · WATCH OUTRememberEXTENSIONIN (table of BAPIPAREX) carries custom field values:STRUCTURE = name of the extension structure, VALUEPART1–4 = the…For sales orders: add ZZ fields to VBAK/VBAP (append) and toBAPE_VBAK/BAPE_VBAKX, VBAKKOZ/VBAKKOZX (header) or…The X structure (BAPE_VBAKX) needs 'X' for each custom field, justlike standard X structures.!Watch outCustom fields are "notsaved" mostly because an appendstructure is missing somewhere, thekey (VBELN/POSNR) is wrong or the Xentry is missing.4 · IN A REAL PROJECTA project field on sales orders was filled by the EDI interface but always empty in VBAK. The developer hadappended ZZPROJECT to VBAK and BAPE_VBAK, but not to VBAKKOZ/VBAKKOZX, which the BAPI uses internally totransfer values into the order. After completing the appends and adding the BAPE_VBAKX entry, the field was…Original ERPClimb learning sheet • Verify against your SAP release and edition

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.

Free account

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

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.