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: 

query for coloumn hiding in ALV

Former Member
0 Kudos
105

Hi all,

I am generating an ALv with 24 coloumns,but now I need to hide a field.

Its like the user should have the option to see the complete ALV or with that particular field hidden

example:

This is existing ALV:

GROUP G/L ACCOUNT LC USD

100 10 5 5

100 11 6 4

100 12 3 3

100 11 3 2

200 10 5 5

200 11 6 4

200 12 3 3

200 11 3 2

now there should be a option such that we can hide G/L account coloumn.

GROUP LC USD

100 5 5

100 6 4

100 3 3

100 3 2

200 5 5

200 6 4

200 3 3

200 3 2

some one please suggest how to do this.

thank you,

prasanth

1 ACCEPTED SOLUTION

Former Member
0 Kudos
60

Hi,

Set the fieldcatalog's no_out attribute to 'X'. This way the field will not be displayed when the report is shown initially. The user can choose it from the layout if he/she needs to see it on the report later.

regards,

Advait

5 REPLIES 5

Former Member
0 Kudos
61

Hi,

Set the fieldcatalog's no_out attribute to 'X'. This way the field will not be displayed when the report is shown initially. The user can choose it from the layout if he/she needs to see it on the report later.

regards,

Advait

0 Kudos
60

Hi Alex,

I want to use interactive method to hide the coloumn..first time when the ALv is displayed it should contain all the coloumns so I am doing that asusual..but can u explain me with some code how to use the interactive method to hide coloumn plz...

GROUP G|L ACCOUNTS LOCAL CURRENCY USD

let this 4 coloumns be the ALV output at present...

now I need to hide G|LACCOUNTS coloumn after user interaction.

please explain me with some code so that I can understand that better.

Please Help..

0 Kudos
60

Hi

just try.

At User-command.

    case sy-ucomm.

    when 'HIDE'. "Function code of hide button.

       perform modify_fieldcate.

       perform alv_display.

    when ...
    
     ....

    endcase.

   form modify_fieldcate.
        loop at i_fieldcate into w_fieldcate. "the fieldcate is predefined when first alv with all column display
             if w_fieldcate-name = 'G/L ACCOUNT'.
                 w_fieldcate-no_out = 'X'.
                 modify i_fieldcate from w_fieldcate.
             endif.
        endloop.
   endform.

   form alv_redisplay. "This is the subroutine first display the alv with all columns. Because you have 
                               "change the fieldcate, you can reuse it without writing another call function
        call function 'REUSE_ALV_GRID_DISPLAY'
             ....
             ....
   endform.

Former Member
0 Kudos
60

Hi

What's the type of program you use, screen or interative report?

If screen. When before you enter the screen, build the fieldcategory. And in screen PBO, just display

the alv. In screen PAI, when user click the hide button, you can modify the fieldcategory, set the

field 'G/L' no_output attribute = 'X', and modify the original fieldcate; or you can rebuild a new fieldcate

which not include the 'G/L' field. Then recall this screen.

If interactive report. At user-command event, deal with hide button function. Also rebuild fieldcate or

modify original fieldcat, then recall subroutine which display alv list.

Clemenss
Active Contributor
0 Kudos
60

Hi prasath,

as already mentioned: Set the fieldcatalog's no_out = 'X' for the unwanted field, set the frontend fieldcatalog, do a refresh.

If you use the ALV function modules, you may call FM GET_GLOBALS_FROM_SLVC_FULLSCR.

Here you have the exporting parameter E_GRID as a reference of current instance of CL_GUI_ALV_GRID. This allows usiage of methods for get and set fromtend field catalog.

FM GET_GLOBALS_FROM_SLVC_FULLSCR is very useful if you are not eager to use the OO concept with handlers and events and everything.

Regards,

Clemens