Hi,
I want to add functionality that inserts the Sales Shipment Header field 'Your Reference' as a text line in the Sales Invoice, before the Sales Shipment Lines are inserted. I am using R295 Combine Shipments or the function 'Get Receipt Lines from the invoice card.
In order to do this without modifying the standard object T111 Sales Shipment Line, I would like to use an event from this table:
OnBeforeInsertInvLineFromShptLineBeforeInsertTextLine
In a CodeUnit, I wrote below code. However, this gives me the error 'Record in Table Sales Line already exists: Line No.=10000.
I guess I'm doing something wrong here (besides not hiring a skilled developer
), but what?
Answers
That's not the solution. Even if I use a "Line No." := 5000, I would receive the same error, but then on line 5000, of course.
But I did found out why I am getting the 'Line No.=10000 already exists' error: the Insert at the end of my code is not necessary, because this is handled by the original code in T111 after having returned from the extension. So I was Inserting a second time on the same record. Without the Insert in my extension, the result is this:
And that's almost what I expected, except for the fact that I am now missing the default 'Shipment No.:' text on the first line. For this particular case this is fine, but I would actually rather have the new text line inserted after the default 'Shipment No.:' line. I guess there should be an Insert of this line before going into the event, but I do not now how to achieve this. Any ideas?
Michiel