cancel
Showing results for 
Search instead for 
Did you mean: 

Update Inventory Counting Lines Using DI API

Former Member
0 Kudos

Hi All,

I need your help about how to update document lines in inventory counting module using DI API.

I am using SAP 9.1 PL 05, and below is my code snip.

                  

                    ........

                    Dim oCS As CompanyService

                    Dim oICS As InventoryCountingsService

                    Dim oICP As InventoryCountingParams

                    Dim oIC As InventoryCounting

                    Dim oICLS As InventoryCountingLines

                    oCS = oCompany.GetCompanyService

                    oICS = oCS.GetBusinessService(ServiceTypes.InventoryCountingsService)

                    oICP = oICS.GetDataInterface(InventoryCountingsServiceDataInterfaces.icsInventoryCountingParams)

                    oIC = oICS.GetDataInterface(InventoryCountingsServiceDataInterfaces.icsInventoryCounting)

                    oICLS = oIC.InventoryCountingLines

                    oICP.DocumentEntry = dEntry

                    oIC = oICS.Get(oICP)

                    oIC.Reference2 = refvariable

                    oIC.Remarks = remarksvariable

                    For i As Integer = 0 To grid.RowCount - 2

                        oICL.ItemCode = itemvar

                        oICL.ItemDescription = descvar

                        oICL.WarehouseCode = whsvar

                        oICL.CountedQuantity = countvar

                        .......

                        .......

                    Next

                    oICS.Update(oIC)

             MsgBox("Document is successfully updated.", 64, "Information")

This code work fine only for document header, but not effected for document lines.

Anyone have suggestion ?  Thank you for helping

Best Regards,

Ulfah

Accepted Solutions (0)

Answers (1)

Answers (1)

maik_delly
Active Contributor
0 Kudos

Hi Ulfah,

your code is a liite mixed up :


Dim oCS As CompanyService

Dim oICS As InventoryCountingsService

Dim oICP As InventoryCountingParams

Dim oIC As InventoryCounting

Dim oICLS As InventoryCountingLines

oCS = oCompany.GetCompanyService

oICS = oCS.GetBusinessService(ServiceTypes.InventoryCountingsService)

oICP = oICS.GetDataInterface(InventoryCountingsServiceDataInterfaces.icsInventoryCountingParams)

oIC = oICS.GetDataInterface(InventoryCountingsServiceDataInterfaces.icsInventoryCounting)

oIC = oICS.Get(oICP)

oICLS = oIC.InventoryCountingLines

oIC.Reference2 = refvariable

oIC.Remarks = remarksvariable

For i As Integer = 0 To grid.RowCount - 2

    oICL.SetCurrentLine(i);

    oICL.ItemCode = itemvar

    oICL.ItemDescription = descvar

    oICL.WarehouseCode = whsvar

    oICL.CountedQuantity = countvar

    .......

    .......

Next

oICS.Update(oIC)

MsgBox("Document is successfully updated.", 64, "Information")

regards,

Maik

Former Member
0 Kudos

Hi Maik,

Thanks for your reply.

Your code updating, there are not anything missing? OICL haven't yet defined.

I have tried, but there are not SetCurrentLine property in InventoryCountingLine Object.

Have another an idea ? Thank you.

Best Regards,

Ulfah.

maik_delly
Active Contributor
0 Kudos

Sorry, I copied your code : it should be oICLS 

Former Member
0 Kudos

Hi Maik,

Yes, I tried changed it to OICLS but the SetCurrentLine and others properties aren't shown.

(It's just show the method as below picture).

Thank you.

Best Regards,

Ulfah