<?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: Dynamic catalog generation.. ?? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-catalog-generation/m-p/4118371#M984529</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check out this code this code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
field-symbols:
*Dynamic table for PART C 
&amp;lt;f_data&amp;gt;    type standard table.
field-symbols: &amp;lt;l_temp&amp;gt; type any.
field-symbols: &amp;lt;l_wa_f_data&amp;gt; type any.
data: l_wa_ref type ref to data,
*Field catalog
i_lvc_t_fcat  type lvc_t_fcat,
* Pointer to dynamic table
i_table    type ref to data.



clear: wa_line.
refresh: i_tab,i_lvc_t_fcat.

* Creating the ALV Catalog
  perform sub_create_catalog1 using:
     'WERKS'    'Plant'(011)              '4'  'WERKS_D',
     'MATNR'    'Material'(012)           '18' 'MATNR',
     'MAKTX'    'Description'(066)        '40' 'MAKTX',
     'WAERS'    'Curr.'(019)              '5'  'WAERS',
     'PEINH'    'Price Unit'(052)         '6'  'PEINH'.

  if p_pp1 = c_check.
    perform sub_create_catalog1 using:
       'ZPLP1'    'PlndPrice1'(020)      '14' 'DZPLP1',
       'ZPLD1'    'PP date 1'(021)       '10' 'DZPLD1'.
  endif.
  if p_pp2 = c_check.
    perform sub_create_catalog1 using:
       'ZPLP2'    'PlndPrice2'(022)      '14' 'DZPLP2',
       'ZPLD2'    'PP date 2'(023)       '10' 'DZPLD2'.
  endif.
  if p_pp3 = c_check.
    perform sub_create_catalog1 using:
       'ZPLP3'    'PlndPrice3'(024)      '14' 'DZPLP3',
       'ZPLD3'    'PP date 3'(025)       '10' 'DZPLD3'.
  endif.
  if p_disall = c_check.
    perform sub_create_catalog1 using:
       'ZPLP1'    'PlndPrice1'(020)      '14' 'DZPLP1',
       'ZPLD1'    'PP date 1'(021)       '10' 'DZPLD1',
       'ZPLP2'    'PlndPrice2'(022)      '14' 'DZPLP2',
       'ZPLD2'    'PP date 2'(023)       '10' 'DZPLD2',
       'ZPLP3'    'PlndPrice3'(024)      '14' 'DZPLP3',
       'ZPLD3'    'PP date 3'(025)       '10' 'DZPLD3'.
  endif.

* Create internal table
  call method cl_alv_table_create=&amp;gt;create_dynamic_table
    exporting
      it_fieldcatalog = i_lvc_t_fcat
    importing
      ep_table        = i_table.

*Create a table
  assign i_table-&amp;gt;* to &amp;lt;f_data&amp;gt;.
  check sy-subrc = 0.

*Create a data
  create data l_wa_ref like line of &amp;lt;f_data&amp;gt;.
*Assign the work area
  assign l_wa_ref-&amp;gt;* to &amp;lt;l_wa_f_data&amp;gt;.
  check sy-subrc = 0.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  sub_create_catalog1
*&amp;amp;---------------------------------------------------------------------*
*       Popualate Temp Field catalog
*----------------------------------------------------------------------*
*      --&amp;gt;P_FLDNAME      Fieldname
*      --&amp;gt;P_COL_HEADING  Coloumn Heading
*      --&amp;gt;P_OUTPUTLEN    Length
*----------------------------------------------------------------------*
form sub_create_catalog1  using   p_fldname      type slis_fieldname
                                  p_col_heading  type scrtext_l
                                  p_outputlen    type any
                                  p_rollname     type rollname.
  data:l_wa_lvc_t_fcat like line of i_lvc_t_fcat.

*...Clear Workarea
  clear l_wa_lvc_t_fcat.

  l_wa_lvc_t_fcat-fieldname   =  p_fldname.            " Field name
  l_wa_lvc_t_fcat-outputlen   =  p_outputlen.          " Output Length
  l_wa_lvc_t_fcat-seltext     =  p_col_heading.        " Column heading
  l_wa_lvc_t_fcat-rollname    =  p_rollname.           " Data element

* Append the data into field catalog table
  append l_wa_lvc_t_fcat to i_lvc_t_fcat .


endform.                    " sub_create_catalog1

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 Jul 2008 09:33:10 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-07T09:33:10Z</dc:date>
    <item>
      <title>Dynamic catalog generation.. ??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-catalog-generation/m-p/4118369#M984527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here i want to generate dynamic catalog for alv.&lt;/P&gt;&lt;P&gt;i.e. initially table name is not known to me.&lt;/P&gt;&lt;P&gt;at runtime my application will get to know table name. (table name will be stored in some variable)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So can anybody please tell me how to do this?&lt;/P&gt;&lt;P&gt;please write code snippet for this.&lt;/P&gt;&lt;P&gt;also while generating catalog how to determing coloum names for this table at runtime?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Naveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2008 07:46:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-catalog-generation/m-p/4118369#M984527</guid>
      <dc:creator>former_member301966</dc:creator>
      <dc:date>2008-07-07T07:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic catalog generation.. ??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-catalog-generation/m-p/4118370#M984528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;u can do it by using REUSE_ALV_FIELDCATALOGUE_MERGE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function module &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;after getting the table name pass the table name to this fm&lt;/P&gt;&lt;P&gt;it will create a fieldcat and gives it for you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;once after getting field cat u can modify the field cat as per your requirement&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2008 07:50:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-catalog-generation/m-p/4118370#M984528</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-07T07:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic catalog generation.. ??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-catalog-generation/m-p/4118371#M984529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check out this code this code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
field-symbols:
*Dynamic table for PART C 
&amp;lt;f_data&amp;gt;    type standard table.
field-symbols: &amp;lt;l_temp&amp;gt; type any.
field-symbols: &amp;lt;l_wa_f_data&amp;gt; type any.
data: l_wa_ref type ref to data,
*Field catalog
i_lvc_t_fcat  type lvc_t_fcat,
* Pointer to dynamic table
i_table    type ref to data.



clear: wa_line.
refresh: i_tab,i_lvc_t_fcat.

* Creating the ALV Catalog
  perform sub_create_catalog1 using:
     'WERKS'    'Plant'(011)              '4'  'WERKS_D',
     'MATNR'    'Material'(012)           '18' 'MATNR',
     'MAKTX'    'Description'(066)        '40' 'MAKTX',
     'WAERS'    'Curr.'(019)              '5'  'WAERS',
     'PEINH'    'Price Unit'(052)         '6'  'PEINH'.

  if p_pp1 = c_check.
    perform sub_create_catalog1 using:
       'ZPLP1'    'PlndPrice1'(020)      '14' 'DZPLP1',
       'ZPLD1'    'PP date 1'(021)       '10' 'DZPLD1'.
  endif.
  if p_pp2 = c_check.
    perform sub_create_catalog1 using:
       'ZPLP2'    'PlndPrice2'(022)      '14' 'DZPLP2',
       'ZPLD2'    'PP date 2'(023)       '10' 'DZPLD2'.
  endif.
  if p_pp3 = c_check.
    perform sub_create_catalog1 using:
       'ZPLP3'    'PlndPrice3'(024)      '14' 'DZPLP3',
       'ZPLD3'    'PP date 3'(025)       '10' 'DZPLD3'.
  endif.
  if p_disall = c_check.
    perform sub_create_catalog1 using:
       'ZPLP1'    'PlndPrice1'(020)      '14' 'DZPLP1',
       'ZPLD1'    'PP date 1'(021)       '10' 'DZPLD1',
       'ZPLP2'    'PlndPrice2'(022)      '14' 'DZPLP2',
       'ZPLD2'    'PP date 2'(023)       '10' 'DZPLD2',
       'ZPLP3'    'PlndPrice3'(024)      '14' 'DZPLP3',
       'ZPLD3'    'PP date 3'(025)       '10' 'DZPLD3'.
  endif.

* Create internal table
  call method cl_alv_table_create=&amp;gt;create_dynamic_table
    exporting
      it_fieldcatalog = i_lvc_t_fcat
    importing
      ep_table        = i_table.

*Create a table
  assign i_table-&amp;gt;* to &amp;lt;f_data&amp;gt;.
  check sy-subrc = 0.

*Create a data
  create data l_wa_ref like line of &amp;lt;f_data&amp;gt;.
*Assign the work area
  assign l_wa_ref-&amp;gt;* to &amp;lt;l_wa_f_data&amp;gt;.
  check sy-subrc = 0.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  sub_create_catalog1
*&amp;amp;---------------------------------------------------------------------*
*       Popualate Temp Field catalog
*----------------------------------------------------------------------*
*      --&amp;gt;P_FLDNAME      Fieldname
*      --&amp;gt;P_COL_HEADING  Coloumn Heading
*      --&amp;gt;P_OUTPUTLEN    Length
*----------------------------------------------------------------------*
form sub_create_catalog1  using   p_fldname      type slis_fieldname
                                  p_col_heading  type scrtext_l
                                  p_outputlen    type any
                                  p_rollname     type rollname.
  data:l_wa_lvc_t_fcat like line of i_lvc_t_fcat.

*...Clear Workarea
  clear l_wa_lvc_t_fcat.

  l_wa_lvc_t_fcat-fieldname   =  p_fldname.            " Field name
  l_wa_lvc_t_fcat-outputlen   =  p_outputlen.          " Output Length
  l_wa_lvc_t_fcat-seltext     =  p_col_heading.        " Column heading
  l_wa_lvc_t_fcat-rollname    =  p_rollname.           " Data element

* Append the data into field catalog table
  append l_wa_lvc_t_fcat to i_lvc_t_fcat .


endform.                    " sub_create_catalog1

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2008 09:33:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-catalog-generation/m-p/4118371#M984529</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-07T09:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic catalog generation.. ??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-catalog-generation/m-p/4118372#M984530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Saurav,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   This doesn't seem to be solution. since we don't know coloum headings at compile time.&lt;/P&gt;&lt;P&gt;   so what i want to know is , while generating catalog dynamically how to determing coloum heading.&lt;/P&gt;&lt;P&gt;   or alternatively how to create a table with header line from a table name stored in some variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  I tried following way:&lt;/P&gt;&lt;P&gt;  data tab_name type DD02L-TABNAME.&lt;/P&gt;&lt;P&gt;  data uitab type ref to data.&lt;/P&gt;&lt;P&gt;  create data uitab type table of (TAB_NAME).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"(say value in tab_name is 'spfli')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call method my_alv-&amp;gt;set_table_for_first_display&lt;/P&gt;&lt;P&gt;       exporting&lt;/P&gt;&lt;P&gt;         i_structure_name              = '(NAME)'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But since this table doesn't contain the header line so this method requires another changing parameter&lt;/P&gt;&lt;P&gt;it_fieldcatalog . But to perform create_catalog i must know what coloums are there within the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ah!!! finally i got it.. &lt;/P&gt;&lt;P&gt;Thanks a lot for your attempt..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Naveen Trivedi on Jul 15, 2008 6:34 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jul 2008 05:54:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-catalog-generation/m-p/4118372#M984530</guid>
      <dc:creator>former_member301966</dc:creator>
      <dc:date>2008-07-08T05:54:42Z</dc:date>
    </item>
  </channel>
</rss>

