<?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 Dynamic columns in table control in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-in-table-control/m-p/7665450#M1574494</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;     I need to add some fields in table control in run time based on conditions given.I need to use CXTAB related ones.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me with some related codes with CXTAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Ramya Ramya on Mar 8, 2011 11:21 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Mar 2011 10:20:41 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-03-08T10:20:41Z</dc:date>
    <item>
      <title>Dynamic columns in table control</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-in-table-control/m-p/7665450#M1574494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;     I need to add some fields in table control in run time based on conditions given.I need to use CXTAB related ones.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me with some related codes with CXTAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Ramya Ramya on Mar 8, 2011 11:21 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 10:20:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-in-table-control/m-p/7665450#M1574494</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-08T10:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic columns in table control</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-in-table-control/m-p/7665451#M1574495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;PROCESS BEFORE OUTPUT.
module operation.
loop at i_vbap into wa_vbap with control tc.
 MODULE STATUS_0100.
 endloop.
module clear.


PROCESS AFTER INPUT.
loop at i_vbap.
module modify.

 endloop.
field VBAK-VBELN MODULE USER_COMMAND_0100 on request.
module sub.

******************************************************************



include mzsanpracticetop                        .    " global Data

* INCLUDE MZSANPRACTICEO01                        .  " PBO-Modules
* INCLUDE MZSANPRACTICEI01                        .  " PAI-Modules
* INCLUDE MZSANPRACTICEF01                        .  " FORM-Routines

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  STATUS_0100  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module status_0100 output.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.

  move-corresponding wa_vbap to vbap.

endmodule.                 " STATUS_0100  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  USER_COMMAND_0100  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module user_command_0100 input.

  case ok_code.
    when ''.

*if tc-lines ne tc-current_line.
      if  lv_lines  is initial.

        select vbeln
               erdat
               posnr
               matnr
               matwa
               matkl
               arktx
        from vbap
        into corresponding fields of table i_vbap
        where vbeln = vbak-vbeln.
*and  erdat = vbak-erdat.
        move : sy-dbcnt to tc-lines.

      endif.

    when 'SUB'.
      delete i_vbap where mark eq 'X'.
      tc-lines = tc-lines - tc-current_line.

  endcase.
endmodule.                 " USER_COMMAND_0100  INPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  operation  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module operation output.
  describe table i_vbap lines lv_lines.
  if tc-lines eq 0.
    tc-lines = 1.
  endif.


endmodule.                 " operation  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  modify  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module modify input.

  clear lv_lines.
  describe table i_vbap lines lv_lines.
  if lv_lines ge tc-current_line.
    if wa_vbap-mark eq 'X'.
      v_index = tc-current_line .
    endif.
    modify i_vbap from wa_vbap index tc-current_line.
  else.
    if wa_vbap-mark eq 'X'.
      v_index = tc-current_line .
    endif.
    append wa_vbap to i_vbap.
    clear wa_vbap.
  endif.

endmodule.                 " modify  INPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  clear  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module clear output.

  clear : ok_code,
          v_index.

endmodule.                 " clear  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  sub  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module sub input.
case ok_code.
 when 'SUB'.
      delete i_vbap where mark eq 'X'.
      tc-lines = tc-lines - tc-current_line.


            when 'ADD'.
*loop at i_vbap.
      if v_index is not initial.

        insert initial line into i_vbap index v_index.

      else.
        get cursor "  field v_fname
                   line  v_line
                   area  v_area.

        move : v_line to v_index.
        v_index = v_index + 1.
        insert initial line into i_vbap index v_index.

      endif.
*      endloop.

      tc-lines = lv_lines + 1.

  endcase.

endmodule.                 " sub  INPUT&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;understand and use it&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 10:28:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-in-table-control/m-p/7665451#M1574495</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-08T10:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic columns in table control</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-in-table-control/m-p/7665452#M1574496</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;TC-COLS-VISLENGTH = 0 -- allows you to hide a column.&lt;/P&gt;&lt;P&gt;TC-COLS-INVISIBLE = 1 appears to have the same effect as VISLENGTH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR Try Following Steps..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u can have dynamic columns in an internal table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;declare as many columns as u like initially. &lt;/P&gt;&lt;P&gt;u can hide the display of the columns as and when u wish.. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it is possible with the use of TYPE-POOLS cxtab. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;declare TYPE-POOLS cxtab. &lt;/P&gt;&lt;P&gt;DATA v_tccols TYPE cxtab_column . &lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;tc_cols&amp;gt; TYPE cxtab_control . &lt;/P&gt;&lt;P&gt;data tcname(25) type c. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign table control name to tcname and assign tcname to tc_cols. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with this u can manipulate what ever columns u want to display or hide. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anil Sonesar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 10:37:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-in-table-control/m-p/7665452#M1574496</guid>
      <dc:creator>anilsonesar</dc:creator>
      <dc:date>2011-03-08T10:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic columns in table control</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-in-table-control/m-p/7665453#M1574497</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;It will be more easy for you if you use ALV for this purpose.&lt;/P&gt;&lt;P&gt;in se38 check for BC&lt;STRONG&gt;ALV&lt;/STRONG&gt;EDIT*&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 11:15:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-in-table-control/m-p/7665453#M1574497</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2011-03-08T11:15:41Z</dc:date>
    </item>
  </channel>
</rss>

