cancel
Showing results for 
Search instead for 
Did you mean: 

SetCurrentLine & Lines.Count on a Sales BoM

caviles
Explorer
0 Kudos

I'm trying to update the value of the ProjectCode column in the Invoice just before I add the Document. For that I'm doing a Loop thru the Document Line and set the Project Code . The Problem I'm having is the Item in the Invoice are Sales BoM Items, so SB1 automatically adds the components to the Invoice row below the parent Item. When I try to do a Lines.Count is only counting the Lines for the Parent Items instead of all the lines in the Document , The same happen to the SetCurrentLine(linenumber) . I 'm using that property to check what is the returned value of the Item Code and instead of giving me the components item is returning the next parent Item in the Invoice Lines.

Total Sales BoM Item added to the Invoice is :284 Items

Total Lines after adding the transaction : 1000

Total Lines Documents.Lines.Count return prior to add the document: 284

For some reason those Properties doesn't seem to take into consideration lines added by the application.

Does anyone have an idea why does the SDK only count the lines for the parent Item.

Any Help will be appreciated

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

No Idea, reason could be if you have a sales BOM which build from subset of sales BOM (parent-child), in this case at the end will now the lines count (recursively). Try it, the system always shows the first level in the marketing documents.

But if you have only one projectcode by sales BOM item, i think it could not be a problem. (loop and set up).

Even if you want to set different project codes within 1 sales BOM item, (child-by-child different), I am suggeting the following:

1. Add as draft document

2. Open the draft and now loop and set up the projectcode item-by-item

3. Add draft as normal invoice

4. delete the draft.

It is works.

Regards,

J.

Answers (0)