<?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: dyanamic alv columns in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dyanamic-alv-columns/m-p/4515102#M1067691</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Priyank,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; check the program in the below link. I think you will get an idea&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/ab030.htm" target="test_blank"&gt;http://www.sap-img.com/ab030.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Kothand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Oct 2008 10:16:31 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-10-06T10:16:31Z</dc:date>
    <item>
      <title>dyanamic alv columns</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dyanamic-alv-columns/m-p/4515101#M1067690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi frn's ,&lt;/P&gt;&lt;P&gt;   i have a requirment of creating dynamic alv column ...depending upon the slection criteria . how it is possible.&lt;/P&gt;&lt;P&gt; Thanks and Regards.&lt;/P&gt;&lt;P&gt;   Priyank Dixit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2008 10:07:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dyanamic-alv-columns/m-p/4515101#M1067690</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-06T10:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: dyanamic alv columns</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dyanamic-alv-columns/m-p/4515102#M1067691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Priyank,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; check the program in the below link. I think you will get an idea&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/ab030.htm" target="test_blank"&gt;http://www.sap-img.com/ab030.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Kothand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2008 10:16:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dyanamic-alv-columns/m-p/4515102#M1067691</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-06T10:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: dyanamic alv columns</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dyanamic-alv-columns/m-p/4515103#M1067692</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;The normal way is we will be declaring an internal table of type slis_fieldcat_alv and we will be creating a work area for the above said internal table . let the internal table name be it_fcat and work area be wa_fcat. see the below code is the not man way&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; wa_fcat-tabname            = 'IT_FCAT' -&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt; nothing but the internal table name.&lt;/P&gt;&lt;P&gt;  wa_fcat-fieldname          = Filed name.&lt;/P&gt;&lt;P&gt;  wa_fcat-reptext_ddic       = Description of the field'.&lt;/P&gt;&lt;P&gt;  APPEND wa_fcat TO it_fcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As per your requirment, u can find out the table field that is to be added as column in ALV. get that fileds in an internal table that u need to show in alv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second point is : any way u know the interal table name that u are using in the program to store the data. So u can hard code it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then write a loop which contain the fields for example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let the internal table name be it_fields and work area be wa_field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_field into wa_field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear : wa_fcat.&lt;/P&gt;&lt;P&gt; wa_fcat-tabname            = 'IT_FCAT'.&lt;/P&gt;&lt;P&gt;  wa_fcat-fieldname          = wa_field-field.&lt;/P&gt;&lt;P&gt;  wa_fcat-reptext_ddic       = Description of the field'.&lt;/P&gt;&lt;P&gt;  APPEND wa_fcat TO it_fcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by this way u can built a dynamic fcat as per your requirment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there is on SAP table that stores the field name description ... from that you can query the description.. i forgot the table.. please search in SDN.. you can get it from there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;feel free in case of any doubt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maneesh Chandran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2008 10:24:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dyanamic-alv-columns/m-p/4515103#M1067692</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-06T10:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: dyanamic alv columns</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dyanamic-alv-columns/m-p/4515104#M1067693</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 a dynamic internal table . &lt;/P&gt;&lt;P&gt;  THanks and Regards &lt;/P&gt;&lt;P&gt;  Priyank dixit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2008 10:26:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dyanamic-alv-columns/m-p/4515104#M1067693</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-06T10:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: dyanamic alv columns</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dyanamic-alv-columns/m-p/4515105#M1067694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please refer to the thread as given below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="5349953"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there a lots to examples.. May be you can search yourself before posting your question..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2008 10:43:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dyanamic-alv-columns/m-p/4515105#M1067694</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-06T10:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: dyanamic alv columns</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dyanamic-alv-columns/m-p/4515106#M1067695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Priyank,&lt;/P&gt;&lt;P&gt;You can use the demo program for your reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZCC_DYNAMIC_INTERNAL_TABLE
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

report  ZCC_DYNAMIC_INTERNAL_TABLE.
type-pools : ABAP.
field-symbols: &amp;lt;DYN_TABLE&amp;gt; type standard table,
&amp;lt;DYN_WA&amp;gt;,
&amp;lt;DYN_FIELD&amp;gt;.
data: DY_TABLE type ref to DATA,
DY_LINE type ref to DATA,
XFC type LVC_S_FCAT,
IFC type LVC_T_FCAT.

selection-screen begin of block B1 with frame.
parameters: P_TABLE(30) type C default 'T001'.
selection-screen end of block B1.

start-of-selection.
  perform GET_STRUCTURE.
  perform CREATE_DYNAMIC_ITAB.
**********CREATES A DYANAMIC INTERNAL TABLE**********
  PERFORM GET_DATA.
  perform WRITE_OUT.
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  get_structure
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
form GET_STRUCTURE.
  data : IDETAILS type ABAP_COMPDESCR_TAB,
  XDETAILS type ABAP_COMPDESCR.
  data : REF_TABLE_DES type ref to CL_ABAP_STRUCTDESCR.
* Get the structure of the table.
  REF_TABLE_DES ?=
  CL_ABAP_TYPEDESCR=&amp;gt;DESCRIBE_BY_NAME( P_TABLE ).
  IDETAILS = REF_TABLE_DES-&amp;gt;COMPONENTS.
  loop at IDETAILS into XDETAILS.
    clear XFC.
    XFC-FIELDNAME = XDETAILS-NAME .
    XFC-DATATYPE = XDETAILS-TYPE_KIND.
    XFC-INTTYPE = XDETAILS-TYPE_KIND.
    XFC-INTLEN = XDETAILS-LENGTH.
    XFC-DECIMALS = XDETAILS-DECIMALS.
    append XFC to IFC.
  endloop.
endform.                    "get_structure
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  create_dynamic_itab
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
form CREATE_DYNAMIC_ITAB.
* Create dynamic internal table and assign to FS
  call method CL_ALV_TABLE_CREATE=&amp;gt;CREATE_DYNAMIC_TABLE
    exporting
      IT_FIELDCATALOG = IFC
    importing
      EP_TABLE        = DY_TABLE.
  assign DY_TABLE-&amp;gt;* to &amp;lt;DYN_TABLE&amp;gt;.
* Create dynamic work area and assign to FS
  create data DY_LINE like line of &amp;lt;DYN_TABLE&amp;gt;.
  assign DY_LINE-&amp;gt;* to &amp;lt;DYN_WA&amp;gt;.
endform.                    "create_dynamic_itab

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  get_data
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
form GET_DATA.
* Select Data from table.
  select * into table &amp;lt;DYN_TABLE&amp;gt;
  from (P_TABLE).
endform.                    "get_data

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  WRITE_OUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM WRITE_OUT .
*write OUT DATA FROM TABLE.
loop at &amp;lt;DYN_TABLE&amp;gt; into &amp;lt;DYN_WA&amp;gt;.
  do.
    assign component SY-INDEX
    of structure &amp;lt;DYN_WA&amp;gt; to &amp;lt;DYN_FIELD&amp;gt;.
    if SY-SUBRC = 0.
      exit.
    endif.
    if SY-INDEX = 1.
      write:/ &amp;lt;DYN_FIELD&amp;gt;.
    else.
      write: &amp;lt;DYN_FIELD&amp;gt;.
    endif.
  enddo.
endloop.

ENDFORM.                    " WRITE_OUT
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2008 10:53:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dyanamic-alv-columns/m-p/4515106#M1067695</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-06T10:53:19Z</dc:date>
    </item>
  </channel>
</rss>

