cancel
Showing results for 
Search instead for 
Did you mean: 

SAP B1: Issue with create draft-delivery with "Template" BOM item link to a Sales Order

Former Member
0 Kudos

Hi Experts!

I'm trying to create draft-delivery with "Template" BOM item through DI-API.

When I set the BaseLine,BaseEntry,BaseType to the "Line" the components can't be generated!

I have tested the same action with "Sale" BOM and it can work correctly.

First I have a sales order.

The item "testTemplateP" round by black is a "Template" BOM item and the red one "testSalesPnoLot" is "Sale".


Here's my code:


             oCompany.Connect();

            SAPbobsCOM.Documents oDraft = oCompany.GetBusinessObject(BoObjectTypes.oDrafts);

            oDraft.CardCode = "C20000";

            oDraft.DocObjectCodeEx = "15";

            oDraft.DocDueDate = DateTime.Today;

            oDraft.DocNum = 396;

            oDraft.Lines.ItemCode = "testSalesPnoLot";//BOM item 

            oDraft.Lines.Quantity = 1;

            oDraft.Lines.BaseLine = 2;

            oDraft.Lines.BaseEntry = 396;

            oDraft.Lines.BaseType = 17;

            oDraft.Lines.Add();

            oDraft.Lines.ItemCode = "testTemplateP";//BOM item 

            oDraft.Lines.Quantity = 1;

            oDraft.Lines.BaseLine = 0;

            oDraft.Lines.BaseEntry = 396;

            oDraft.Lines.BaseType = 17;

            oDraft.Lines.Add();

           

            if (oDraft.Add() != 0)

                Console.Write("Error : " + oCompany.GetLastErrorDescription());

I'm quite sure the BaseLine,BaseEntry,BaseType  are correct.

And here's the result, the components of "Template" item is missing.

If I do it without BaseLine,BaseEntry,BaseType, the components will be generate correctly.

Could you please help me with it? How can I make the "Template" generate the components with "Base"s?

I'm using SAP B1 9.0 PL 15.

Thank you very much in advance!

Billy

Accepted Solutions (1)

Accepted Solutions (1)

maik_delly
Active Contributor
0 Kudos

Hi Billy,

a template item is different from sales or production item. Items defined in a template are added to the document as seperate items - they are not components.

So you have to ( explicitly ) reference all lines that you want to copy.

regards,

Maik

Former Member
0 Kudos

Hi Maik!

Thank you very much for your reply!

Billy

Answers (0)