Changing dimensions on posted sales order lines

Hi guys,

I am making this functionality which is supposed to enable user to change dimensions (financial, NOT inventory) on posted documents such as invoices or payments but I am having problem with updating dimensions on posted invoice (sales order) lines. The problem occurs because I have to update those dimensions throughout the tables which store dimension values for this documents. I have found the solution how to update all the tables but one - LedgerTrans.

Example:

If I have a sales order with 2 lines and I post it. Then I find out that I have to change the dimensions on one of the lines. My functionality is supposed to change the dimensions from the voucher transactions form but what bugs me is that when I select, for example, the transaction which is posting a value in the revenue account for one line I don’t know how to relate the dimension change with the other transactions of the same voucher from Ledgertable which reffer to the same line. Along with that I have to update the corresponding data from TaxTrans and InventTransPosting tables which I also do not know how to accomplish.

Does anybody have any ideas how or if this is actually possible?

Regards

I’m not sure if that’s the case, but wouldn’t making a relation by voucher and transdate be enough?

for example let’s say you have a sales order with an invoice posted - you have to choose a certain invoice (because there may be may) so that you have a cursor of custInvoiceJour

then you choose the proper custTrans:

select custTrans where custTrans.accountNum == custInvoiceJour.orderAccount && custTrans.TransDate == custInvoiceJour.InvoiceDate && custTrans.Invoice == custInvoiceJour.InvoiceId;

and then you browse through the other tables:

while select ledgerTrans where ledgerTrans.voucher == custTrans.voucher && ledgerTrans.transDate == custTrans.transDate
{

}

while select taxTrans where taxTrans.voucher == custTrans && taxTrans.transDate == custTrans.transDate
{

}

I don’t know if that’s the case, if not - please discribe the problem with a little more detail.

Hi Misho,

If Lukens answer helped you then please verify his answer or let’s know what is wrong with his answer.

Thank you.