biuan SAP® BUSINESS ONE SDK
DTW Business Partners / Business Partner Master Data
API Discount Groups / Add
Add Method

Description

Adds a new data line to the object.

Syntax

Visual Basic
Public Sub Add() 

Remarks

You can use this method to add an empty line to the current object. After the line is added, you can set values to the properties of this line.

Note: When a new object is created, it already contains one data line, so you can set the properties of the first line directly without adding a new line. However, if the object contains more than one line, you must use the Add method.

Example

Adding discounts based on item groups (Visual Basic)
' Get a business partner Dim oBP As SAPbobsCOM.BusinessPartners oBP = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners) oBP.GetByKey("C1") ' Indicate discounts are based on item groups, that is, ' discounts apply to items in the specified groups. ' ' The ObjectEntry property, below, refers to an item group oBP.DiscountBaseObject = SAPbobsCOM.DiscountGroupBaseObjectEnum.dgboItemGroups ' Add discounts oBP.DiscountGroups.ObjectEntry = "100" oBP.DiscountGroups.DiscountPercentage = 10 oBP.DiscountGroups.Add() oBP.DiscountGroups.ObjectEntry = "101" oBP.DiscountGroups.DiscountPercentage = 12 oBP.Update()
Adding discounts based on item properties (Visual Basic)
' Get a business partner Dim oBP As SAPbobsCOM.BusinessPartners oBP = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners) oBP.GetByKey("C1") ' Indicate discounts are based on item properties, that is, ' discounts apply to items with the specified properties. ' ' The ObjectEntry property, below, refers to an item property oBP.DiscountBaseObject = SAPbobsCOM.DiscountGroupBaseObjectEnum.dgboItemProperties ' Indicate that, if an item has more than one property, apply ' the bigger discount oBP.DiscountRelations = SAPbobsCOM.DiscountGroupRelationsEnum.dgrHighestDiscount ' Add discounts oBP.DiscountGroups.ObjectEntry = "1" oBP.DiscountGroups.DiscountPercentage = 20 oBP.DiscountGroups.Add() oBP.DiscountGroups.ObjectEntry = "2" oBP.DiscountGroups.DiscountPercentage = 25 oBP.Update()
Updating/deleting discount (Visual Basic)
Dim oBP As SAPbobsCOM.BusinessPartners Dim oDiscountGroup As SAPbobsCOM.DiscountGroups oBP = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners) oBP.GetByKey("C1") oDiscountGroup = oBP.DiscountGroups oDiscountGroup.SetCurrentLine(0) oDiscountGroup.Delete() oBP.Update()

Example

See Also

Related information


Discount Group Base Object Enum DiscountGroupBaseObjectEnum Enumeration
Types of discount groups.
   Parent: Discount Groups DiscountGroups Object· Table: OSPG


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