cancel
Showing results for 
Search instead for 
Did you mean: 

A/R Invoice sort problem

Former Member
0 Kudos

Hi every one

I'm doing an A/R invoice where I've pull some sale orders from de BP, the problem is that the invoice seems to be sorting those sale orders by the number of the documents (ORDR.DocNUM) and I need them to be sort in the order y ctrl+click them in the 'Choose from list window', because i have several columns that need to be sorted in that order and since those are not number columns I cannot simple dbl click the colum to get the sort done

Thanks in advance

enso

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Have you tried to change the sort order of documents in CFL (ctrl-shift-S)?

AFAIK, the order of lines is determined first by the order of documents in the CFL

then by the docline nbr.

If that does not satisfy your requirement then you may

want to consider the following workaround:

- 'steal' one column (or make a UDF) for sorting purposes

- generate a sort value for each line using Formatted Search on that column.

-


Here I'm calculating the sort value using line description

[code]declare @s as varchar(50)

set @s = $[$38.3.0]

if len(@s)=0 SELECT 0

if len(@s)=1 SELECT ascii(substring(@s,1,1))*1000

if len(@s)>1 SELECT ascii(substring(@s,1,1))*1000 + ascii(substring(@s,2,1))[/code]

- doubleclick to sort

HTH

Juha

Former Member
0 Kudos

Hi Juha

Thanks for the reply, teoreticaly your reply solve my problem but there is a detail, the column i need to sort is a UDF Alphanumeric(10) and it contains values like 1/2, 3/4,

5/6 (packages numbers)the problem is that when i sort it it came out like 1, 11/12, 13/14, 2, 20/21

here is an screenshoot http://www.v-motion.net/sap.jpg

is there any possibility that the query in the UDF sort this kind of field correcty?, I tried to change the field type to number but it sent me an error,

thanks in advance

regards

enso

Former Member
0 Kudos

OK, this is a bit more complicated. Check SQL functions like substring, cast & convert to generate a sort value:

1/2 ===> 1

11/12 ===> 11

29/30 ===> 29

31/32 ===> 31

5/6 ===> 5

Sorry I don't have the time&luxury to do this for you right now.

HTH

Juha

Former Member
0 Kudos

Ok thank U very much

You gave me an Idea on how to fix this,

thanks a lot for the help

regards

Message was edited by: Enso Barker

Answers (0)