biuan SAP® BUSINESS ONE SDK
API Approval Requests Service

Description

ApprovalRequestsService is a business object that manages the approval requests process in the SAP Business One environment.

This object enables users to do the following:

  • Get an approval request from the approval process.
  • Get a list of approval requests from the approval process.
  • Get a list of open approval requests from the approval process.
  • Update an approval request within the approval process.
  • Get data interfaces.

Source table: OWDD.

Object Model

Remarks

From the SAP Business One application, you can do the following:

  • Approve draft documents in the Request for Approval window when you are reviewing messages in the Messages/Alert Overview window.
  • Approve draft documents in the Approval Decision Report window when you generate a report of the status of draft documents requiring approval.

Approving draft documents from the Request for Approval window:

  1. Choose Window --> Messages/Alert Overview. The Messages/Alert Overview window appears.
  2. To display the details of the message in the Request for Document Approval area, select the required message.
  3. To open the Request for Approval window, click the link arrow.

  4. In the Decision list, select your decision for the approval request.

  5. Choose the Update button. An internal message is sent to the document originator regarding the approval.

Approving draft documents from the Approval Decision Report window:

  1. Choose Administration --> Approval Procedures --> Approval Decision Report. The Approval Decision Report - Selection Criteria window appears.

  2. To generate the report, choose the required criteria.

  3. Choose the OK button. The Approval Decision Report window appears.

  4. In the Answer column, select your decision for the approval request.

  5. Choose the Update button. An internal message is sent to the document originator regarding the approval.

Example

Getting approval request details and the draft document (C#)
Dim oApprovalRequestsService As ApprovalRequestsService = oCompany.GetCompanyService().GetBusinessService(ServiceTypes.ApprovalRequestsService) Dim oApprovalRequest As ApprovalRequest = oApprovalRequestsService.GetDataInterface(ApprovalRequestsServiceDataInterfaces.arsApprovalRequest) Dim oApprovalRequestParams As ApprovalRequestParams = oApprovalRequestsService.GetDataInterface(ApprovalRequestsServiceDataInterfaces.arsApprovalRequestParams) oApprovalRequestParams.Code = indexNum ' The approval index ' Get approval request details oApprovalRequest = oApprovalRequestsService.GetApprovalRequest(oApprovalRequestParams) txtDocType.Text = oApprovalRequest.ObjectType txtDocNo.Text = oApprovalRequest.ObjectEntry txtUser.Text = oApprovalRequest.OriginatorID.ToString txtCurrStage.Text = oApprovalRequest.CurrentStage txtRemarks.Text = oApprovalRequest.ApprovalRequestLines.Item(0).Remarks ' Get draft document Dim oDraft As Documents = oCompany.GetBusinessObject(BoObjectTypes.oDrafts) If oApprovalRequest.ObjectType = 112 Then oDraft.GetByKey(oApprovalRequest.ObjectEntry) 'Get actual document type. txtRealDocType.Text = oDraft.DocObjectCode End If
Approving a request (C#)
Dim oApprovalRequestsService As ApprovalRequestsService = oCompany.GetCompanyService().GetBusinessService(ServiceTypes.ApprovalRequestsService) Dim oApprovalRequestsParams As ApprovalRequestsParams = oApprovalRequestsService.GetDataInterface(ApprovalRequestsServiceDataInterfaces.arsApprovalRequestsParams) Dim oApprovalRequest As ApprovalRequest = oApprovalRequestsService.GetDataInterface(ApprovalRequestsServiceDataInterfaces.arsApprovalRequest) Dim oApprovalRequestParams As ApprovalRequestParams = oApprovalRequestsService.GetDataInterface(ApprovalRequestsServiceDataInterfaces.arsApprovalRequestParams) 'Get request list oApprovalRequestsParams = oApprovalRequestsService.GetAllApprovalRequestsList() oApprovalRequestParams = oApprovalRequestsParams.Item(oApprovalRequestsParams.Count - 1) 'Approve request oApprovalRequest = oApprovalRequestsService.GetApprovalRequest(oApprovalRequestParams) oApprovalRequest.ApprovalRequestDecisions.Add() oApprovalRequest.ApprovalRequestDecisions.Item(0).Remarks = "Approved" oApprovalRequest.ApprovalRequestDecisions.Item(0).Status = BoApprovalRequestStatusEnum.arsApproved ' Incase we want to approve with another user, uncomment the following 2 lines 'oApprovalRequest.ApprovalRequestDecisions.Item(0).ApproverUserName = B1User 'oApprovalRequest.ApprovalRequestDecisions.Item(0).ApproverPassword = B1Password Try oApprovalRequestsService.UpdateRequest(oApprovalRequest) Catch ex As Exception MessageBox.Show(ex.Message) End Try

See Also

SAP® B1 DI-API C# definition

public class ApprovalRequestsServiceClass : IApprovalRequestsService, ApprovalRequestsService { public extern ApprovalRequestsServiceClass(); public virtual extern ApprovalRequestsParams GetAllApprovalRequestsList(); public virtual extern ApprovalRequest GetApprovalRequest( ApprovalRequestParams pIApprovalRequestParams); public virtual extern ApprovalRequestsParams GetApprovalRequestList(); public virtual extern object GetDataInterface( ApprovalRequestsServiceDataInterfaces enumMSDI); public virtual extern object GetDataInterfaceFromXMLFile( string bstrFileName); public virtual extern object GetDataInterfaceFromXMLString( string bstrXMLString); public virtual extern ApprovalRequestsParams GetOpenApprovalRequestList(); public virtual extern void UpdateRequest( ApprovalRequest pIApprovalRequest); }

Related information


Approval Requests Service Data Interfaces ApprovalRequestsServiceDataInterfaces Enumeration
ApprovalRequestsService data interfaces.
   Parent: Approval Requests Service ApprovalRequestsService Service· Table: OWDD

Approval Request ApprovalRequest Object· Table: OWDD
Represents an approval request. Source table: OWDD.
   Parent: Approval Requests Service ApprovalRequestsService Service· Table: OWDD

Approval Requests Params ApprovalRequestsParams Collection
A collection of ApprovalRequestParams objects.
   Parent: Approval Requests Service ApprovalRequestsService Service· Table: OWDD


SAP® Business One is the trademark(s) or registered trademark(s) of SAP AG in Germany and in several other countries. Icons by Icons8 Contact
This website is not affiliated with, maintained, authorized, endorsed or sponsored by SAP AG or any of its affiliates