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

classical report issue

Former Member
0 Likes
570

hi Experts,

     I have a Requirement to add sort ,filter options to classical report output ,I have tried by using module-pool program but it not working .how I will add  these options to classical reports.anybody please explain me.

Thank You,

Pavan Kumar Dantu

2 REPLIES 2
Read only

Hvshal4u
Active Participant
0 Likes
536

Hi Pavankumar ,

Inorder to achieve follow below steps :

1. Add push button on your classical report screen using set PF-STATUS.

2. Give Function code for the push button.

3. Handle the event AT USER-COMMAND.

4. Under this Check whether user have clicked on the sort button using SY-UCOMM.

   if it is pressed then check which field selected by user. using GET CURSOR statement.

5. In FVAL of GET CURSOR you get the user selected field .

   then you can apply sort on your internal table.

6. Redisplay the internal table data.

below is sample code :

DATA : gt_mara TYPE TABLE OF mara,

        gs_mara TYPE mara.

SELECT * FROM mara into TABLE gt_mara UP TO 20 ROWS.

PERFORM f_show.

set PF-STATUS 'ZSTATUS'.

at USER-COMMAND.

   DATA : fname TYPE string,

          fval TYPE string.

   IF sy-ucomm = 'SORT'.

     GET CURSOR FIELD fname VALUE fval. " gives you the column name

     IF fval = 'Material'. " check which column selected by user

       SORT gt_mara DESCENDING by MATNR. " Sort accordingly

     ELSEIF fval = 'Mat Type'.

       SORT gt_mara DESCENDING by MTART.

     ENDIF.

     PERFORM f_show.

   ENDIF.

FORM F_SHOW .

   WRITE : / 'Material' ,21 'Mat Type'.

   LOOP AT gt_mara INTO gs_mara.

     WRITE : / gs_mara-MATNR , 21 gs_mara-MTART.

   ENDLOOP.

ENDFORM


Note : You have the select the column on which you want to apply the sort.


Thanks & Regards-

Vishal

Read only

Former Member
0 Likes
536

hi Vishal,

     they are expecting filter option ,for filter the output by vendor .how to solve this issue.