Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

alv GRID

Former Member
0 Kudos
85

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

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos
70

populate the sort table and pass the table parameter to

the alv grid function module.

regards

vijay

6 REPLIES 6

Former Member
0 Kudos
70

u have to fill the table it_sort in REUSE_ALV_GRID_DISPLAY

hymavathi_oruganti
Active Contributor
0 Kudos
70

when material or qty is not changed,

read lt_fieldcat into ls_fieldcat.

if ls_fieldcat-fieldname = 'kunnr'.

l_fieldcat-no_out = 'x'.

former_member188685
Active Contributor
0 Kudos
71

populate the sort table and pass the table parameter to

the alv grid function module.

regards

vijay

Former Member
0 Kudos
70

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.

Former Member
0 Kudos
70

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.

Former Member
0 Kudos
70

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.