cancel
Showing results for 
Search instead for 
Did you mean: 

Create stocktaking using sdk

Former Member
0 Kudos

Hi all,

We are trying to create a stocktaking using the following piece of code but when the system try to save the document (ST.Add), system crashes with message vhost32.exe has stopped working. What is wrong on the following?

        Dim ST As SAPbobsCOM.StockTaking
        ST = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTakings)
        ST.ItemCode = "10001"
        ST.WarehouseCode = "00"
        ST.Counted = 5
        ST.Add()

Accepted Solutions (1)

Accepted Solutions (1)

edy_simon
Active Contributor
0 Kudos

Hi Fedias,

I have similar code running in SBO 882. PL 8 without problem.

Have you try clearing the temp folder / reinstall the DI API ?

What is your SBO Version ?

Regards

Edy

christophe_averous
Active Participant
0 Kudos

Hi,

Do you compile for x86 plateform?

Also

at the end write

if ST.add<>0 then

     msgbox(ocompany.getlasterordescription)

end if

Regards

Christophe

Former Member
0 Kudos

I was referenced on DI 2007. When i changed the reference to 8.82 worked perfectly.

Answers (2)

Answers (2)

Former Member
0 Kudos

excuse me, someone has some example of accounting for stock Sap Bussines one through di api , it does not work right through me and I need to do one of a web service for a android application consuming the service. I have this does not work , I'm using the version 9.10.150 sap PL 05


        Dim oStockTaking As SAPbobsCOM.StockTaking

        ' Dim oRecord As SAPbobsCOM.Recordset

        ' oRecord = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

        'oRecord.DoQuery("SELECT * FROM MyStockTableTbale")

        'oRecord.MoveFirst()

        Dim i As Integer

        '  For i = 0 To oRecord.RecordCount - 1

        oStockTaking = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTakings)

        oStockTaking.ItemCode = TableLines.Rows(0).Item(0) 'oRecord.Fields.Item("ItemCode").Value

        oStockTaking.WarehouseCode = "02"

        oStockTaking.Counted = TableLines.Rows(0).Item(2)

        If oStockTaking.Add() = 0 Then

            MessageBox.Show("Error: " & oCompany.GetLastErrorDescription)

        End If

        '    oRecord.MoveNext()

        '  ReleaseObject(oStockTaking)

        ' Next

        MessageBox.Show("Done Processing")

this is what I have but I Fail

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Carlos,

Better create your own thread, if you have any doubts.

By the way Stock Taking is exposed as a service object. You need to do something like this:

Hope it helps.

Kind regards,

ANKIT CHAUHAN

SAP Business One Global Support

Marshall-Jones
Participant
0 Kudos

I asked support about this also.  Currently they have no plans to opening this up. 

I put an "idea" in at:

https://ideas.sap.com/ct/ct_a_view_idea.bix?c=5E7C8A57-8FB9-4C04-9571-9B61022802BA&idea_id=%7b2AD3B7...

Maybe if we get enough votes they will add it back in.