Skip to content

Create and Load Purchase Requisitions in SAP

The following article shows how to use the Xtract BAPI component of Xtract for Alteryx to create a new purchase requisition in SAP and how to load the data of the purchase requisition into Alteryx.

About this Workflow

This article leads you through all necessary steps to set up the following workflow:

  • Create a new purchase requisition in an SAP ERP system.
    This process uses a simple input table that contains the data for the purchase requisition.
  • Use the new purchase requisition number to load the details of the purchase requisition into Alteryx.
    This process uses an input parameter and a batch macro to pass the input parameter to the Xtract BAPI component.

Note

When using Xtract for Alteryx version 1.18 and below tables can be passed to the Xtract BAPI component directly via an input anchor, while single values require the use of batch macros. As of Xtract for Alteryx version 1.19 all input parameters can be passed to the Xtract BAPI component without batch macros.

Download Workflow

SAP System SAP Objects Xtract for Alteryx Component
SAP ERP BAPI_REQUISITION_CREATE (Create Purchase Requisition)
BAPI_REQUISITION_GETDETAIL (Display Purchase Requisition Details)
Xtract BAPI

bapi-workflow

Prerequisites

To use the Xtract BAPI component, access to the designated authority objects (RFC) in SAP must be available, see SAP User Rights: BAPI.

Create a new Purchase Requisition in SAP

Follow the steps below to create a new purchase requisition in SAP:

  1. Drag & drop the Xtract BAPI component into your Alteryx workflow .
    xfa_create_bapi_extraction_01
  2. Select an SAP connection . If no SAP connection is available, create a new connection, see Documentation: SAP Connection.
  3. Click [Edit] to open the main window of the Xtract BAPI component.
  4. In the main window of the component click . The window “Function Module Lookup” opens.
    BAPI-empty
  5. In the field Function Name enter the name of the BAPI BAPI_REQUISITION_CREATE. Use wildcards (*), if needed.
    create-purchase-requisition-lookup
  6. Click and select the BAPI BAPI_REQUISITION_CREATE from the displayed list .
  7. Click [OK]. The window "Function Module Lookup" closes.
  8. In the tab Tables of the Xtract BAPI component click to look up the names and data types of the table REQUISITION_ITEMS. Use this information to prepare the input data of the purchase requisition:
    create-purchase-requisition-input-table
  9. Connect the input data to the Xtract BAPI component .
    bapi-input
  10. Open the Xtract BAPI component.
  11. In the tab Tables assign the input data to the table REQUISITION_ITEMS.
    create-purchase-requisition-table-param
  12. Add the tables REQUISITION_ITEMS and RETURN to the output of the Xtract BAPI component.
  13. In the tab Exports add the export parameter NUMBER for the output.
    create-purchase-requisition-export-param
  14. Click [OK] to save the settings.
  15. Select the Xtract BAPI component and activate the option Commit work in SAP after execution.
    BAPI-configuration

The Xtract BAPI component can now be used to create purchase requisitions in SAP.

Load Purchase Requisition Data from SAP

Follow the steps below to create a batch macro that loads the SAP purchase requisition data of any given purchase requisition number:

  1. Create a new workflow.
  2. Drag & drop the Xtract BAPI component into your Alteryx workflow .
    xfa_create_odp_extraction_01
  3. Select an SAP connection . If no SAP connection is available, create a new connection, see Documentation: SAP Connection.
  4. Click [Edit] to open the main window of the Xtract BAPI component.
  5. In the main window of the component click . The window “Function Module Lookup” opens.
    BAPI-empty
  6. In the field Function Name enter the name of the BAPI BAPI_REQUISITION_GETDETAILS. Use wildcards (*), if needed.
    load-purchase-requisition-lookup
  7. Click and select the BAPI BAPI_REQUISITION_GETDETAILS from the displayed list.
  8. Click [OK]. The window "Function Module Lookup" closes.
  9. In the main window of the component click [Edit Parameters]. The window "Edit Runtime Parameters" opens.
  10. Click [Add Scalar] to define a new input parameter for the Xtract BAPI component. The depicted example uses a string parameter Req_Number to represent the purchase requisition number.
    load-purchase-requisition-runtime-parameter
  11. Click [OK]. The window "Edit Runtime Parameters" closes.
  12. In the Imports tab assign the parameter Req_Number to the import parameter NUMBER.
    load-purchase-requisition-import-param
  13. In the Tables tab add the tables REQUISITION_ITEMS and RETURN to the output of the Xtract BAPI component.
    load-purchase-requisition-table-parameter
  14. Click [OK] to save the settings of the Xtract BAPI component.
  15. Navigate to the Alteryx workflow configuration and set the workflow type to *Batch Macro.
    load-purchase-requisition-import-param
  16. Save the workflow.
  17. Add a Control Parameter tool from the Interface toolbox. Label the parameter Req Number Input.
  18. Connect the Control Parameter tool to the Xtract BAPI component. This creates the Action tool Update Value.
  19. Select the Update Value tool and mark the Xtract BAPI parameter Req_Number in the tree menu Value or Attribute to Update to map the parameters.
    macro-update-value
  20. Add two Macro Output tools from the Interface toolbox to create outputs for the batch macro.
  21. Connect the output of the Xtract BAPI component to the Macro Output tools.
  22. Save the macro.

The batch macro can now be used to load SAP purchase requisition data of any given purchase requisition number.



Last update: September 13, 2024
Written by: Simon Rech, Valerie Schipka