Skip to Content
avatar image
Former Member

Add Items using DI-API

HI All,

How to add an item & its details into the SAP db using DI-API(in vb.net).....can anybody give me the coding pls...

regards,

shangai.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 04, 2008 at 10:24 AM

    Hi Shangai,

    When you install the Business One SDK, you install both the help centre and the samples automatically.

    The help centre can be found in Start->Programs->SAP Business One->SDK->SDK Help Centre. The samples can be found in the same path.

    In the help centre, there are several examples available - for example, I have copy and pasted this from the help centre:

    Sub Add_Item()
    Dim RetVal As Long
        Dim ErrCode As Long
        Dim ErrMsg As String
        Dim vItem As SAPbobsCOM.Items
    
        Set vItem = vCmp.GetBusinessObject(oItems)
        'Set value to mandatory fields:
        vItem.ItemCode = "MyNewItem"
        'Set Value to other fields
        vItem.ItemName = "MyNewItem Name"
        vItem.WhsInfo.WarehouseCode = "01"
        'Adding the Item
        RetVal = vItem.Add
        'Checking the result
        If RetVal <> 0 Then
            vCmp.GetLastError ErrCode, ErrMsg
            MsgBox ErrCode & " " & ErrMsg
        End If
     End Sub

    Additionally, the help centre lists every object, method and property including what values are valid, what fields are Mandatory and covers both UI and DI.

    The samples are a great resource too for learning the ins and outs of the Business One SDK.

    Hope this helps.

    Regards

    Niall

    SAP Business One Forums Team

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 04, 2008 at 03:40 PM

    Hi Experts,

    using DI API iam adding items in item master data...like the below code i want to add the currency,Pricelistcode,pricelist but iam unable to find those properties.....can anybody help me...

     
     vItem.ItemName = "MyNewItem Name"
    

    regards,

    shangai.

    Edited by: shangai Nights on Sep 4, 2008 5:41 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 04, 2008 at 08:01 AM

    Hi shangai,

    This is an example to add an item with DI API :

    Dim RetVal As Long

    Dim ErrCode As Long

    Dim ErrMsg As String

    Dim vItem As SAPbobsCOM.Items

    Set vItem = vCmp.GetBusinessObject(oItems)

    'Set value to mandatory fields:

    vItem.ItemCode = "MyNewItem"

    'Set Value to other fields

    vItem.ItemName = "MyNewItem Name"

    vItem.WhsInfo.WarehouseCode = "01"

    'Adding the Item

    RetVal = vItem.Add

    'Checking the result

    If RetVal <> 0 Then

    vCmp.GetLastError ErrCode, ErrMsg

    MsgBox ErrCode & " " & ErrMsg

    End If

    Regards

    Michael

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 04, 2008 at 08:01 AM

    Hi,

    I guess u could use the following code....

    Dim oitem As SAPbobsCOM.Items
                            oitem = SBO_Appln.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems)
                            oitem.ItemCode = ""
                            oitem.ItemName = ""
                            oitem.ItemType = SAPbobsCOM.ItemTypeEnum.itItems
                            oitem.Add()

    hope it helps..

    Regards,

    Vasu Natari.

    Add comment
    10|10000 characters needed characters exceeded