SAP CPI Hands On – Exercise 2

1 week ago 17

Overview

In this hands-on exercise, we will explore how Encoder and Decoder pallet functions work in SAP Cloud Platform Integration (SAP CPI). Encoding and decoding are common integration requirements, especially when dealing with secure data exchange, file compression, and structured message formats.
This exercise focuses on practically implementing various encoding and compression techniques using SAP CPI’s built-in pallet functions. We will work with an HTTPS sender adapter, test the scenarios using Postman, and observe how the message payload transforms at each step.

Encoder Decoder in CPI

In SAP Cloud Integration (CPI), Encoders and Decoders are part of the Transformation palette. They are used to change the format of a message payload to ensure secure or compatible data transmission between systems. 

Encoder Palette Functions

Encoders convert readable data into a specific format for transmission or storage. 

  • Base64 Encoder: Converts binary data (like images or PDFs) into a Base64-encoded string, which is often required for JSON payloads or APIs that don’t support attachments.
  • GZIP Encoder: Compresses a single message using the GZIP algorithm to reduce file size during transit.
  • ZIP Encoder: Zips a single message during processing.
  • MIME Multipart Encoder: Encodes content into a MIME multipart message, commonly used for sending emails with attachments or multi-part HTTP requests. 

New Training Announcement

Fee Payment and Enrollment Ends – 5th June 2026
Course Start Date – June 13 2026, 7:30 AM IST GMT+5.5 (9 PM CST on June 12 for USA Participants)
Course End Date – July 12 2026, 7:30 AM IST GMT+5.5 (9 PM CST on July 12 for USA Participants)
Each Class Duration ~  2.5 hours

Course Days – 13, 14, 20, 21, 27, 28 June, 4, 5, 11 & 12 July 2026 IST Dates 
Recordings of all classes will be provided – Lifetime access of these recording links
Day wise course break up – SAPUI5 & Fiori Master Class

Decoder Palette Functions

Decoders reverse the encoding process to return data to its original, readable format. 

  • Base64 Decoder: Converts a Base64-encoded string back into its original binary or text format (e.g., converting a string back into a PDF file).
  • GZIP Decoder: Uncompresses a GZIP-compressed message.
  • ZIP Decoder: Extracts a single message from a ZIP archive.
  • MIME Multipart Decoder: Breaks down a MIME multipart message into its individual parts for processing.

Key Differences

Feature EncoderDecoder
PurposeSecure, compress, or format data for sending.Restore data to original format for processing.
Common UsePreparing a file to be sent via an API.Reading an incoming file from a partner.
ConfigurationRequires selecting the specific encoding type.Often requires minimal configuration once added.

Now to understand practically, we will try to encode and decode the payload based on below pallet functions:

Encoder Pallet Functions:

Base64 Encoder
GZIP Compression
MIME- Multipart Encoder
ZIP Compression


Decoder Pallet Functions:

Base64 Decoder
GZIP Decompression
MIME- Multipart Decoder
ZIP Decompression

Adapter: HTTPS
Tools used: POSTMAN

Before we proceed with our tutorial, we would like to give you an opportunity to join our ZAPYard’s learning community where we have more than 35 groups and more than 1850 real SAP Consultants interacting with each other daily. Only SAP topics and not BS. Else, they will be banned from the community without warning. 👇👇👇👇

If you want to be part of ZAPYard’s Discussion Community, please feel free to check the below Link. We Ask, Answer, Help and Learn Together. There are more than 35 groups from different topics like Generative AI, SAP Joule, CAPM, BTP, RAP, BPT, Fiori, iRPA, CAI, CPI, PI/PO, ABAP on HANA, SAPUI5, SAP Build, SAP Adobe Forms, ChatBots, SAC etc. Join any group of your interest and interact with our Community.

Join ZAPYard’s WhatsApp Community – Ask, Answer, Propose & Defend SAP Topics

Input Payload:

Base 64 Encoder:

Use pallet function Base-64 encoder in IFlow

Test from POSTMAN:-

Base-64 Decoder:

Use pallet function Base-64 Decoder in IFlow

Test from POSTMAN, input the encoded payload from previous IFlow, will get original input payload back.

GZIP Compression:

Use pallet function GZIP compression to compress the payload in GZIP format.

Test from Postman:-

Save the response.

It will be saved as .GZ file

GZIP Decompression:

We will decompress the file to original payload back.

Use pallet function: GZIP Decompression

Test from Postman:-

Select .GZ file once you select binary in Postman and get the original payload

ZIP Compression:

Use pallet function ZIP Compression

Test from Postman with file below

Save the response

ZIP Decompression:

Decompress the .ZIP file using pallet function ZIP Decompression

Test from Postman:-

We have retrieved the original file content as shown in the image above.

MIME Multipart Encoder:

Select Multipart subtype: Mixed
Add Multipart Headers Inline: to include headers while giving encoded output
Include Header: Add header which you want to include- here added h* i.e., will include headername as manish
Note: For this we have to enable IFlow to accept header, Go to runtime configuration of IFlow
Add Allowed Header(s) as headername

Test from Postman

Add Header as headername= manish

Output:

We can see Header inline information is added
Header is included
With attachment encoded in Base-64 format

MIME Multipart Decoder:

Test from Postman, input same payload from previous encoder

We got original payload and header in header section.

Note: there is some added special character in output as this is just simulation, when you test end to end, we will get real time output without any extra character

In this hands-on exercise, we explored the practical usage of Encoder and Decoder pallet functions in SAP CPI by working with real-time message payloads. We implemented multiple encoding, compression, decoding, and decompression techniques such as Base64, GZIP, MIME Multipart, and ZIP, and understood how each transformation impacts the message during processing.

✨ Stay tuned for the upcoming article, where we will continue with SAP CPI Hands-On – Exercise 2 and dive deeper into more advanced SAP CPI integration scenarios.

Please follow our LinkedIn PageLinkedIn Group , Facebook PageFacebook GroupTwitter & Instagram.

Do not forget to SUBSCRIBE to our YouTube Channel for Free Courses and Unconventional Interesting Videos.

Do join ZAPYard’s Learning Community.

Read Entire Article