Although SAP provides documentation for preparing requisition import files (like this one), the reality is often more complicated. Different environments come with different configurations—especially when custom fields are involved. Getting everything aligned can quickly become a headache.
What’s more frustrating? There’s no built-in way to export existing Purchase Requisitions (PRs) into CSV format. That means both customers and partners, and even SAP internal teams doing testing, often have to prepare sample files manually.
In this article, I’ll show you how to quickly generate ready-to-import CSV files without the hassle.
Although SAP Ariba doesn’t offer a direct CSV export interface, there is a convenient way to export requisition data to Excel through the UI. In the screenshot below, you’ll notice the “Excel Export” button—this will be our starting point.
Follow the steps below to quickly convert that Excel file into the CSV format required for PR import:
Export the Excel file from the Ariba UI using the Excel Export button.
Open the downloaded file and make sure it's in Edit Mode.
Press Alt + F11 to open the Visual Basic for Applications (VBA) editor.
In the VBA Project pane (usually on the left), right-click your workbook.
Choose Insert > Module.
Copy and paste the VBA code (provided below) into the new module.
Sub ExportSheetsToCSV_WithUTF8AndExtraColumn()
Dim ws As Worksheet
Dim savePath As String
Dim fName As String
Dim csvFullPath As String
Dim lastRow As Long, lastCol As Long
Dim tempWB As Workbook
Dim tempWS As Worksheet
Dim reqNumber As String
Dim fileNum As Integer
Dim rowNum As Long
Dim rowValues As String
Dim i As Long
Application.ScreenUpdating = False
Application.DisplayAlerts = False
' Ask where to save the CSV files
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "Select Folder to Save CSV Files"
If .Show <> -1 Then
MsgBox "No folder selected. Exiting.", vbExclamation
Exit Sub
End If
savePath = .SelectedItems(1) & Application.PathSeparator
End With
' Set the requisition number
reqNumber = "PRXXXXX"
' Loop through each sheet in current workbook
For Each ws In ThisWorkbook.Worksheets
' Copy sheet to temporary workbook
ws.Copy
Set tempWB = ActiveWorkbook
Set tempWS = tempWB.Sheets(1)
' Determine last row and column
With tempWS
lastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
lastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
' Add Requisition_Number header
.Cells(1, lastCol + 1).Value = "Requisition_Number"
' Fill in PRXXXXX
For i = 2 To lastRow
.Cells(i, lastCol + 1).Value = reqNumber
Next i
End With
' Build filename (remove spaces from sheet name)
fName = Replace(ws.Name, " ", "") & ".csv"
csvFullPath = savePath & fName
' Write UTF-8 + CSV to file manually
fileNum = FreeFile
Open csvFullPath For Output As #fileNum
Print #fileNum, "UTF-8" ' first line
For rowNum = 1 To lastRow
rowValues = ""
For i = 1 To lastCol + 1
rowValues = rowValues & """" & Replace(tempWS.Cells(rowNum, i).Text, """", """""") & ""","
Next i
rowValues = Left(rowValues, Len(rowValues) - 1) ' remove trailing comma
Print #fileNum, rowValues
Next rowNum
Close #fileNum
tempWB.Close SaveChanges:=False
Next ws
Application.ScreenUpdating = True
Application.DisplayAlerts = True
MsgBox "All CSV files exported successfully with UTF-8 and Requisition_Number.", vbInformation
End Sub
Press F5 to run the macro, or click Run, select ExportSheetsToCSV_WithUTF8AndExtraColumn, and run it.
You'll be prompted to choose a folder to save the CSV files—select a location and click OK.
The macro will generate three clean CSV files, fully formatted and ready for PR import.
Head to Core Administration > Data Import/Export, upload the generated CSV files, and start the import.
Once the import completes, go back to the Home page and check My Documents.
Open the latest document—you should see the newly generated requisition ready to go.
Manually preparing CSV files—especially when custom fields and multiple environments are involved—can be time-consuming, error-prone, and frustrating. With this automated approach, what used to take hours of manual editing and guesswork now takes just a few minutes.
Whether you're a partner building test cases, a customer staging data, or an SAP consultant troubleshooting integration scenarios—this tool empowers you to move faster, reduce mistakes, and focus on solving real business problems instead of wrestling with formatting.
I hope this guide saves you time, reduces friction, and makes your daily work just a little easier. If this was helpful, leave a comment and let me know—I'd love to hear how you’re using it!
SAP Ariba Procurement SAP Ariba Buying and Invoicing SAP Ariba solution integration for SAP Business Suite SAP Ariba Central Procurement
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
3 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |