Splitting one sales line into multiple g/l lines

I have a problem that I hope someone here know the answer to. I must be able to split one Sales Line into multiple G/L Entries. The setup is that some lines automatically must split when posted into multiple entries where the only difference is some of the dimension values are different. You can basically say that it’s a simplified allocation setup. For each line it must be possible to enter a split percentage, i.e. DIM1 = 40%, DIM2 = 10%, DIM3 = 50%. I’ve been looking at doing the change from CODEUNIT 80 from the function FillInvPostingBuffer before calling UpdInvPostingBuffer. I’ve inserted a new function to manage the split up and then call UpdInvPostingBuffer from this function multiple times. That works fine for that sake, but I’m getting the well know in-consistency error. My guess is that it will not accept the roundings of the VAT amounts when posting the General Journal Lines. Have anyone done this or have you another suggestion to how to do this?

Hi Erik, i have done this a few days ago. I made the spit by filling Records SalesLine and SalesLineACY and then calling FillInvPostingBuffer for each part of the split. I have two record SalesLineRemainder and SalesLineACYRemainder which i filled first with the original SalesLine and SalesLineACY and from which i subtract the Amounts of each split. At the last split i add the Remainder-Amounts, so i have no problems with in-consistency error. The relevant amount-fields in SalesLine are: - Amount - Amount including VAT - VAT Difference - Inv. Discount Amount - Line Discount Amount br Josef Metz

I considered this solution also. But as far as I see then you might end up with lines where the VAT is rounded differently from the original giving another total of VAT from the invoice that was printed and sent to the customer. Or are you physically inserting the new and split up lines as new sales invoice lines? This of course would solve it, but would not be acceptable by my customer. The added dimemsions does not add any value to their customers, so it should not print/show on their invoice.

I think there is no need to inserting new sales invoice lines. The Remainder-functionality leads to InvPostingBuffer entries that added the same amounts as a original InvPostingBuffer entries. The only inexactness is tha i use allways the last split. br Josef Metz

Are you splitting it into lines of same size?

Normaly CU 80 calls FillInvPostingBuffer once for each SalesLine to invoice with paramters SalesLine (Amounts in LCY) and SalesLineACY (Amounts in ACY). What i do is: - take the original SalesLine and SalesLineACY and save them in two extra record and in two remainder Records - for each split do - copy saved original SalesLine and SalesLineACY - divide the amounts in SalesLine and SalesLineACY to desired values and set the desired posting groups (in your case dimensions) - subtract this amounts from remainder records - call funtion FillInvPostingBuffer - at the last split check amounts in remainder record, if not 0, add these amounts br Josef Metz

Don’t you need a OrginalSalesLine and OrginalSalesLineACY to manage this?