Wiki

Scale Your Enterprise

User Tools

Site Tools

mbstring extension must be loaded in order to run mPDF

bw2:sending_data_to_the_service_layer

Working with the Service Layer

Transactions sent to the Service Layer for SAP Business One use a JSON data structure. The structures must be structured specifically as the Service Layer expects them to be. The DataBuilder tool is used to create these structures. Information on the DataBuilder tool is found here Introduction to DataBuilder.

In addition, some values must be sent as enumerators. These are specific values that represent other values in the SAP Business One database. A listing of common enumerators is found here SAP Business One Enumerators.

Samples of the JSON structures for key SAP Business One objects can be found in the links below. Data is sent to the Service Layer for SAP Business One using a web service call. This call sends the data to the Service Layer API in a JSON data structure.

JSON Samples

These samples are provided as a way to help understand the structure of the various SAP Business One objects. They are correct at the time they were created but you should always verify them with your version of SAP Business One.

To find further information, open a web browser and enter this will open the API reference for Service Layer.

 https://<YourServer>.<YourDomain>.com:50000/vs/b1

Sales Order

Sales Delivery

Sales Invoice

Business Partner

Purchase Order

Attachments

Sending attachments through Service Layer is generally done in conjunction with another SAP method such as Purchase Orders. Using the Versago Temples provided here a user can call a Bizweaver workflow to add an attachment. In the provided workflow below it will be used specifically with Purchase Orders Versago Template. The attached workflow was exported in Bizweaver version 2.6.10 if imported to an older instance there is not a guarantee that it will import successfully.

sap_sl_attachments.zip

Setting Update Attachment Tables and Connections

An SAP Service Layer connection is necessary for this configuration to work.

Using the below scripts set up the tables in the desired database that Bizweaver can connect to. These tables need to be setup before importing the Bizweaver workflow.

CREATE TABLE [dbo].[vgo_SBO_PurchaseRequest_Attachments](
	[RecNum] [int] IDENTITY(1,1) NOT NULL,
	[vgoRecNum] [int] NOT NULL,
	[FileLocation] [nvarchar](500) NULL,
	[FilePath] [nvarchar](50) NULL,
	[FileName] [nvarchar](200) NULL,
	[FileType] [nvarchar](20) NULL,
	[AttachmentCreateStatus] [nvarchar](1) NULL,
	[AttachmentCreateDate] [datetime] NULL,
	[AttachmentCreateError] [nvarchar](500) NULL,
	[AttachmentAddPRStatus] [nvarchar](1) NULL,
	[AttachmentAddPRDate] [datetime] NULL,
	[AttachmentAddPRError] [nvarchar](500) NULL,
	[AtcEntry] [int] NULL, 
CONSTRAINT [PK_vgo_SBO_PurchaseRequests_Attachments] PRIMARY KEY CLUSTERED 
(
	[RecNum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
CREATE TABLE [dbo].[vGo_SBO_PurchaseRequest_Dtl](
	[vgoRecNum] [int] NULL,
	[vgoLineNum] [int] NULL,
	[ItemCode] [nvarchar](50) NULL,
	[ItemName] [nvarchar](100) NULL,
	[CatalogNo] [nvarchar](20) NULL,
	[Quantity] [decimal](18, 0) NULL,
	[Info_GrossPrice] [decimal](18, 6) NULL,
	[Info_DiscPct] [decimal](18, 2) NULL,
	[Info_NetPrice] [decimal](18, 6) NULL,
	[Info_LineTotal] [decimal](18, 6) NULL,
	[LineText] [nvarchar](250) NULL,
	[SlpName] [nvarchar](50) NULL,
	[WhsName] [nvarchar](50) NULL,
	[UoMCode] [nvarchar](20) NULL,
	[NeedDate] [date] NULL,
	[AcctCode] [nvarchar](15) NULL,
	[AccName] [nvarchar](100) NULL,
	[FormatCode] [nvarchar](250) NULL,
	[ProjectName] [nvarchar](50) NULL,
	[zWhsCode] [nvarchar](8) NULL,
	[zUoMEntry] [int] NULL,
	[zSlpCode] [int] NULL,
	[zPriceList] [int] NULL,
	[PQT_VendorName] [nvarchar](100) NULL,
	[zPQT_VendorCode] [nvarchar](50) NULL,
	[zProjectcode] [nvarchar](20) NULL,
	[TrnspName] [nvarchar](50) NULL,
	[TrnspCode] [int] NULL,
	[PriceStatus] [nvarchar](15) NULL,
	[POCreation_SAPDocEntry] [int] NULL,
	[POCreation_SAPDocNum] [int] NULL,
	[POCreation_SAPErrMsg] [nvarchar](200) NULL,
	[POCreation_PostingStatus] [int] NULL,
	[POCreation_PostingDate] [datetime] NULL,
	[ItemLink] [nvarchar](200) NULL
) ON [PRIMARY]
CREATE TABLE [dbo].[vGo_SBO_PurchaseRequest_Hdr](
	[vgoRecNum] [int] NOT NULL,
	[vgoDocStatus] [nvarchar](20) NULL,
	[vgoApprovalStatus] [nvarchar](10) NULL,
	[OrderType] [int] NULL,
	[NumAtCard] [nvarchar](50) NULL,
	[DocDate] [date] NULL,
	[DocDueDate] [date] NULL,
	[ValidUntilDate] [date] NULL,
	[Comments] [nvarchar](max) NULL,
	[DocTotal] [decimal](18, 0) NULL,
	[ShipToLoc] [nvarchar](100) NULL,
	[ShipViaName] [nvarchar](50) NULL,
	[ProjectName] [nvarchar](50) NULL,
	[BPLName] [nvarchar](100) NULL,
	[OwnerName] [nvarchar](100) NULL,
	[Currency] [nvarchar](10) NULL,
	[ExchangeRate] [decimal](18, 0) NULL,
	[PriceListName] [nvarchar](50) NULL,
	[zShipToCode] [nvarchar](50) NULL,
	[zTrnspCode] [int] NULL,
	[zProjectCode] [nvarchar](20) NULL,
	[zBplId] [nvarchar](50) NULL,
	[zOwnerCode] [int] NULL,
	[zPriceList] [int] NULL,
	[vgoCreateDate] [date] NULL,
	[vgoCreatedBy] [nvarchar](50) NULL,
	[vgoCreatedById] [int] NULL,
	[SAPDocNum] [int] NULL,
	[SAPDocEntry] [int] NULL,
	[SAP_ErrMsg] [nvarchar](200) NULL,
	[vgoPostingStatus] [int] NULL,
	[vgoPostingDate] [datetime] NULL,
	[PQT_EmpUserName] [nvarchar](50) NULL,
	[zPQT_EmpUserCode] [int] NULL,
	[PQT_BranchName] [nvarchar](50) NULL,
	[zPQT_BranchCode] [int] NULL,
	[PQT_DeptName] [nvarchar](50) NULL,
	[zPQT_DeptCode] [int] NULL,
	[PQT_RequestorEmail] [nvarchar](50) NULL,
	[PQT_ProductTotal] [decimal](18, 0) NULL,
	[PQT_DocTotal] [decimal](18, 6) NULL,
	[zRequestorType] [nvarchar](1) NULL,
	[CurrentLevelApprovalsTotal] [int] NULL,
	[CurrentOtherApprovalsTotal] [int] NULL,
	[CurrentOtherApprovalAmount1] [int] NULL,
	[CurrentOtherApprovalAmount2] [int] NULL,
	[ApprovalEmailStatus] [nvarchar](10) NULL,
	[ApprovalEmailDate] [datetime] NULL,
 CONSTRAINT [PK_vGo_SBO_PurchaseRequest_Hdr] PRIMARY KEY CLUSTERED 
(
	[vgoRecNum] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
bw2/sending_data_to_the_service_layer.txt · Last modified: 2021/08/09 14:28 by akoehler