Inserting Additional text line in Combine Shipments through event subscription

mfhmfh Member Posts: 28
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?


mwwoknk0w9eb.png
Regards,
Michiel

Answers

  • SanderDkSanderDk Member Posts: 502
    Try finding the first line and divide the line no with 2 and use that as you line no :smile:
    For help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.
  • mfhmfh Member Posts: 28
    Hi Sander,

    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:

    4skopcx53fne.png

    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?
    Regards,
    Michiel
Sign In or Register to comment.