Application Development and Automation 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: 
Read only

Sorting in ALV Report.

Former Member
0 Likes
747

Dear Experts,

I mfacing a strange problem.

I hv an internal table containing the required data in required sorted order.

But when i call CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' function module,

the sort order gets changed. I m not sorting internal table.

The internal table is very much ok till i write statement "CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' ".

I hv checked in dbugging mode, (if sy-subrc = 0 in the above function module) the sort order getting changed only in the call of function module.

Any suggestion.

Regards,

Maverick

Dear Experts,

I mfacing a strange problem.

I hv an internal table containing the required data in required sorted order.

But when i call CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' function module,

the sort order gets changed. I m not sorting internal table.

The internal table is very much ok till i write statement "CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' ".

I hv checked in dbugging mode, (if sy-subrc = 0 in the above function module) the sort order getting changed only in the call of function module.

Any suggestion.

Regards,

Maverick

4 REPLIES 4
Read only

Former Member
0 Likes
647

Hi

Check the exporting parametesr it_sort in REUSE_ALV_GRID_DISPLAY. If they are exporting then it will sort otherwise it will not

sort the REUSE_ALV_GRID_DISPLAY FM. If they have passed comment it and check.

Edited by: Thiruibm on Mar 15, 2010 12:13 PM

Read only

0 Likes
647

Thanks for ur reply.

I m calling FM as follow


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     I_CALLBACK_PROGRAM                 = w_repid
     I_CALLBACK_USER_COMMAND            = 'USER_COMMAND'
     I_CALLBACK_TOP_OF_PAGE             = 'TOP-OF-PAGE'
     IT_FIELDCAT                        = i_fcat[]
     I_SAVE                             = 'X'
    TABLES
      T_OUTTAB                          = i_faglflexa_all
*  EXCEPTIONS
*    PROGRAM_ERROR                     = 1
*    OTHERS                            = 2
            .
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

IF i put first break-point at CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' statement, the internal table is ok ( as i hv checked in dbugg mode), but i put second break-point at IF SY-SUBRC <> 0., statement, I get the changed sort order of internal table.

Any suggestion.

Regards,

Maverick

Read only

0 Likes
647

Hi

Comment I_SAVE = ''X" in the exporting parameters in ALV FM and check.

Read only

Former Member
0 Likes
647

Hi,


Define:IT_SORT TYPE SLIS_T_SORTINFO_ALV

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     I_CALLBACK_PROGRAM                 = w_repid
     I_CALLBACK_USER_COMMAND            = 'USER_COMMAND'
     I_CALLBACK_TOP_OF_PAGE             = 'TOP-OF-PAGE'
     IT_FIELDCAT                        = i_fcat[]
     I_SAVE                             = 'X'
      IT_SORT                           = it_sort
    TABLES
      T_OUTTAB                          = i_faglflexa_all
*  EXCEPTIONS
*    PROGRAM_ERROR                     = 1
*    OTHERS                            = 2
            .
  IF SY-SUBRC  0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Now in debugging if the sy-subrc = 0 then only the further process will take place.

If sy-subrc is not zero then what is the point of sorting data as Th Function module have some error.

So what you are getting in debugging that is correct. Nothing is wrong.

regards,

Pravin

Edited by: pravin s. on Mar 15, 2010 12:22 PM

Edited by: pravin s. on Mar 15, 2010 12:25 PM