100% found this document useful (1 vote)
77 views9 pages

Creation of Purchase Requisition (BAPI)

The document outlines the configuration and execution process for the 'Creation of Purchase Requisition (BAPI)' project using SAP Build Process Automation. It details prerequisites, capabilities, project execution flow, and modes of execution, along with the necessary steps for setting up and deploying the project. Additionally, it includes information on debugging automation and dependencies required for the project.

Uploaded by

Miguel Sanchez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
77 views9 pages

Creation of Purchase Requisition (BAPI)

The document outlines the configuration and execution process for the 'Creation of Purchase Requisition (BAPI)' project using SAP Build Process Automation. It details prerequisites, capabilities, project execution flow, and modes of execution, along with the necessary steps for setting up and deploying the project. Additionally, it includes information on debugging automation and dependencies required for the project.

Uploaded by

Miguel Sanchez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

PUBLIC

SAP Build Process Automation

Creation of Purchase Requisition (BAPI)


Contents
Change Log ........................................................................................................................ 3
Overview ............................................................................................................................. 4
Prerequisites ................................................................................................................................. 4
Capabilities ................................................................................................................................... 4
Procedure ........................................................................................................................... 5
Project Configuration ...................................................................................................................................... 5
Project Execution Flow ................................................................................................................................... 6
Project Overview.............................................................................................................................................. 7
Release & Deploy Project ............................................................................................................. 8
Modes of Execution ...................................................................................................................... 8
Debugging Automation ................................................................................................................................... 8
Dependencies ............................................................................................................................... 9

2/9
© 2023 SAP SE or an SAP affiliate company. All rights reserved. See Legal Notice on www.sap.com/legal-notice for use terms, disclaimers, disclosures, or restrictions related to SAP Materials for general audiences.
Change Log

Version Date Description


1.0.0 May 19th, 2023 Document created
1.0.1 March 22nd, 2024 Document Updated

© 2023 SAP SE or an SAP affiliate company. All rights reserved. See Legal Notice on www.sap.com/legal-notice for use terms, disclaimers, disclosures, or restrictions related to SAP Materials for general audiences.
Overview
This document provides the information about the configuration & execution of BAPI (Business Application
programming Interface) business project. This project ‘Creation of Purchase Requisition (BAPI)’ is used for
creation of Purchase Requisition through BAPI function execution.

SAP BAPI is a standard interface to the business object models in SAP products. BAPIs are the primary
method through which customer code and third-party applications interact with SAP products. BAPIs wrap the
internal layers of SAP's business object model to ensure that all business logic, validations, and authorization
checks are executed properly when accessing or changing business objects (For more information click here).

This package consists of list of sub automations including Creation of Purchase Requisition-Start, BAPI
Execution & Excel Update. It also includes BAPI action group, data types to handle BAPI inputs & system
details and input excel file. The BAPI Action group is a collection of actions that is responsible for execution of
BAPI functions & return of BAPI response.
The actions from BAPI action group also contains following features.
• The BAPI Action group allows us to execute multiple operations such as set connection, open
connection, execute BAPI, commit transaction & close connection as a single automation activity.
• It provides the data type for BAPI input & BAPI response that contains all the input, output & test
parameters for BAPI function BAPI_PR_CREATE (for Creation of Purchase Requisition).

Prerequisites

- The project template requires SAP Build Process Automation subscription or CPEA contract.
Follow the setup and configuration section.
- The setup of desktop agent can be checked under “Configure Automation Capabilities” section
from the above link.
- Desktop agent version greater than 3.15.23.
- For usage of BAPI methods in an automation please check the prerequisites here.
- Configure SAP connection (SSO or Basic based on your requirement). For more information
you can check following links:
o BAPI Connection System
o Best Practices for SAP BAPI Activities

Capabilities

This automation consists of following capabilities.


• This project has the capability of reading input excel file & converting the data into BAPI input
data format.
• This project can establish connection to the SAP system, executes the BAPI function with the
use of BAPI action group.
• It can read the BAPI response & update the required response data to the output excel file.

© 2023 SAP SE or an SAP affiliate company. All rights reserved. See Legal Notice on www.sap.com/legal-notice for use terms, disclaimers, disclosures, or restrictions related to SAP Materials for general audiences.
Name Description
BAPI function name: This is the BAPI function module that gets executed to create Purchase
BAPI_PR_CREATE Requisition.

Business project name: This is used for creation of Purchase Requisition based on the input
Creation of Purchase data provided in input configuration file.
Requisition (BAPI)

Procedure

Followings provides the project setup & configuration details along with project features & execution details:

Project Configuration

Following steps can be followed for the setup of business project:

• Navigate to the Store in your SAP build process automation application.


• In the Search bar, type “Creation of Purchase Requisition (BAPI)”.
• Click “Create from Template” button to create the new project that will be available in the lobby.
• After successful project creation, project will be opened.
• Download the input configuration file configBAPI_PR.xlsx from the business project.
• Input configuration file contains information like system details, BAPI info, input parameters
(PRHEADER, PRHEADERX, PRITEM, PRITEMX) & output parameters (RETURN, NUMBER) details:
- System details sheet contains information like system id, app server, instance number, client
and SNC.
- BAPI Info sheet contains information like function module, Import, table & export details.
Notes:
- Provided input excel file contains test data & must be updated with new data as per the
requirement.
- Error sheet must be provided as the last sheet in the input excel file to capture any execution
error.
- Input parameters needs to be provided in the same format as in sample input excel file (With
first row as property name for which you can refer to the action group
createPurchaseRequisition in the automation package, second row must be the description
(or NA) & data values need to be provided in subsequent rows).
- Make sure to add input excel path in the input Parameter while creating automation trigger for
deployed package (For more info check section: ‘Modes of Execution’)

© 2023 SAP SE or an SAP affiliate company. All rights reserved. See Legal Notice on www.sap.com/legal-notice for use terms, disclaimers, disclosures, or restrictions related to SAP Materials for general audiences.
Project Execution Flow

Creation of Purchase Requisition - Start

START

Reads system & BAPI info details from input


excel file & supports data in cloud factory

Missing Mandatory System Details?

No Yes

Reads values from all the input sheets (PRHEADER,


PRHEADERX, PRITEMS, PRITEMX) of excel file & supports
data in cloud factory for further execution

Loops through BAPI input data till loop Loop Counter > max. sequence
counter is less than max. sequence number

Creates BAPI data from input values


provided in the input excel file

Executes sub automation ‘BAPI Execution’ which utilizes


action group for execution of BAPI function

Yes Update Error message in


error Caught?
‘Error’ sheet of output excel
Loops though BAPI OUT parameters No
as provided in input excel No more output parameter to iterate Log error
message

Yes No

Parameter type is ‘Table’?

Stop

Loops through returned


array of Tables property &
set values in rows of that Update retuned value of
parameter sheet in output exports property
excel (NUMBER) in the
(es. ‘RETURN’ parameter parameter sheet in output
in response) excel

End

© 2023 SAP SE or an SAP affiliate company. All rights reserved. See Legal Notice on www.sap.com/legal-notice for use terms, disclaimers, disclosures, or restrictions related to SAP Materials for general audiences.
Project Overview

• The project execution starts with the sub automation ‘Creation of Purchase Requisition - Start’.
• Automation reads the input file for the system data & BAPI info data from input excel file & supports
the obtained data in project for further execution.
• Automation performs the check for mandatory system details.
Mandatory System Details missing:
- Logs error message about missing system details.
- Automation stops the execution.

Mandatory System Details provided:


- Automation continues with execution.

• Automation loops through BAPI input sheets (PRHEADER, PRHEADERX, PRITEMS, PRITEMX) &
reads the required data & supports it for further execution.
• Automation loops through BAPI input data for all the sequence number as provided in input excel:
- Automation utilizes BAPI input data variable created through action group for BAPI execution
& updates its values with provided input data.
- Sub automation ‘BAPI Execution’ is called that performs actual BAPI execution via action
group functionality.
- Action group of ‘BAPI Execution’ sub automation establishes the connection to SAP system,
executes the BAPI function (i.e., BAPI_PR_CREATE), commits the BAPI transaction, closes
the SAP connection & finally returns the BAPI response.
- For any exception/error during the BAPI execution, automation performs followings or else it
continues with further execution:

Execution Error:
- Automation catches the error & logs the error message.
- Automation updates the error message in the ‘Error’ sheet of the output excel file.
- Automations stops the execution.

- Automation loops through BAPI output parameters (RETURN, NUMBER) as provided in BAPI
Info sheet of input excel file:
- Automation checks if output parameter is of type ‘Tables’ or not.
- If property is a Table, automation loop through the array values of the property &
updates the rows of the output sheet (‘RETURN’ sheet of the output excel) with the
values.
- If property is not a Table (i.e., it’s an Exports property), automation updates the output
sheet with the property values. (Here ‘NUMBER sheet of output excel file is updated
with NUMBER value from the BAPI response).

- Automation increments the loop counter for next sequence number & continues with the
execution.

• Finally, automation ends with completion of execution.

© 2023 SAP SE or an SAP affiliate company. All rights reserved. See Legal Notice on www.sap.com/legal-notice for use terms, disclaimers, disclosures, or restrictions related to SAP Materials for general audiences.
Release & Deploy Project

The project must be released and deployed for the usage.


• For information on project release click here.
• For information on project deployment click here.
Note: During project deployment you can select the default environment “public” or might create your
environment (For more information check here).

Modes of Execution

Once you have your project deployed successfully, you will have following two options to trigger the
automation bot:
- Standard/Unattended execution:
Unattended execution of the project can be created by selecting scheduled option during the
automation trigger & providing required scheduling information.
- Attended execution:
The package has a project pane with a menu item for triggering attended execution. Attended
execution can be created by selecting attended option during automation trigger & your automation
will be available as menu item within the agent menu in the system.

- Automation “Creation of Purchase Requisition – Start” starts the execution of project which requires
path of the input excel file that must be provided by clicking “Input parameter” while creating the
automation trigger.

- Please click here to create the automation trigger

Debugging Automation

Automations can be tested in the automation editor & its debugging feature can be utilized to test your
automation flow & data values.

For detailed information please check here.

© 2023 SAP SE or an SAP affiliate company. All rights reserved. See Legal Notice on www.sap.com/legal-notice for use terms, disclaimers, disclosures, or restrictions related to SAP Materials for general audiences.
Dependencies

The table below details the versions used to generate the mentioned automation bot.

Component Version

Desktop Agent 3.15.23

Factory/Tenant 2304.04

SDK Core 1.36.29

SDK Excel 1.36.29

SDK BAPI 1.36.29

Application Version

Saplogon.exe Release 800

Microsoft Excel Version 2102

© 2023 SAP SE or an SAP affiliate company. All rights reserved. See Legal Notice on www.sap.com/legal-notice for use terms, disclaimers, disclosures, or restrictions related to SAP Materials for general audiences.

You might also like