📚 SAP Business One SDK Help

Remove Method
See Also  Example

Description

Deletes a record from the object table.

Syntax

Visual Basic
Public Function Remove() As Long

Return Type

Returns a result value that indicates success or failure. If the method succeeds, it returns 0. Otherwise, it returns an error code.

You can retrieve the last error code and its description using the method GetLastError.

Remarks

You cannot delete a price list if it is:

  • The base price list of another price list.
  • Associated with a business partner.
  • Associated with a product tree (ProductTrees) record.
  • Associated with a payment term type (PaymentTermsTypes) record.

You must use the GetByKey method to retrieve a valid object.

Example

Removing a price list (C#)Copy Code
// Get price lists object 
SAPbobsCOM.PriceLists oPriceLists; 
oPriceLists = (SAPbobsCOM.PriceLists)(MainModule.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPriceLists)); 
             
// Get a price list 
if (oPriceLists.GetByKey("5") == true) 

    // If the price list exists, remove it 
    oPriceLists.Remove(); 


Example

See Also