In this blog, we will be looking on saving the data into Sage 300 with BlkPut function using COMAPI in C# .Net. Sage 300 has different ways to save the records using code recorded by macro where all the values are assigned to the fields individually using Field Name or Field Index, record saving is also done using BlkPut method.
New Stuff: How to use BlkPut to save data into Sage 300 using COMAPI in VB6.0
The BlkPut method is effective over the conventional way using the Field Name or Field Index as developer has to only specify the values that needs to be saved. Specifying “.Process” becomes irrelevant as it is taken care by the BlkPut itself.
When we write a dynamic import program, the fields may increase or decrease depending on the changes in the business requirement over the period of time. In this case, it becomes very difficult to code it in such a way when the field is assigned and the program needs “.Process” after that line of code. The Indexes and the values can be read from the configuration and the import file respectively.
We will be looking into the steps to create a program of the same with a sample code of OE Order.
Step 1: Include the Sage 300 COMAPI in the project.
Step 2: Once the COMAPI DLL is included, create the object of the Session and initialize it.
Step 3: Create, Open and Compose Sage 300 Views.
Step 4: Saving the data using the conventional way (Creating new Sales Order with 2 line items in our example).
- Init(), RecordCreate() or RecordGenerate() the view.
- Assign the values to the respective Fields individually and Call “.Process()” wherever required.
- Insert or Update the record.
Step 5: Saving the data using BlkPut (Creating new Sales Order with 2 line items in our example).
- Init(), RecordCreate() or RecordGenerate() the view.
- Assign the Field Index and values in an Array object together either by specifying the Array object separately and using it or using new Array object directly in the Parameter of the BlkPut.
- Insert or Update the record.
First parameter of BlkPut is for accepting the field index whose values is to be saved.
Second parameter of BlkPut is an Array object with the values at the same position as that of an Index Array object.
Third parameter is to specify if the verification is required or not.
Developer can include any number of field index in an Array object that are required for performing a particular task.
BlkPut helps the developer to design the program in such a way that no code changes are required if any field is added or removed.
About Us
Greytrix – a globally recognized and one of the oldest Sage Development Partner is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third party add-on development and implementation competence.
Greytrix offers unique GUMU™ integrated solutions of Sage 300 with Sage CRM, Salesforce.com, Dynamics 365 CRM and Magento eCommerce along with Sage 300 Migration from Sage 50 US, Sage 50 CA, Sage PRO, QuickBooks, Sage Business Vision and Sage Business Works. We also offer best-in-class Sage 300 customization and development services and integration services for applications such as POS | WMS | Payroll | Shipping System | Business Intelligence | eCommerce for Sage 300 ERP and for Sage 300c development services we offer, upgrades of older codes and screens to new web screens, latest integrations using sData and web services to Sage business partners, end users and Sage PSG worldwide. Greytrix offers 20+ addons for Sage 300 to enhance productivity such as GreyMatrix, Document Attachment, Document Numbering, Auto-Bank Reconciliation, Purchase Approval System, Three way PO matching, Bill of Lading and VAT for Middle East. The GUMU™ integration for Dynamics 365 CRM – Sage ERP is listed on Microsoft Appsource with easy implementation package.
For more details on Sage 300 and Sage 300c Services, please contact us at accpac@greytrix.com, We will like to hear from you.