Sales Blanket Agreement Documents generation by DI
Is it possible to programmatically add entries to Documents table of Sales Blanket Agreement objects.
DIEGO LOTHER replied
For you associate your sales blanket agreement to your sales order you need note some things.
In your sales blanket agreement:
1. Your sales blanket agreement should be with status Approved
In your sales order:
- Your customer must be equals the customer that describe in sales blanket agreement.
- The DocDueDate must be between Start Date and End Date in sales blanket agreement.
- The item that you associate with the sales agreement must be contains in sales blanket agreement.
Now, a sample code with information in hardcode:
Documents order = (SAPbobsCOM.Documents)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);
order.CardCode = "C20000";
order.DocDueDate = DateTime.Now;
order.Lines.ItemCode = "A00001";
order.Lines.Quantity = 3;
order.Lines.AgreementNo = 28;
if (order.Add() != 0)
MessageBox.Show("Order [" + oCompany.GetNewObjectKey() + "] created!");
Hope it helps.