cancel
Showing results for 
Search instead for 
Did you mean: 

How to sort a list

Former Member
0 Kudos

Hello,

Im working with the list tile capteam2, i need to get it sorted first by the "Function" field and after that by the "Last Name" field.

I have been looking into some standard code and came across stuff like this:

objCol.Sort "field", "ASC" and ctrlctrlsgrid.sortCol = 1, is this any use to me?

and do i need to put the code in the beforeload event?

Cheers,

Maarten

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Maarten,

Usually you can do that in the BDOC itself, in the segment, in Columns "Sort Order" and "Sort ACS" you would put for SFAKVBEZTP - "1" and for NAME_FIRST - "2", and check "Sort ACS" for both fields. But cince I don't want you to modify standard BDOC ( CAPGEN_OBJECT_WRITE !!! ), will do it with code.

You're on the rigth track.

Do this in BOL:

If Not myCollection Is Nothing Then

With myCollection

.Sort "SFAKVBEZTP", "asc"

.Sort "NAME_FIRST", "asc"

End With

End If

You may need to sort by Long text of SFAKVBEZTP.

Let me know your results.

Regards,

Vadim.

Former Member
0 Kudos

Hello,

i have put the following in the beforeLoad event of capteam2 (im not sure if this is the correct event to put it in)

Dim myCollection As BusinessCollection

Set myCollection = acapteam2DSO.bcol

If Not myCollection Is Nothing Then

With myCollection

.Sort "SFAKVBEZTP", "asc"

.Sort "SFAMITABT", "asc"

End With

End If

but it doesnt seem to work so i must be doin something wrong probably something wrong with how i define myCollection? never done it before

thx alot,

Maarten

Former Member
0 Kudos

Hi,

Try to put this in BOINTBPEMP in the Loaded Event:

Bold code - is the new code you have to add.

If ThisBO.IsNew() Then

ThisBo.Mandt = objUserDataDic.GetData("MANDT")

'Commented By Rashmi to prevent defaulting

'ThisBo.reltyp = "BUR011"

'Inserted 29.10.00 and removed from beforesave

Set mObjOwner = GetBoBp

If not mObjOwner is nothing then

If mObjOwner.COLBOBPSALESTEAM.count = 0 Then

'Commented By Rashmi to avoid defaulting for Partner functions

'Mainc = True

End If

If Kunnr = "" Then

Kunnr = mObjOwner.Kunnr

End if

End If

<b>Else

Set mObjOwner = GetBoBp

If not mObjOwner is nothing then

If mObjOwner.COLBOBPSALESTEAM.count <> 0 Then

With mObjOwner.COLBOBPSALESTEAM

.Sort "SFAKVBEZTP", "asc"

.Sort "SFAMITABT", "asc"

End With

End If</b>

end if

Former Member
0 Kudos

Hello,

I have tried all of the above, without any result. Also, i need to sort on the LONG text of SFAKVBEZTP and SFAMITABT.

Any more idea's?

Thx!,

Maarten