<?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: Class:cl_salv_table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735599#M1457781</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;nice to see your reply.Its the same problem of the previous thread.BUT now we are using a different Class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get the ALV displayed by default without passing the internal table fieldcatalog for  the columns, but the Field names need to be assigned to the dynamic fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*Dynamic fields
    LOOP AT i_tckh3 INTO w_tckh3.
      LOOP AT i_tckh1 INTO w_tckh1 WHERE elemt = w_tckh3-elemt.
        lcount = lcount + 1.
        WRITE w_tckh1-txele TO w_fieldcat-seltext   LEFT-JUSTIFIED.
        WRITE w_tckh1-txele TO w_fieldcat-coltext   LEFT-JUSTIFIED.
        CONCATENATE 'KST' w_tckh3-el_hv INTO w_fieldcat-fieldname.
        TRANSLATE w_fieldcat-fieldname              TO UPPER CASE.
        w_fieldcat-col_pos   =  lcount.
        w_fieldcat-ref_field = 'KST001'.
        w_fieldcat-ref_table = 'KEPH'.
        w_fieldcat-datatype  = 'CURR'.
        APPEND w_fieldcat TO i_fieldcat.
        CLEAR  w_fieldcat.
        CLEAR: w_tckh1.
      ENDLOOP.
      CLEAR:w_tckh3.
    ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any specific method i can use to solve this issue.&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;I Hope you got the points assigned for the last thread.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Mar 2010 08:29:22 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-03-23T08:29:22Z</dc:date>
    <item>
      <title>Class:cl_salv_table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735597#M1457779</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;I have to use Class cl_salv_table for displaying the ALV grid.I have created a Dynamic Fieldcatalog,with their field headings values coming from a internal table.When we use this class,we do not pass the internal table of Fieldcatalog.how do we define the fieldcatalog for the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*Dynamic fields
    LOOP AT i_tckh3 INTO w_tckh3.
      LOOP AT i_tckh1 INTO w_tckh1 WHERE elemt = w_tckh3-elemt.
        lcount = lcount + 1.
        WRITE w_tckh1-txele TO w_fieldcat-seltext   LEFT-JUSTIFIED.
        CONCATENATE 'KST' w_tckh3-el_hv INTO w_fieldcat-fieldname.
        TRANSLATE w_fieldcat-fieldname              TO UPPER CASE.
        w_fieldcat-col_pos   =  lcount.
        w_fieldcat-ref_field = 'KST001'.
        w_fieldcat-ref_table = 'KEPH'.
        w_fieldcat-datatype  = 'CURR'.
        APPEND w_fieldcat TO i_fieldcat.
        CLEAR  w_fieldcat.
        CLEAR: w_tckh1.
      ENDLOOP.
      CLEAR:w_tckh3.
    ENDLOOP.

CALL METHOD cl_salv_table=&amp;gt;factory
*      EXPORTING
*        list_display   = IF_SALV_C_BOOL_SAP=&amp;gt;FALSE
*        r_container    =
*        container_name =
            IMPORTING
              r_salv_table   = gr_table
            CHANGING
            t_table        = &amp;lt;i_table&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I was using Method:set_table_for_first_display the output was coming correct.Now I am having problem displaying the header of the columns.Please advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Mar 2010 07:05:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735597#M1457779</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-23T07:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: Class:cl_salv_table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735598#M1457780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again:)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You don't need to create fieldcatalog when using &lt;EM&gt;cl_salv...&lt;/EM&gt; classes. You simply pass your internal table and &lt;EM&gt;factory&lt;/EM&gt; method will create fieldcat for you.&lt;/P&gt;&lt;P&gt;So you only need to change column header if you want. Please refer &lt;SPAN __jive_macro_name="thread" id="1239683"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Mar 2010 07:57:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735598#M1457780</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2010-03-23T07:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: Class:cl_salv_table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735599#M1457781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;nice to see your reply.Its the same problem of the previous thread.BUT now we are using a different Class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get the ALV displayed by default without passing the internal table fieldcatalog for  the columns, but the Field names need to be assigned to the dynamic fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*Dynamic fields
    LOOP AT i_tckh3 INTO w_tckh3.
      LOOP AT i_tckh1 INTO w_tckh1 WHERE elemt = w_tckh3-elemt.
        lcount = lcount + 1.
        WRITE w_tckh1-txele TO w_fieldcat-seltext   LEFT-JUSTIFIED.
        WRITE w_tckh1-txele TO w_fieldcat-coltext   LEFT-JUSTIFIED.
        CONCATENATE 'KST' w_tckh3-el_hv INTO w_fieldcat-fieldname.
        TRANSLATE w_fieldcat-fieldname              TO UPPER CASE.
        w_fieldcat-col_pos   =  lcount.
        w_fieldcat-ref_field = 'KST001'.
        w_fieldcat-ref_table = 'KEPH'.
        w_fieldcat-datatype  = 'CURR'.
        APPEND w_fieldcat TO i_fieldcat.
        CLEAR  w_fieldcat.
        CLEAR: w_tckh1.
      ENDLOOP.
      CLEAR:w_tckh3.
    ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any specific method i can use to solve this issue.&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;I Hope you got the points assigned for the last thread.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Mar 2010 08:29:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735599#M1457781</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-23T08:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: Class:cl_salv_table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735600#M1457782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I got the points, thank you:)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for the issue, I think you don't need to worry about fieldcatalog. You pass the dynamic table, system creates internally fieldcatalog for you. The only required change is that you need to assign repective coulmn header to based on dynamic table (or fieldcatlaog).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So after factory method is called, you first...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
"...get  all the ALV columns 
 data: lr_columns type ref to cl_salv_columns_table,
        lr_column  type ref to cl_salv_column_table.
 
  lr_columns = gr_table-&amp;gt;get_columns( ). 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...and then change caption for each column one by one&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT i_tckh1 INTO w_tckh1 WHERE elemt = w_tckh3-elemt.
       ....     
        CONCATENATE 'KST' w_tckh3-el_hv INTO w_fieldcat-fieldname.
        TRANSLATE w_fieldcat-fieldname              TO UPPER CASE.

      
      lr_column ?= lr_columns-&amp;gt;get_column( w_fieldcat-fieldname ).  "get this column from ALV
      lr_column-&amp;gt;set_short_text( w_tckh1-txele ).  "set  text for it
      lr_column-&amp;gt;set_medium_text( w_tckh1-txele ).
      lr_column-&amp;gt;set_long_text( w_tckh1-txele  ).
...
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So this way you do a change directly on fieldcatalog which was created by the system. Now when you refresh the output you will have correct headers for your dynamic table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Mar 2010 08:54:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735600#M1457782</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2010-03-23T08:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: Class:cl_salv_table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735601#M1457783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Marcin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thats perfectly Great option &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but when we have assigend&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;lr_column-&amp;gt;set_long_text( w_tckh1-txele  )&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;its giving error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;W_tckh1-txele is not TYPE COMPATIBLE with formal parameter "VALUE".&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Mar 2010 09:17:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735601#M1457783</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-23T09:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Class:cl_salv_table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735602#M1457784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to cast it first, as the method expects parameter of different type:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: m_text type SCRTEXT_M,
         s_text type SCRTEXT_S,
         l_text type SCRTEXT_L.

s_text = m_text = l_text = w_tckh1-txele.
lr_column-&amp;gt;set_short_text( s_text ).  
lr_column-&amp;gt;set_medium_text( m_text ).
lr_column-&amp;gt;set_long_text( l_text  ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This should help&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Mar 2010 09:24:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735602#M1457784</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2010-03-23T09:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: Class:cl_salv_table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735603#M1457785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Marcin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are an SAP Expert &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Mar 2010 09:32:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735603#M1457785</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-23T09:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: Class:cl_salv_table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735604#M1457786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wish I would be one;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Mar 2010 09:34:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735604#M1457786</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2010-03-23T09:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: Class:cl_salv_table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735605#M1457787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You sure are!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have worked on Dynamic Fieldcatalog and internal table for the first time,and I don't think I would have been able to complete the code without your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your prompt responses made it easy and clear to understand as to what the procedure is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Mar 2010 09:42:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-cl-salv-table/m-p/6735605#M1457787</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-23T09:42:03Z</dc:date>
    </item>
  </channel>
</rss>

