<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: restricting field in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/restricting-field/m-p/3418267#M821010</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ya u can do dat by setting the &lt;STRONG&gt;no_out = 'X'&lt;/STRONG&gt; field of fieldcatalog for dat field.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;below is the sample code where if u select the check-box only 2 flds gets displayed else 3 flds gets displayed....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;parameter restr as CHECKBOX.

type-pools: slis.
DATA: begin of itab6 occurs 0,
chk type c,
a type p decimals 2,
b type p decimals 2,
c type c,
end of itab6.

data: ls_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
wa_layout TYPE slis_layout_alv.

itab6-a = '1.12'.
itab6-b = '2.25'.
itab6-c = '+'.

append itab6.
append itab6.
append itab6.
append itab6.


ls_fieldcat-fieldname = 'A'.
ls_fieldcat-seltext_m = 'A'.
append ls_fieldcat.

ls_fieldcat-fieldname = 'B'.
ls_fieldcat-seltext_m = 'B'.
ls_fieldcat-decimals_out = 0.
append ls_fieldcat.

ls_fieldcat-fieldname = 'C'.
ls_fieldcat-seltext_m = 'C'.
if restr = 'X'.
ls_fieldcat-no_out = 'X'.
endif.
append ls_fieldcat.

wa_layout-box_tabname = 'ITAB6'.
wa_layout-box_fieldname = 'CHK'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = ls_fieldcat[]
IS_LAYOUT = wa_layout

TABLES
t_outtab = itab6[].&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;jose.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 23 Feb 2008 11:11:41 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-23T11:11:41Z</dc:date>
    <item>
      <title>restricting field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/restricting-field/m-p/3418266#M821009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;      Is there any way to restrict only one field from not getting printed in an ALV report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Useful informations will be rewarded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards&lt;/P&gt;&lt;P&gt;karthi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Feb 2008 10:58:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/restricting-field/m-p/3418266#M821009</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-23T10:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: restricting field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/restricting-field/m-p/3418267#M821010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ya u can do dat by setting the &lt;STRONG&gt;no_out = 'X'&lt;/STRONG&gt; field of fieldcatalog for dat field.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;below is the sample code where if u select the check-box only 2 flds gets displayed else 3 flds gets displayed....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;parameter restr as CHECKBOX.

type-pools: slis.
DATA: begin of itab6 occurs 0,
chk type c,
a type p decimals 2,
b type p decimals 2,
c type c,
end of itab6.

data: ls_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
wa_layout TYPE slis_layout_alv.

itab6-a = '1.12'.
itab6-b = '2.25'.
itab6-c = '+'.

append itab6.
append itab6.
append itab6.
append itab6.


ls_fieldcat-fieldname = 'A'.
ls_fieldcat-seltext_m = 'A'.
append ls_fieldcat.

ls_fieldcat-fieldname = 'B'.
ls_fieldcat-seltext_m = 'B'.
ls_fieldcat-decimals_out = 0.
append ls_fieldcat.

ls_fieldcat-fieldname = 'C'.
ls_fieldcat-seltext_m = 'C'.
if restr = 'X'.
ls_fieldcat-no_out = 'X'.
endif.
append ls_fieldcat.

wa_layout-box_tabname = 'ITAB6'.
wa_layout-box_fieldname = 'CHK'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = ls_fieldcat[]
IS_LAYOUT = wa_layout

TABLES
t_outtab = itab6[].&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;jose.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Feb 2008 11:11:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/restricting-field/m-p/3418267#M821010</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-23T11:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: restricting field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/restricting-field/m-p/3418268#M821011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi jose,&lt;/P&gt;&lt;P&gt;          Thanks for your reply. If i do what u said i'm not getting my field in output itself. my requirement is that particular field needs to be shown in output, but when print button is pressed that particular field shouldn.t get printed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Karthi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Feb 2008 11:26:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/restricting-field/m-p/3418268#M821011</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-23T11:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: restricting field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/restricting-field/m-p/3418269#M821012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Karthi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Through selection screen get the columns numbers in the output for which the user wants to see the output. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;say output1 contains the column number on the ALV for Field 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not output1 is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Build the Field Catalogue for the Field1 with the column number in output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Move Field1 into an internal table itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab2 (the internal table with values).&lt;/P&gt;&lt;P&gt;  loop at itab1.&lt;/P&gt;&lt;P&gt;    assign component itab1-field to &amp;lt;FS&amp;gt; casting type c.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will resolve your issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Feb 2008 12:43:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/restricting-field/m-p/3418269#M821012</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-23T12:43:52Z</dc:date>
    </item>
  </channel>
</rss>

