SAP Business One 9.2 Item Attachment Console Application

Summary

The following console application can be used to import into the SAP Business One Item Master Record one or more attachment records. This console application was written as this particular function is not available via the SAP DTW (Data Transfer Workbench) application.

This application uses a simple csv file as its data source. In essence, the console application reads each line in the file and attempts to add an attachment record and link this attachment to a item master record.

Your file can one or more attachments for a single Item Master record.

Program Requirements

  1. The code is based around Microsoft Visual Studio 2017 Community Edition. You will need this to run the code.
  2. A SAP User Login to run the application. This user MUST have a professional license assigned.
  3. You will need to include the SAPBobsCOM file in your project. This file is found in your SAP Business One Client Folder on your local machine.

Before Running the Application

Before attempting to run this application the following changes are required.

  1. A file Name and File Path.

  1. SAP Login Details

File Contents

  1. The does not require a header record.
  2. The file uses a single comma ,’ as the delimiter. This however can be changed in the code to suit whatever you want to use.

To change the delimiter see the GetFileContent Function

var Fields = LineItem.Split(','); 

File Contents is shown as below. A sample file is included in the source code directory called samplefile.csv

Item Code,File Path, File Name Without Extension, File Extension --------------------------------------------------------------------------- 0000001,\10.61.1.15shareSAPShared-FilesBUKImageswwwHQ,BK16,jpg 

Running the application

If you have installed or have installed visual studio 2017, you just run the application. It will walk through the code and upload item attachments and link these to the Item Master Record.

Here is a Before Attachment Sample Image

Here is an After Attachment Sample Image

 

To view this code online and download please visit my Bitbucket repo

https://bitbucket.org/brendanbell/sap-business-one-item-attachment-loading