Skip to Content
0
Former Member
Mar 26, 2015 at 09:48 AM

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

189 Views

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

Attachments

Untitled.png (25.5 kB)
1.png (26.2 kB)