ERPClimb logoERPClimb
BAPI
ABAP Developmentintermediate 9 min read

BAPI Part 6: Mapping Header, Item, Partner and Schedule Data

Preview · a free account unlocks the full lesson

Key takeaway

Map external data into complex BAPI structures: header/item/partner/schedule/condition tables, item number consistency, partner roles and conversions, units and currencies, date formats, change BAPIs with UPDATEFLAG (I/U/D), and a reusable mapping layer.

In this lessonShow sections

Visual overview

BAPI Part 6: Mapping Header, Item, Partner and Schedule Data — learning sheetFlow: Extend the Part 2 example with a ship-to partner, two items and a manual price condition → Change the quantity of item 20 with BAPI_SALESORDER_CHANGE (code example) → Deliberately mismatch an item number and observe RETURN. Key ideas: KEYS AND CONSISTENCY; PARTNERS; UNITS, CURRENCIES, AMOUNTS; CONDITIONS (PRICES). Watch out: A separate, tested mapping layer prevents the most common interface errors: wrong formats and inconsistent keys.ERPClimb.com / ABAP / LESSON 6/10 / LEARNING SHEETBAPI Part 6: Mapping Header, Item, Partner and ScheduleData1 · HOW IT FLOWS1Extend the Part 2 examplewith a ship-to partner,two items and a manual…2Change the quantity ofitem 20 withBAPI_SALESORDER_CHANGE…3Deliberately mismatch anitem number and observeRETURN2 · KEY IDEAS EXPLAINEDKeys And ConsistencyORDER_ITEMS_IN ITM_NUMBER '000010' must matchORDER_SCHEDULES_IN-ITM_NUMBER andORDER_CONDITIONS_IN-ITM_NUMBER.X structures repeat the keys (ITM_NUMBER,SCHED_LINE).PartnersInternal partner functions: AG (sold-to), WE(ship-to), RE (bill-to), RG (payer) — in Englishlogon shown as SP/SH/BP/PY. Convert with…Numbers with leading zeros (ALPHA).Units, Currencies, AmountsUnits: CONVERSION_EXIT_CUNIT_INPUT (external 'PC'→ internal 'ST' depending on language).Amounts in BAPIs are usually external format(BAPICURR); for internal→external conversions useBAPI_CURRENCY_CONV_TO_EXTERNAL / _TO_INTERNAL when…Conditions (Prices)ORDER_CONDITIONS_IN: ITM_NUMBER, COND_TYPE,COND_VALUE, CURRENCY; plus _INX flags.Only for condition types that allow manual entry.3 · REMEMBER · WATCH OUTRememberComplex BAPIs link tables by keys: item number (ITM_NUMBER) connectsitems, schedules, conditions and X structures.Values must be in internal format: ALPHA-converted numbers, internalunits (CUNIT), partner functions (AG/WE), currency amounts with the…Change BAPIs (e.g. BAPI_SALESORDER_CHANGE) use UPDATEFLAG: I insert, Uupdate, D delete — per header, item and schedule.!Watch outA separate, tested mapping layerprevents the most common interfaceerrors: wrong formats andinconsistent keys.4 · IN A REAL PROJECTA customer EDI feed sent ship-to partners with role "SH" and units "PC". Orders werecreated with the sold-to as ship-to and wrong units, causing deliveries to the wrong address. The team builtZCL_SO_MAPPER with conversion exits for partner functions and units, a value mapping table for…Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

Part 2 created an order with a minimal structure. Real interfaces bring many items, partners, schedules and prices, and this part covers mapping all of that consistently into BAPI structures.

Complex BAPIs link their various tables together by keys. Complex BAPIs link tables by keys: item number (ITM_NUMBER) connects items, schedules, conditions and X structures. So ORDER_ITEMS_IN with ITM_NUMBER '000010' must match ORDER_SCHEDULES_IN-ITM_NUMBER and ORDER_CONDITIONS_IN-ITM_NUMBER for the same line. The X structures repeat these same keys (ITM_NUMBER, SCHED_LINE) alongside their flags. Header-level partners use ITM_NUMBER '000000', while item-level partners carry the actual item number.

Partner data has its own conventions. Internally, partner functions are coded as AG (sold-to), WE (ship-to), RE (bill-to) and RG (payer), though an English logon often displays them as SP, SH, BP and PY — CONVERSION_EXIT_PARVW_INPUT converts between the two. Partner numbers also need their leading zeros applied through the standard ALPHA conversion.

Units, currencies and amounts each need their own internal format. Units go through CONVERSION_EXIT_CUNIT_INPUT, which converts an external unit like 'PC' into its internal form, such as 'ST', with the mapping depending on language. Values must be in internal format: ALPHA-converted numbers, internal units (CUNIT), partner functions (AG/WE), currency amounts with the right decimals.

Amounts passed into BAPIs are usually in external format (BAPICURR); where a conversion between internal and external amount format is actually needed, BAPI_CURRENCY_CONV_TO_EXTERNAL and BAPI_CURRENCY_CONV_TO_INTERNAL handle currencies like JPY that have no decimal places. Dates are passed as YYYYMMDD in DATS fields.

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.