Friday, October 16, 2015

SAP - Crystal Report in SAP Business One SDK (.NET)

Hello folks. I'm wondering how you integrate your Crystal Report in your SAP Business One add-on? After of searching on how to do that, we've ended up to create our own style on how we can generate report in our add-on. To do that, you need to install first the Crystal Report, currently we are using Crystal Report 2008 SP3. Too old thou, but its still working. Also, we are using Visual Studio 2005 to create a form that we used in crystal report. I don't know why in Visual Studio 2013 don't have Crystal Report. So what we are doing is, add new form in Visual Studio 2005 and drag the Crystal Report Viewer and copy the .VB file and add it to Visual Studio 2013. After you done that tricks, you may proceed to source code.

  1. In your "SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED" event type and identify the "pval.ItemUID". For example "bt_Print".
  2. Example:
  3. In the "Your code here" you can call your VB.NET form that has the Crystal Report Viewer. 
  4. In "_frmRPaymentSched.vb", you need to import all the necessary DLLs that need by Crystal Report.
  5. For "Form_Load".
    • In the part of "cryRpt.Load(xPath & "\Rpt\App_Payment.rpt")" you need to define the path of the Crystal Report.
That's how we view the crystal report in our add-on. It is just a normal Visual Basic form.

Do you have your alternative solution? You might want to share that to us. :). Please leave comment below.

Monday, October 5, 2015

Creating and Registering add-on package SAP 9.1

Most of the SDK developer of SAP Business One are using 3rd party tool or Installshield to compile their add-on. But in the new version of SAP Business One 9.1, one the highlights for this version is the Enhanced lifecycle management for extension. This is the new light-weight approach for add-on deployment. The benefits of this update are:
  1. Simplified extension development and lifecycle management including add-ons and extreme apps.
  2. Remote control the extension lifecycle management easily without end-user interaction or system administration privilege.
    • Imagine, there's no more hustle in the end user part as they install and uninstall the add-on.
    • You don't need to call any support as the add-on failed to install in the end user part.
  3. Less time to compile the add-on less hustle to deploy the package.
To make sure that you that this things work is that:
  • Check your SLDModel.SLDData database.
    • The Identity Specification for Tasks and TaskProperties tables are set to 'No'
    • If the Identity Specification is set to 'Yes' then you should reinstall your SLD.
    Many user complain that they cannot import their add-on package in the System LandScape(SLD), the reason why is that their SLDModel.SLDData database is not updated. Their SLDModel.SLDData database came from SAP Business One 8.82 below. Though if you upgrade your SLDModel.SLDData database from SAP Business One 8.82 to SAP Business One 9.1 expect the same error as mine "Cannot reserve ID for invalid name 'TaskProperty'". To fix this error, you need to reinstall your SLD and use the SAP Business 9.1 installer.

    So lets get started.
    1. Make sure that the SAP Business One SDK is installed in your machine.
    2. Go to: "C:\Program Files (x86)\SAP\SAP Business One SDK\Tools\ExtensionPackage"
    3. Open "ExtensionPackage.exe"
    Walk through with the ExtensionPackage:

    Basic Information:
    • Extension Name is mandatory, this is your add-on name.
    • Extension Version: your add-on version
    • Extension Provider: you can input your company name
    • Extension Namespace: you can input your company name or your initials
    • Supported Database: choose platform where you deploy your add-on package
    • Contact Data: you can input your company name
    Extension File:
    • In the Open Exe file, browse your add-on exe file.
      • If  your client is using SAP Business One 32-bit then select the SBO 32-Bit Client add-on
      • If  your client is using SAP Business One 64-bit then select the SBO 64-Bit Client add-on
      • If your client is using SAP Business One for HANA then select the App for the version for SAP HANA
    • Select all the necessary files that you need in your package.
      • For example, if your add-on used .srf form.
    Deployment Steps:

    • Select all the necessary library files(DLLs) the you need in your package.
      • If  your client is using SAP Business One 32-bit then select the Register 32-Bit Microsoft COM DLLs
      • If  your client is using SAP Business One 64-bit then select the Register 64-Bit Microsoft COM DLLs
    • Common DLLs that need to include are:
      • Interop.SAPbobsCOM.dll
      • Interop.SAPbobsuiCOM.dll
    • If you created your own library kindly select it.
    SBO Compatibility:
    • Your package is compatible with SAP Business One
      • From - To
        • Example 9.0 to 9.1
    • Honestly, I really don't know how to use this function.
    For the buttons:
    • Export - export your file as .ard file
    • Import - import your .ard file
    • Package - export your file as 1 file (zip) file
      • This package used in the Extension Manager of SLD. 
    If you are done with those simple steps, you may now proceed to import your add-on package to SAP Business One Extension Manager.

    To access the SAP Business One Extension Manager.
    1. Open your SAP Business One Service manager by double clicking it in your notification area.
    2. Select License Manager in Service drop down selection.
    3. Click Settings
    4. Configure Security
      • It will open your default browser. The link looks like: https://<server-name>:30010/ControlCenter/
    5. If you encounter a Certificate error, just click Continue.
    6. Login your SLD credentials. Default username: B1SiteUser
    7. If you are successfully login change the ControlCenter to ExtensionManager
    Importing your package:
    1. In the Extensions tab, kindly click Import button and browse your add-on package.
    2. After you successfully select your add-on package, click Upload.
      • If your received an error "Cannot reserve ID for invalid name 'TaskProperty'". Kindly scroll up this post.
    3. Click Next
    4. If you have parameters in your add-on package you may now put value 
    5. Click Next
    6. Then Finish
    7. Your package is now in the list.
    Company Assignment:

    You can now deploy your extension or add-on package in the specific Company database.
    1. In the Company Assignment tab, click the Company Database in the Company List that you want to assign the add-on package or extension.
    2. Click Assign button, the specify an extension or add-on package.
    3. Click Next
    4. Parameters, click Next
    5. Default Startup mode for each user.
      • You can select Default, Automatic, Manual, Disabled
    6. Click Next
    7. Then Finish
    8. Your package is now in the list for the specific Company Database.
    And you are done. :)

    Feel free to drop comments below. If you are using old school when creating and registering add-on 

    Thursday, October 1, 2015

    Block document(per line) using SBO_SP_TransactionNotification

    Most of our client are in production and service industry that require per document(lines) blocking. However, we've encounter some limitations in SAP Business One on how to block transaction using SBO_SP_TransactionNotification per line. Most of the solutions in are in per document(header). So I decided to study and tweak the SBO_SP_TransactionNotificationSBO_SP_TransactionNotification is a stored procedure is to receive notification on any transaction - in other words to do some validation inSAP Business One and prevent the user from doing an action if the validation condition fails. This stored procedure(SP) is created automatically with each database.This stored procedure is fired whenever operations are performed on business objects like document or master records and User-Defined Objects. For more information about the SBO_SP_TransactionNotification or if you don't know how to use SBO_SP_TransactionNotification you may visit this post from

    Back to our concern, I'll show you on how to achieved that requirements. For example, I want to block all the documents that are in the Item Group of 118 and 120 and also the Customer that has 'CI-' in their code.

     IF (@object_type = '17' AND @transaction_type IN ('A', 'U'))  
               SELECT TOP 1 @LINENUM = b.linenum  
                    FROM ORDR a inner join RDR1 b on a.DocEntry = b.DocEntry  
                    INNER JOIN OITM c on b.itemcode = c.ItemCode  
                              WHERE b.DocEntry = @list_of_cols_val_tab_del and c.ItmsGrpCod in ('118','120') and a.CardCode not like 'CI-%'  
               If NOT @LineNum IS NULL  
                         SET @error = -17  
                         SET @error_message = 'Please select a valid Item Group applicable to your Dealer!'  

    That's it. You can now block any transactions per line in your document. If you have concerns, please comment below.

    Wednesday, September 30, 2015

    Creating and Registering Add-on on SAP B1

    I want to share you a simple tutorial, I noticed that some of our fellow SAP developer straggling on how they create a add-on installer.
    This video demonstrate you on how you create your add-on and deploy it to SAP B1.
    It takes 3mins of your time.

    Thing that you should have.
    1. Visual Studio
    2. You should already installed B1 AddonInstaller(B1DE)
    3. AddOnRegDataGen.exe

    If you have other questions, please don't hesitate to ask.

    If you want to use ExtensionManager, you read this post: Creating and Registering add-on package SAP 9.1