Skip to Content

Set default Purchase/Sales UoM Packages type through DI-API for Items

Hi All,


I am trying to add a new Item through DI-API in SAP B1 9.0

The Item is getting added, but Packaging type in Purchase/Sales Tab of Item Masters Data is not showing any value.


My code is:


Dim oDoc As SAPbobsCOM.Items = oCompany.GetBusinessObject(iObjType)

oDoc.ItemCode = "A000001"

oDoc.PurchasePackagingUnit = "Container"

oDoc.PurchaseQtyPerPackUnit = 2

oDoc.Add()


I observed that we need to set a Default Package type in 'Purchasing UoM and Packages types' for the Item.

Can anyone provide me with DIAPI coding for setting default Package type which will affect PkgCodeDft column of ITM12?

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Jul 18, 2016 at 11:08 PM

    Hi,

    I know this topic is a little old, but I wanted to comment this unanswered post.

    Table ITM12 can only be used when working with UoM Groups.

    In this case you should try to assign an UoM Group to the item and then setting the default Packaging unit via UnitOfMeasurements.DefaultPackage.

    It would be something like this: (You need to define the UoM Entry and Group before trying this)

    oDoc.ItemCode = "A000001"

    oDoc.UoMGroupEntry = 1 'Here goes the UoM Group key

    oDoc.UnitOfMeasurements.UoMEntry = 1 'Here goes the UoM key for purchase

    oDoc.UnitOfMeasurements.UoMType = SAPbobsCOM.ItemUoMTypeEnum.iutPurchasing

    oDoc.UnitOfMeasurements.Packages.PackageTypeEntry = 1 'Here goes the entry of the package "Container"

    oDoc.UnitOfMeasurements.Packages.QuantityPerPackage = 2 'The quantity per package

    oDoc.UnitOfMeasurements.DefaultPackage = 1 'Here goes again the entry of the package "Container"

    '....

    oDoc.Add()

    I didn't test this yet but I hope this help can help you.

    Best regards.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.