Sorting records in Sales Invoice report on Item code(No. in Sales Invoice Line table)

Hi,

I have made some changes in Sales Invoice report and another thing that I want to change is that records in this report to be sorted on Item code that is “No.” in Sales Invoice line table. I have tried adding keys in Sales invoice Line table(first I added “Document No., No.” as a key and then “No.” and then I chose this key at DataitemTableView property for the sales invoice Line table at sales invoice report but the records weren’t sorted or explained better, this resulted in loss of records when I changed the key from ascending to descending order. Is there any way to solve this or I should try another way(I thought another way was to sort the records in sales invoice at posting (when pressing post button) but I don’t have any idea how this could be done) I haven’ t changed the sorting of tables in Sales Invoice report, I mean the indentation and number of tables. Can anyone help me? Thanx in advance

Hi i’m just a newbie to test my knowledge.

as far as i read… It looks like u ignore the GROUP BY invoice no. in the REPORT. “UNGROUP” that might just solve the problem.

Nothing to do with posting.

(experts… pls check my understanding too :stuck_out_tongue: thanks.)

The Sales Invoice report, and most other document reports, copy all of the values from the lines into a temporary record variable. In this case that is TempSalesInvoiceLine. If you look at the Body sections of the report you’ll notice that they are for SalesInvLine, which is an Integer data item, and not Sales Invoice Line.

You need to find the part of the code that copies the values into the TempSalesInvoiceLine variable and do a SETCURRENTKEY there. That will change the sort order and get you closer to the results you want.

Thanx a lot, I searched for the variable TempSalesInvoiceLine in Sales Invoice report but I didn’t find any variable with this name. I searched in C/AL globals for Sales Invoice report if a variable with this name was declared there. I’m using Nav 2009 version. (is this the same name for this variable in nav 2009?) Help me please!

Thanx again.

Your report may be different in a localized version. I am looking at report 10074 which is an NA object. I would imagine the same concept applies, though, to your version. Don’t look for exactly that variable name. Look at the code and try to understand it.