2006 Jan 18 10:02 AM
HAI,
MY REQUIREMENT IS I HAVE A ALV GRID WITH FORUR FIELDS SAY
KUUNR NAME1 MATERIAL QTY
NOW WHILE DISPLAYING I WILL BE SORTING BY KUUNR NAME1.
WHILE DISPLAYING THE ENTRIES OF KUUNR AND NAME1 IS COMING IN ALL ROWS, BUT MY REQUIREMENT IS THE KUUNR AND NAME1 SHOULD NOT APPEAR FOR ALL ROWS, IT SHOULD APPEAR ONLY WHEN THE RESPECTIVE VALUES ARE CHENGED, TO DO THIS WHAT ATTRIBUTE HAS TO BE SET.
CHEERS
2006 Jan 18 10:11 AM
populate the sort table and pass the table parameter to
the alv grid function module.
regards
vijay
2006 Jan 18 10:04 AM
2006 Jan 18 10:07 AM
when material or qty is not changed,
read lt_fieldcat into ls_fieldcat.
if ls_fieldcat-fieldname = 'kunnr'.
l_fieldcat-no_out = 'x'.
2006 Jan 18 10:11 AM
populate the sort table and pass the table parameter to
the alv grid function module.
regards
vijay
2006 Jan 18 10:12 AM
sort itab by KUNNR NAME1 MATERIAL QTY
*this is the sor ttable
CLEAR LC_SORT.
LC_SORT-FIELDNAME = 'KUNNR'.
LC_SORT-UP = 'X'.
APPEND LC_SORT TO IT_SORT.
CLEAR LC_SORT.
LC_SORT-FIELDNAME = 'NAME1'.
LC_SORT-UP = 'X'.
APPEND LC_SORT TO IT_SORT.
CLEAR LC_SORT.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
IT_SORT = IT_SORT
...... TABLES
T_OUTTAB = itab.
2006 Jan 18 10:13 AM
Hi,
you have to pass populate the internal table IT_SORT of FM REUSE_ALV_GRID_DISPLAY with sort information. pass 'KUNNR' to the local internal table declared T_SORT-FIELDNAME. append the entry, again pass NAME1. pass this internal table to table's parameter IT_SORT.
2006 Jan 18 10:13 AM
Hi kumar,
Populate the sort table and pass to the Grid display
fucntion module. See teh sample code below.
* Form to Sort
PERFORM SORT_BUILD USING DT_SORT[].
* CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = dG_REPID
IS_LAYOUT = dS_LAYOUT
IT_FIELDCAT = dT_FIELDCAT[]
IT_SORT = dT_SORT[]
IT_EVENTS = dT_EVENTS[]
I_SAVE = dg_VAR_SAVE
IS_VARIANT = dg_TEMPLATE
IMPORTING
ES_EXIT_CAUSED_BY_USER = dS_EXIT_CAUSED_BY_USER
TABLES
T_OUTTAB = dt_final
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
if sy-subrc <> 0.
MESSAGE i999 WITH 'Error in Displaying Grid'(031).
endif.
*&---------------------------------------------------------------------*
*& Form SORT_BUILD
*&---------------------------------------------------------------------*
* For Sort
*----------------------------------------------------------------------*
FORM SORT_BUILD USING P_GT_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA: LS_SORT TYPE SLIS_SORTINFO_ALV. " Sort
CLEAR LS_SORT.
LS_SORT-FIELDNAME = 'NAME'(029).
LS_SORT-SPOS = 1.
LS_SORT-UP = c_x.
APPEND LS_SORT TO P_GT_SORT.
ENDFORM. " SORT_BUILD
Hope this is helpful...Let me know if u need more info.
Thanks&Regards,
Siri.