SAP Business One SDK Support

Create all Stored Procedure While Installing Addon


We use so many stored procedure while developing Addon; And most of the time we create this manually in SQL while installing the Addon.

Below is a set of Command whcih can be used in a BAT file, so that the code will read the SQL query from the .sql file and execute the same in Server.

Steps to Do..
1. Create a BAT file and set the command as below with proper password and file patch

     "How to create a BAT file, Open a notepad copy the command and save the notepad with 
      extension .bat "

if not exist "C:\SAPLog" mkdir C:\SAPLog
sqlcmd -S localhost -U sa -P sql@123  -i "E:\sp_Drop.sql" -o "C:\SAPLog\Log.txt"


2. Execute the BAT file in the add-on after company connection.

Log File path in the command will give you the status of the SQL file execution. Or user can create a menu for the file to execute. And can be trigger when ever required.


SAP Patch Release Details

Software Component Version
Patch Level
Planned Availability
SAP Business One 10.0
01 Jan 17, 2020
00 Delivered: Nov 18, 2019. Patch Note: 2842030
SAP Business One 9.3*
13 Feb 21, 2020
12 Dec 6, 2019
11 Delivered: Aug 28, 2019. Patch Note: 2801356
SAP Business One 9.2*
11 Delivered: May 18, 2018. Patch Note: 2547047

Server Commands for SAP B1 HANA

1.To start HANA Database
Logon Linux server with GISADM user id then go to
usr/sap/<sid>/HDB00/
Now in terminal type
./HDB start

2.To check the SLD status
 /etc/init.d/sapb1servertools status


3.To Start the SLD
 /etc/init.d/sapb1servertools start


4.To stop the SLD
 /etc/init.d/sapb1servertools stop

5.To Start the Service layer
 /etc/init.d/b1s start


6.To stop the Service layer
 /etc/init.d/b1s stop

7.Install a RPM package
rpm –ivh packagename.rpm

8.Verify a RPM package was installed
rpm -qa | grep packagename
locate packagename

9.To find a file location
find . -name <file name>

10.To confirm Business One is installed
rpm -q -a | grep B1

11.To remove Business One
rpm -q -a | grep B1 | xargs rpm -e



Menu ID list of SAP B1

The following table lists the business objects that are exposed through the DI API.
Object Name Object ID Description



ID Name
257
&About SAP Business One
272
&Help       
275
&Context Help    F1  
276
H&elp Settings      
512
&File    
514
&Close    
518
&Page Setup      
519
P&rint Preview      
520
Pr&int    Ctrl+P   
523
&Launch Application      
524
Loc&k Screen   
526
Exi&t Ctrl+Q   
768
&Edit    
769
&Undo Ctrl+Z   
770
&Redo Ctrl+Shift+Z   
771
&Cut Ctrl+X   
772
C&opy Ctrl+C   
773
&Paste Ctrl+V   
774
&Delete Del   
775
&Select All   
1024
&Window    
1025
&Cascade    
1026
C&lose All    
1029
M&essages/Alert Overview   
1030
&Main Menu Ctrl+0  
1280
&Data    
1281
&Find Ctrl+F   
1282
&Add Ctrl+A   
1283
&Remove    
1284
&Cancel    
1285
R&estore    
1286
Cl&ose    
1287
&Duplicate Ctrl+D   

Read Excel using SQL


Excel reading is possible only if system is installed with AccessDatabaseEngine(32 or 64bit), and below configuration is done in SQL;

Step 1 : Re-Configure the SQL settings for reading Excel.

 sp_configure 'show advanced options', 1;
 GO
 RECONFIGURE;
 GO
 sp_configure 'Ad Hoc Distributed Queries', 1;
 GO
 RECONFIGURE;
 GO

sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1;
GO
RECONFIGURE;
GO

EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1
GO
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters', 1
GO



Step 2 : Reading Excel

Excel must be inside any of the Drive folder with full permission of system having SQL Installed.

Execute the below query; Were excel is in D:\ExcelUpload folder

SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=D:\ExcelUpload\YourExccelName.xlsx', 'select * from [Sheet1$]')

Reading the SYSTEM Variable in User Data Source string

There are many ways to read the system variable in SAP SDK. But Simplest way is to read directly from data source. based on the Variable ID



 strTotal = PForm.DataSources.UserDataSources.Item("SYS_85").ValueEx;

Remote System Login through VB Code

You can do a remote login using VB or C# code. Only few things is required; Like IP, User Name and Password



Remote Login and Copy File

'''''''''''''''Login To Remote system Share Folder '''''''''''''''''''''''
   Open_Remote_Connection(ServerIP, ServerUser, ServerPass)
                    '''''''''''''''Copy File Share Folder '''''''''''''''''''''''
''' To Copy a file please create a shared folder in the destination system with full access.   
System.IO.File.Copy(strFullFile, ServerPath + strDocentry + "_" + strCardCode.Trim() + ".xls")

Private Sub Open_Remote_Connection(ByVal strComputer As String, ByVal strUserName As String, ByVal strPassword As String)
        Try


            Dim ProcessStartInfo As New System.Diagnostics.ProcessStartInfo
            ProcessStartInfo.FileName = "net"
            ProcessStartInfo.Arguments = "use \\" & strComputer & "\c$ /USER:" & strUserName & " " & strPassword
            ProcessStartInfo.WindowStyle = ProcessWindowStyle.Hidden
            System.Diagnostics.Process.Start(ProcessStartInfo)
            System.Threading.Thread.Sleep(2000)
        Catch ex As Exception

        End Try
    End Sub