Courseiva

C_CPI Integration Suite Development Practice Question

An integration developer is using a Message Mapping step with a user-defined function in SAP Cloud Integration. The function must access a value from a message header named 'Country' and use it to conditionally transform the output. How can the developer access this header value within the user-defined function?

⚠ Common exam trap

The trap here is assuming that MappingContext directly exposes headers, when in fact you must navigate through the Exchange object.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Use the getHeader() method on the Exchange object obtained from the MappingContext.

User-defined functions in message mapping can access the message exchange context. The MappingContext provides the Exchange object, which contains the input message and its headers. By calling getExchange().getIn().getHeader('Country'), the function can read the header value. Other methods either do not exist or access different data structures, making them incorrect for this scenario.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    Use the getHeader() method on the Exchange object obtained from the MappingContext.

    Why this is correct

    In a user-defined function, the MappingContext provides access to the underlying Exchange object via getExchange(). The Exchange object has a getIn() method to get the input message, which in turn has getHeader() to retrieve a specific header. This chain allows the function to read the 'Country' header and use it in conditional logic, fulfilling the requirement.

  • ✗

    Use a Groovy script before the mapping to copy the header into a property, then access it via getProperty().

    Why it's wrong here

    While this approach would work, it requires an additional step before the mapping, which is not the most direct solution. The question asks how to access the header within the user-defined function itself. Using a Groovy script adds complexity and is unnecessary because the header can be accessed directly through the Exchange object. Thus, it is not the best answer.

  • ✗

    Use the getHeader() method on the MappingContext object.

    Why it's wrong here

    The MappingContext object in SAP Cloud Integration does not provide a getHeader() method. It offers methods to access source and target fields, but headers are not directly exposed. Developers often mistakenly assume that headers are accessible like in other scripting contexts, but in message mapping, the context is limited to the message payload structure.

  • ✗

    Use the getProperty() method on the MappingContext object.

    Why it's wrong here

    The getProperty() method on MappingContext retrieves exchange properties, not message headers. While properties can be set from headers using a Content Modifier, they are not the same as headers. Without explicitly copying the header to a property, this method will not return the desired value. Thus, it does not directly solve the requirement.

About these practice questions

Courseiva writes every C_CPI question from scratch — 218 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official SAP exam blueprint

This C_CPI practice question is part of Courseiva's free SAP certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the C_CPI exam.