SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Implement a Wrapper for the "Create Purchase Requisition" (BAPI_PR_CREATE) function module

Learn how to wrap the BAPI_PR_CREATE in your SAP S/4HANA or SAP S/4HANA Cloud, private edition system and release it for consumption in ABAP Cloud Development.

Overview

🎓 intermediate 15 min. ABAP ExtensibilityIntermediateSAP S 4hanaABAP Development

You will learn

  • How to create a wrapper interface, a wrapper class and a factory class for the BAPI_PR_CREATE.
  • How to test that the wrapper objects have been released for consumption in ABAP Cloud Development.
  • How to release the wrapper for consumption in ABAP Cloud Development.
Matthäus Schüle M Matthäus Schüle July 24, 2026
Created by June 18, 2025
Contributors

Prerequisites

Prerequisites

  • In this tutorial series, it is assumed that your system is running on the SAP S/4HANA 2023 release with feature pack stack 3 installed.
  • You have completed the previous tutorials in this group to learn about the clean core extensibility model and connect to your SAP S/4HANA system.

Steps

Intro

Throughout this tutorial, wherever ### appears, use a number (e.g. 000). This tutorial is done with the placeholder 000.

In a previous tutorial of this group, you learned about the clean core extensibility model and got an overview of the sample scenario used for this tutorial group, which will include a Shopping Cart Business Object with purchase requisition creation capability.

In this tutorial we show how to deal with the case in which no convenient released API is available to create purchase requisitions. The ABAP Cloud API Enablement Guidelines for SAP S/4HANA Cloud, private edition, and SAP S/4HANA documentation recommends to use a BAPI as an alternative to a released API, wrap it and then release the wrapper for consumption in ABAP Cloud Development. In a later tutorial you will then create a Shopping Cart RAP Business Object for the online shop application and integrate this wrapper to create purchase requisitions.

Step 1 Get to know the BAPI_PR_CREATE via the BAPI Explorer

The first step is to look for a suitable unreleased API to create purchase requisitions. You can use the BAPI Explorer for this purpose. Connect to the backend of your SAP S/4HANA system and start transaction BAPI. For the purpose of this tutorial, we will use the unreleased BAPI BAPI_PR_CREATE: switch to the Alphabetical view (1), look for the Business Object PurchaseRequisition (2), find and click on the method CreateFromData1 (3). You can see that its function module is the BAPI_PR_CREATE (4).

BAPI explorer
BAPI explorer

In the Documentation tab you can find more information on what the BAPI is used for (in this case: to create purchase requisitions) and you can find examples for various scenarios and how to fill the respective parameter values.

In the Tools section you can click on the Function Builder and then click on Display to see the required parameters:

BAPI explorer - Tools
BAPI explorer - Tools

BAPI explorer - Function Builder
BAPI explorer - Function Builder

The BAPI_PR_CREATE has a TESTRUN parameter that can be used to call the BAPI in validation mode. Some BAPI have a similar test mode that can be used to validate input data. It is best practice to make use of this test mode, if available, as we will address in more details in a later tutorial of this group.

Step 2 Create a development package
+
Step 3 Create a wrapper class, interface and factory class
+
Step 4 Test unreleased wrapper with console application in ABAP Cloud Development
+
Step 5 Release the wrapper interface and factory class
+
Step 6 Optional Step - Run ATC checks and request exemptions
+
Step 7 Test released wrapper with console application in ABAP Cloud Development
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 7
1. Get to know the BAPI_PR_CREATE via the BAPI Explorer 2. Create a development package 3. Create a wrapper class, interface and factory class 4. Test unreleased wrapper with console application in ABAP Cloud Development 5. Release the wrapper interface and factory class 6. Optional Step - Run ATC checks and request exemptions 7. Test released wrapper with console application in ABAP Cloud Development

Learn more →