🔹 Step 2: Write the ExportPOToExcel function
You can either:
- Export the data to a CSV or Excel file using
TempBlob, then upload to SharePoint. - OR, call an Azure Function or API to push the PO data directly.
Example (simplified CSV approach):
local procedure ExportPOToExcel(PurchaseHeader: Record "Purchase Header")
var
TempBlob: Codeunit "Temp Blob";
OutStream: OutStream;
FileContent: Text;
begin
FileContent := 'PO No,Vendor Name,Amount' + Format(13) + Format(10);
FileContent += PurchaseHeader."No." + ',' + PurchaseHeader."Buy-from Vendor Name" + ',' + Format(PurchaseHeader.Amount);
TempBlob.CreateOutStream(OutStream);
OutStream.WriteText(FileContent);
// Optionally send this file to SharePoint or store it somewhere
end;
To upload the file to SharePoint, you can integrate with Microsoft Graph API or use Power Automate triggered by an HTTP call from AL.
🧠 Summary:
- Yes, you can use AL to automatically export PO data on modification.
- It gives you full control over data formatting, export logic, and integration.
- If you’re comfortable in AL, this might be cleaner than managing Power Automate flows.
Mark below checkbox to make this answer Verified if it helps you. ✅


Report
All responses (
Answers (