Quantcast
Viewing all articles
Browse latest Browse all 3548

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

///////////////////////

  try

            {

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

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

                oATT.Lines.Add();

                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;

                MessageBox.Show(ex.Message);

            }


Viewing all articles
Browse latest Browse all 3548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>