Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Add Attachment to Delivery Note By DI API

Hello Experts

can i add attachment to delivery note or sale order by DI api

i did code for that but it giving error for Delivery not object but it working fine for activity object

This is My code




                SAPbobsCOM.Attachments2 oATT = LoginForm.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oAttachments2) as SAPbobsCOM.Attachments2;

                string FileName = "C:\\Test\\MyTest.txt";


                oATT.Lines.FileName = System.IO.Path.GetFileNameWithoutExtension(FileName);

                oATT.Lines.FileExtension = System.IO.Path.GetExtension(FileName).Substring(1);

                oATT.Lines.SourcePath = System.IO.Path.GetDirectoryName(FileName);

                oATT.Lines.Override = SAPbobsCOM.BoYesNoEnum.tYES;

                SAPbobsCOM.Contacts ACT;

                SAPbobsCOM.Documents oSO;

                SAPbobsCOM.Documents odelivery;

                 //// SAPbobsCOM.SalesOpportunities oactivity;

                oSO = (SAPbobsCOM.Documents)LoginForm.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);

                odelivery = (SAPbobsCOM.Documents)LoginForm.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDeliveryNotes);

                                ACT = (SAPbobsCOM.Contacts)LoginForm.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oContacts);

                int iAttEntry = -1;

                if (oATT.Add() == 0)


                    iAttEntry = int.Parse(LoginForm.oCompany.GetNewObjectKey());

                    //Assign the attachment to the GR object (GR is my SAPbobsCOM.Documents object) 

                    odelivery.AttachmentEntry = iAttEntry;



            catch (Exception ex)


                // c = false;



Former Member

Hi Vilas,

Follow this:

How do I create or copy an attatchment to Sales... | SCN

Hope that helps.

Thanks & Regards


SAP Business One Global Support

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question