2006 Oct 04 12:18 PM
Hello all,
I have a ALV grid data similar to the following:
MAterial | Matl type | MRP
-
matnr-01 | type-01 | 100
-
matnr-01 | type-01 | 200
-
matnr-01 | type-01 | 100
-
matnr-02 | type-01 | 100
-
matnr-02 | type-01 | 100
-
matnr-03 | type-02 | 100
-
matnr-04 | type-02 | 100
-
My requirement:
I want the following output.
MAterial | Matl type | MRP
-
matnr-01 | type-01 | 100
| -
| | 200
| -
| | 100
-
matnr-02 | type-01 | 100
| -
| | 100
-
matnr-03 | type-02 | 100
-
matnr-04 | type-02 | 100
-
I DON'T WANT the following output.
MAterial | Matl type | MRP
-
matnr-01 | type-01 | 100
| -
| | 200
| -
| | 100
-
-
matnr-02 | | 100
| -
| | 100
-
matnr-03 | type-02 | 100
-
-
matnr-04 | | 100
-
Thanks in advance,
A.Singh
Hello all,
I have a ALV grid data similar to the following:
MAterial | Matl type | MRP
-
matnr-01 | type-01 | 100
-
matnr-01 | type-01 | 200
-
matnr-01 | type-01 | 100
-
matnr-02 | type-01 | 100
-
matnr-02 | type-01 | 100
-
matnr-03 | type-02 | 100
-
matnr-04 | type-02 | 100
-
My requirement:
I want the following output.
MAterial | Matl type | MRP
-
matnr-01 | type-01 | 100
| -
| | 200
| -
| | 100
-
matnr-02 | type-01 | 100
| -
| | 100
-
matnr-03 | type-02 | 100
-
matnr-04 | type-02 | 100
-
I DON'T WANT the following output.
MAterial | Matl type | MRP
-
matnr-01 | type-01 | 100
| -
| | 200
| -
| | 100
-
-
matnr-02 | | 100
| -
| | 100
-
matnr-03 | type-02 | 100
-
-
matnr-04 | | 100
-
Thanks in advance,
A.Singh
2006 Oct 04 12:20 PM
u can use the sort functionality of ALV
CLEAR LC_SORT.
LC_SORT-FIELDNAME = 'MATNR'.
LC_SORT-UP = 'X'.
APPEND LC_SORT TO IT_SORT.
and pass IT_SORT to FM REUSE_ALV_GRID_DISPLAY
CLEAR LC_SORT.
LC_SORT-FIELDNAME = 'MTART'.
LC_SORT-UP = 'X'.
APPEND LC_SORT TO IT_SORT.
and pass IT_SORT to FM REUSE_ALV_GRID_DISPLAY
2006 Oct 04 12:21 PM
Hello Amarjit,
Sort the ALV with MATNR & MTART.
Use this code:
REFRESH IT_SORT.
CLEAR: G_S_SORT,G_S_SORT.
G_S_SORT-SPOS = 1.
G_S_SORT-FIELDNAME = 'MATNR'.
G_S_SORT-UP = 'X'.
G_S_SORT-DOWN = ' '.
G_S_SORT-SUBTOT = ' '.
G_S_SORT-EXPA = ' '.
APPEND G_S_SORT TO IT_SORT.
CLEAR: G_S_SORT,G_S_SORT.
G_S_SORT-SPOS = 2.
G_S_SORT-FIELDNAME = 'MTART'.
G_S_SORT-UP = 'X'.
G_S_SORT-DOWN = ' '.
G_S_SORT-SUBTOT = ' '.
G_S_SORT-EXPA = ' '.
APPEND G_S_SORT TO IT_SORT.
If useful reward.
Vasanth
2006 Oct 04 12:22 PM
Hi,
Try apssing the sort table in the required sort order..
Eg..
p_sort-spos = '1'.
p_sort-fieldname = 'MATERIAL'.
p_sort-up = 'X'.
APPEND p_sort TO gt_sort.
CLEAR p_sort.
p_sort-spos = '2'.
p_sort-fieldname = 'TYPE'.
APPEND p_sort TO gt_sort.
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
it_toolbar_excluding = gt_excl_func[]
CHANGING
it_outtab = i_final[]
it_fieldcatalog = gt_fieldcat[]
it_sort = gt_sort[].
Regards,
2006 Oct 04 12:22 PM
Hi Amarjit,
Sort the grid on Material and Matl type. This should give you the list output you want.
Regards
2006 Oct 04 12:23 PM
hi,
u r passing an internla table to the ALV.
THN CHK THIS.
loop at itab.
wa-matnr = itab-matnr.
wa-type = space.
wa-mrp = space.
at new matnr.
wa-type = itab-type.
wa-mrp = itab-mrp.
end at.
append itab_alv from wa.
clear wa.
endloop.
pass itab_alv to ur alv display.
rgds
anver
if hlped mark points
Message was edited by: Anversha s
2006 Oct 04 12:34 PM
Hi Anver,
I hope you understood my requirement. Your solutions seems interesting.
For others when I apply the sorting on Material and Matl type output will come like:
(which is not my requirement)
MAterial |Matl type| MRP
-
matnr-01 | type-01 | 100
| |----
| | 200
| |----
| | 100
-
| |----
matnr-02 | | 100
| |----
| | 100
-
matnr-03 | type-02 | 100
-
| |----
matnr-04 | | 100
-
My requirement is the follwing output.
I want material type should come where there is change in material number.
MAterial |Matl type| MRP
-
matnr-01 | type-01 | 100
| |----
| | 200
| |----
| | 100
-
matnr-02 | type-01 | 100
| |----
| | 100
-
matnr-03 | type-02 | 100
-
matnr-04 | type-02 | 100
-
Thanks ,
A.Singh
2006 Oct 04 12:37 PM
hi amrjith,
just try my code.
it will work fine.
i am 100% sure.
rgds,
anver
2006 Oct 04 12:26 PM
fill the sort internal table for the fields material and material type.
DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR LS_SORT.
LS_SORT-FIELDNAME = 'MATNR'.
LS_SORT-SPOS = 1.
LS_SORT-UP = 'X'.
APPEND LS_SORT TO E06_LT_SORT.
CLEAR LS_SORT.
LS_SORT-FIELDNAME = 'MTART'.
LS_SORT-SPOS = 2.
LS_SORT-UP = 'X'.
APPEND LS_SORT TO E06_LT_SORT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BACKGROUND_ID = 'ALV_BACKGROUND'
I_CALLBACK_PROGRAM = G_REPID
I_STRUCTURE_NAME = 'SFLIGHT'
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS = GT_SP_GROUP[]
<b> IT_SORT = LT_SORT[]</b>
rEGARDS,
RAVI
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |