2006 Jan 14 1:20 PM
Hai..
i want to display salesgroup(vkgrp) and description(bezei)in my alv output as one column.
Also it should be sorted such that the 1st character=3rd character in the values of salesgroup.
eg:- 10C-Salesgroup1
12D-Salesgroup2
15E-Salesgroup3
12C-Salesgroup4
Here in this example ...10C and 12C should be sorted, and it should be outputed.
Hai..
i want to display salesgroup(vkgrp) and description(bezei)in my alv output as one column.
Also it should be sorted such that the 1st character=3rd character in the values of salesgroup.
eg:- 10C-Salesgroup1
12D-Salesgroup2
15E-Salesgroup3
12C-Salesgroup4
Here in this example ...10C and 12C should be sorted, and it should be outputed.
2006 Jan 14 1:40 PM
Hi Hari,
You can use the following logic to sort VKGRP first & then concatenate the descrition before moving it ot the ALV table for display.
report zalvsort.
data: begin of itab1 occurs 0,
vkgrp type vkgrp,
end of itab1.
data: begin of itab2 occurs 0,
fld1,
fld2,
fld3,
end of itab2.
itab1-vkgrp = '10C'.
append itab1.
itab1-vkgrp = '12D'.
append itab1.
itab1-vkgrp = '15E'.
append itab1.
itab1-vkgrp = '12C'.
append itab1.
loop at itab1.
itab2-fld1 = itab1-vkgrp(1).
itab2-fld2 = itab1-vkgrp+1(1).
itab2-fld3 = itab1-vkgrp+2(1).
append itab2.
endloop.
sort itab2 by fld1 fld3.
loop at itab2.
write:/ itab2-fld1,itab2-fld2,itab2-fld3.
endloop.
Regards,
Suresh Datti
2006 Jan 14 1:57 PM
Hai suresh..
those are the entries in the table..
I just given the example.
can u give ex. using ALV.
Sorting should be done thru 1st char of sales group equal to 3rd char of sales group.
2006 Jan 14 1:50 PM
data:begin of it_final occurs 0,
vkgrp like ztab-vkgrp,
bezei like ztab-bezei,
sort(2),
<b>combined(35),</b>,
end of it_final.
*these 2 fields should not be displayed in alv,only the cmbined field should be displayed
it_fieldcat-fieldname = 'VTREG'.
it_fieldcat-tech = 'X'.
append it_fieldcat.
it_fieldcat-fieldname = 'BEZEI'.
it_fieldcat-tech = 'X'.
append it_fieldcat.
it_fieldcat-fieldname = 'SORT'.
it_fieldcat-no_out = 'X'.
append it_fieldcat.
loop at it_final.
concatenate it_final-vkgrp it_final-bezei into it_combined separated by '-'.
concatenate it_final-vkprg0(1) it_final-vkprg2(1) into it_final-sort.
modify it_final index sy-tabix.
endloop.
sort it_final by sort.
Message was edited by: chandrasekhar jagarlamudi
2006 Jan 14 2:05 PM
Hai chandrasekhar..
in your logic..Can u plz tell me what actually these are mean
it_fieldcat-tech ?
it_fieldcat-no_out ?
2006 Jan 14 2:11 PM
it_fieldcat-tech = 'X'
If this field is set, the relevant field is not displayed on the list and cannot be shown interactively. The field is only known in the field catalog. (For example, it must not be specified as a sorting criterion).
it_fieldcat-no_out = 'X'
If you set this field, you hide the relevant column in the list. Nevertheless, the column is available in the field selection and can be interactively selected by the user as a display field. The ALV displays the contents of hidden fields on the detail screen for a row in the grid
2006 Jan 14 2:35 PM
Thnx chandrasekhar.
I need this column to be sorted when the first character is equal to the third character of vkgrp.
In my report..it is not like that.
This is from TVKGR table(VKGRP and BEZEI).
plz give me select query as well.
2006 Jan 14 2:41 PM
pls clarify on 2 things
1. what is that first character ??
give an example what do u mean by first char = third char
2.from which table u want to get the field BEZEI
Message was edited by: chandrasekhar jagarlamudi
2006 Jan 14 2:45 PM
Hi Chandrasekhar,
I think hee needs the sort oder to be like the code I posted earlier.. but the sorting to be done on the ALV..
may be a combination of what you & I posted will do the trick for him...
Suresh
2006 Jan 14 2:47 PM
1) I hav entries for vkgrp in the table tvkgr as
10C, 10D, 10F, 20R, 12C...
In this...10C and 12C are sorted because first character = 3rd character.
2)BEZEI is the description for the salesgroup(VKGRP).
I am picking salesgroup from TVKGR table.
In the TVKGR ., if i see the table entries., there we can find salesgroup and description values.
Actually these details are my first secondarylist details..I am also facing problem when i cllick on basic list...the corresponding details of this records are should displayed.
2006 Jan 14 2:53 PM
do u mean first char of 10C = first char of 12C and
third char of 10C = third char of 12C
and sorting in the sense do u want to populate it_sort table in REUSE_ALV_LIST_DISPLAY or
just sort itab by fld1
Message was edited by: chandrasekhar jagarlamudi
2006 Jan 14 3:01 PM
yes..sorting should be done as u said.and in grid display.
reuse_alv_grid_display.