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: 

How to disable a single field from alv grid.

Former Member
0 Kudos

Hi,

I have implemented  alv using cl_gui_alv.    LVC_FIELDCATALOG_MERGE is used for assigning field catalogs.

Now i want to disable displaying a single field(column) from the grid. How to disable this unwanted column?!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

S/m Ismail,

After you generate the field catalog use delete statement to remove the field

DELETE it_fieldcat where fieldname = 'UNWANTEDFIELD'.

Regards

9 REPLIES 9

0 Kudos

Hi Nadeem,

U can hide columns in alv by passing fcat-hide = 'X' for that particular field.

Hope this helps.

Please reward if useful.

Regards,

Manideep Settipalli

Former Member
0 Kudos

S/m Ismail,

After you generate the field catalog use delete statement to remove the field

DELETE it_fieldcat where fieldname = 'UNWANTEDFIELD'.

Regards

Former Member
0 Kudos

Nadeem,

After diplaying  ALV Report , in output u can hide that column and save the variant as default.

Regards,

Kumar.

former_member184569
Active Contributor
0 Kudos

You can change any attribute of any field after the field catalog has been created.

LOOP AT gt_fieldcat INTO ls_fcat.
     if ls_fcat-fieldname = 'FIELDNAME'
          ls_fcat-no_out = 'X'.
        MODIFY gt_fieldcat FROM ls_fcat.

    endif.

endloop.

0 Kudos

This method is the simplest approach.

Use this loop after your LVC_FIELDCATALOG_MERGE and the problem is solved.

Former Member
0 Kudos

Create structure with required column and pass export parameter.

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

* EXPORTING

*   I_STRUCTURE_NAME             =

Former Member
0 Kudos

If you want to show the field but to disable it, you can do as when preparing the field catalog

<lwa_fcat>-edit = space.

If you want to hide the field completely all given above answers can be used depending on your requirement.

raymond_giuseppi
Active Contributor
0 Kudos

Just loop at the generated field catalog, then either modify

  • <fieldcatalog>-TECH = 'X'. " field wont never been displayed
  • <fieldcatalog>-NO_OUT = 'X'. " field wont be initially displayed, but user managing layout can display it

Regards,

Raymond

Former Member
0 Kudos

I found both Susmitha and Yakub right. The delete statement takes a single line while the other takes 2 lines.

Thank Everyone!!