Welcome Notes

Welcome Viewers

19 March 2018

Transfer Sale order Record to flat file using Integration Framework

Dear All,
    Today ,we will discuss how to Transfer Sale order Record to flat file using Integration Framework.


Scenario : Transfer Sale order Record to flat file
The following record fetched from Sale Order

1)Card Code 2) Card Name 3) Doc Total 4) Doc Currency 5) DocDate 6) DocNum

Step by Step Procedure to Transfer record from SAP Business One to File Format

1) Create Scenario Package
2) Create Scenario Steps
              2.1   Inbound
              2.2   Outbound
              2.3   Processing
3) Create System
4) Test


1) Create Scenrio Package
    Go To Scenario Tab
    Click "Package Design"
    Click  "+" button for Create Scenario Package.
    Enter  Package Name on Scenario package Idetifier.
    Select "No Authentication" Authentication Browse Button.
    Click "Save"icon.
2) Create Scenario Steps
   Go To Scenario Tab
   Click "Scenario Package Design"
    Click  "+" button for Create Scenario Steps.
    Enter  Steps Name on Scenario steps Idetifier.
    Assign Scenario Package in Scenario Package Identifier.
    Click "Save"icon.

 2.1 Create Inbound
    Click "Inbound" Button.
      2.1.1) Create Channel
    Click "Channel" Button.
        Select Inbound Type "SAP Business One"
        Select Process Mode "Asynchronous"
        Select Process Trigger "B1Event"
        Select Identification Method "B1Event"
        Enter Identification Paramter :n.a
        Select Identifier  (In Our case  Select "17")
        Click "Save"icon.
        Click "Close" button.
      2.1.2) Create Retrieval
                  Click "Retrieval" Button.
                        Select "DI API" in Retrieval Adapter.
                        Select "Object" in Retrieval Type.
                        Click "Save"icon.
                Click "Close" button.

  2.2) Outbound
             Click "Outbound" Button.
             Select  "FlatFile" in Outbound Channel.
             Select "file" in Outbound Format.
             Click "Details" button
                  Select Scenario Step identifier
                  Select "dsv" Output Format.
                  Select "Write" in Mode.
                  Select "ISO-8859-1" in Character Encoding (if you want you can change it based on your requirement)
                   Click "Save"icon.
           Click "Close" button.
             Click "Save"icon.
         Click "Close" button. 
  2.3) Processing
             If you have any issue when you press "Processing" button,You can follow below step(s).
                Click "Control" on the Scenarios Page.
                Find your "Package Name"
                Click "Overview" Button.
                you see Integration Framework - Scanrio Overview Screen.
                Click/Double Click "Final Processing step"
                 you see the BixFlow Screen.
                 Click "Final" icon
                 you see "Integration Framework - XML Editor"
                 Paste below XSLT Code under transform tag
                          <Fileout type="file">
<row>
<col>
<xsl:value-of select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role=&apos;S&apos;]/BOM/BO/Documents/row/CardCode"></xsl:value-of>
</col>
<col>
<xsl:value-of select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role=&apos;S&apos;]/BOM/BO/Documents/row/CardName"></xsl:value-of>
</col>
<col>
<xsl:value-of select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role=&apos;S&apos;]/BOM/BO/Documents/row/DocTotal"></xsl:value-of>
</col>
<col>
<xsl:value-of select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role=&apos;S&apos;]/BOM/BO/Documents/row/DocDueDate"></xsl:value-of>
</col>
<col>
<xsl:value-of select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role=&apos;S&apos;]/BOM/BO/Documents/row/DocNum"></xsl:value-of>
</col>

</row>
</Fileout>
                 Click "Save"icon.

3) Create System
      Go To SLD Tab
      Click "Create System"
      Select "F:AnySystem" on the Type
      Enter Name of the System.
      Select "Id" on the ID .
      Enter "output Path" in filePattern FILO
       Eg: D:\SAPB1if\data????.xml
                Do not remove this "\data????.xml" content on the Input Box.
       Click "Test Connection" button.
       Connect to <Name>(FILO) successfully.
       
         Click "Save"icon.       


4) Test
    Open SAP Business One
    Add Sale Order Document
    Go and Check Output Path Folder.
    XML File will created.like this (data0000 and so on)....

15 March 2018

Creating a Resource Master in SAP B1 via SDK

Dear Esteemed Readers,

Today, we embark on a journey through the intricate process of creating a Resource Master within SAP Business One using the Software Development Kit (SDK). Resource Masters form the backbone of efficient management within the SAP B1 ecosystem, enabling seamless tracking and utilization of vital organizational assets.



  Public Function AddResourceMaster(ByVal strVisCode As String, ByVal strResName As String, ByVal strResWarehouse As String) As Boolean
    Dim oCompanyService As SAPbobsCOM.CompanyService = Nothing
    Dim oResourceService As SAPbobsCOM.ResourcesService = Nothing
    Dim oResource As SAPbobsCOM.Resource = Nothing
    Dim oResWhs As SAPbobsCOM.ResourceWarehouse = Nothing
    Dim oResParamters As SAPbobsCOM.ResourceParams = Nothing

    Try
        oCompanyService = oApplication.SAPCompany.GetCompanyService
        oResourceService = oCompanyService.GetBusinessService(SAPbobsCOM.ServiceTypes.ResourcesService)
        oResource = oCompanyService.GetDataInterface(SAPbobsCOM.ResourcesServiceDataInterfaces.rsdiResource)
        
        ' Assign values to Resource properties
        oResource.VisCode = strVisCode
        oResource.Name = strResName
        
        ' Add Resource Warehouse
        oResWhs = oResource.Warehouses.Add
        oResWhs.Warehouse = strResWarehouse
        
        ' Add Resource using Service
        oResParamters = oResourceService.Add(oResource)
        
        Return True
    Catch ex As Exception
        ' Log or handle the exception accordingly
        ' Logging or displaying error messages for debugging purposes
        Return False
    Finally
        ' Properly dispose of resources
        If oResParamters IsNot Nothing Then oResParamters = Nothing
        If oResWhs IsNot Nothing Then oResWhs = Nothing
        If oResource IsNot Nothing Then oResource = Nothing
        If oResourceService IsNot Nothing Then oResourceService = Nothing
        If oCompanyService IsNot Nothing Then oCompanyService = Nothing
    End Try
End Function

Add project through SDK

Dear All,
   Today , We will see, How to Add project through SDK.
Public Function AddProjectIntoSAP(ByVal strPrjCode As Object, ByVal strPrjName As Object, ByVal activeMode As SAPbobsCOM.BoYesNoEnum, ByVal dtVaidateFrom As Date, ByVal dtVaidateTo As Date) As Boolean
        Dim oCmpSrv As SAPbobsCOM.CompanyService = Nothing
        Dim projectService As SAPbobsCOM.IProjectsService = Nothing
        Dim project As SAPbobsCOM.IProject = Nothing
        Dim projectParams As SAPbobsCOM.IProjectParams = Nothing
        oCmpSrv = oApplication.SAPCompany.GetCompanyService
        projectService = oCmpSrv.GetBusinessService(SAPbobsCOM.ServiceTypes.ProjectsService)
        project = projectService.GetDataInterface(SAPbobsCOM.ProjectsServiceDataInterfaces.psProject)
        Try
            projectParams = projectService.GetProjectList()
            project.Code = strPrjCode
            project.Name = strPrjName
            project.Active = activeMode
            project.ValidFrom = dtVaidateFrom
            project.ValidTo = dtVaidateTo
            projectService.AddProject(project)
            Return True
        Catch ex As Exception
            Return False
        Finally
            If oCmpSrv IsNot Nothing Then
                oCmpSrv = Nothing
            End If
            If projectService IsNot Nothing Then
                projectService = Nothing
            End If
            If project IsNot Nothing Then
                project = Nothing
            End If
            If projectParams IsNot Nothing Then
                projectParams = Nothing
            End If
        End Try
    End Function

14 March 2018

Add Menu through SDK

Dear All,
   Today , We will see, How to Add Menu through SDK.



 Public Sub AddMenu(ByVal SBO_Application As SAPbouiCOM.Application, ByVal aFormUid As String, ByVal strUniqueID As String, ByVal Str As String)
        ''********************************************************************
        Dim oMenuItem As SAPbouiCOM.MenuItem = Nothing
        Dim oMenus As SAPbouiCOM.Menus = Nothing
        Dim oCreationPackage As SAPbouiCOM.MenuCreationParams = Nothing
        Dim aForm As SAPbouiCOM.Form = Nothing

        ''********************************************************************
        aForm = SBO_Application.Forms.Item(aFormUid)
        oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
        ''********************************************************************
        Try
            oCreationPackage.Checked = False
            oCreationPackage.Enabled = True
            oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
            oCreationPackage.UniqueID = strUniqueID.Trim
            oCreationPackage.String = Str.Trim
            aForm.Menu.AddEx(oCreationPackage)
        Catch ex As Exception

        Finally
            If oMenuItem IsNot Nothing Then
                oMenuItem = Nothing
            End If
            If oMenus IsNot Nothing Then
                oMenus = Nothing
            End If
            If oCreationPackage IsNot Nothing Then
                oCreationPackage = Nothing
            End If
            If aForm IsNot Nothing Then
                aForm = Nothing
            End If
        End Try
     


    End Sub

13 March 2018

Add Linked Button through SAP Business One SDK- VB.NET

Add Linked Button through SAP Business One SDK- VB.NET

Introduction:

SAP Business One is a powerful enterprise resource planning (ERP) solution that allows businesses to streamline their operations. One of the key strengths of SAP Business One is its extensibility, which enables developers to enhance the user interface (UI) and functionality according to specific business needs.In this blog post, we will focus on a common customization - adding a linked button to a form using the SAP Business One SDK in VB.NET. Linked buttons are a convenient way to integrate custom functionality into the SAP Business One UI, providing users with quick access to specific actions.

Public Sub AddLinkedButton(ByVal objForm As SAPbouiCOM.Form, ByVal ItemUID As String, ByVal SourceID As String, ByVal iLeft As Integer, ByVal iWidth As Integer, ByVal iHeight As Integer, ByVal LinkTo As String, ByVal strLinkedObjectType As String, ByVal strLinkedObject As String)
        Dim oItem As SAPbouiCOM.Item = Nothing
        Try
            If objForm IsNot Nothing Then
                oItem = objForm.Items.Add(ItemUID, SAPbouiCOM.BoFormItemTypes.it_LINKED_BUTTON)
                oItem.Top = objForm.Items.Item(SourceID).Top
                oItem.Left = iLeft + (objForm.Items.Item(SourceID).Left + objForm.Items.Item(SourceID).Width)
                oItem.Width = iWidth
                oItem.Height = iHeight
                oItem.LinkTo = LinkTo
                Dim btn As SAPbouiCOM.LinkedButton = objForm.Items.Item(ItemUID).Specific '' To Assign New Button
                btn.LinkedObjectType = strLinkedObjectType
                btn.LinkedObject = strLinkedObject
            End If
        Catch ex As Exception
        Finally
            If objForm IsNot Nothing Then
                objForm = Nothing
            End If
            If oItem IsNot Nothing Then
                oItem = Nothing
            End If
        End Try
    End Sub

To summarize, adding a linked button in SAP Business One SDK in VB.NET requires specific steps for successful implementation. This enhances functionality and customization in the platform.