<?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: Problem with ALV Report Column in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915684#M686376</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is very simple -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am also attaching sample code. But here are the steps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose Your final internal table name is IT_FINAL. Make sure that all fields are declared as LIKE and not TYPE when you are referring to a database field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For eg : EBELN LIKE EKKO-EBELN  &amp;amp; it should not be like EBELN TYPE EKKO-EBELN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then call fm REUSE_ALV_FIELDCATALOG_MERGE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;To build the Field Catlog.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  data : l_tabname type slis_tabname.  " Table Name&lt;/P&gt;&lt;P&gt;  l_tabname = 'TB_FINAL'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  refresh : tb_fieldcat.&lt;/P&gt;&lt;P&gt;  clear   : tb_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call function 'REUSE_ALV_FIELDCATALOG_MERGE'&lt;/P&gt;&lt;P&gt;       exporting&lt;/P&gt;&lt;P&gt;            i_program_name         = g_repid&lt;/P&gt;&lt;P&gt;            i_internal_tabname     = l_tabname&lt;/P&gt;&lt;P&gt;            i_inclname             = g_repid&lt;/P&gt;&lt;P&gt;       changing&lt;/P&gt;&lt;P&gt;            ct_fieldcat            = tb_fieldcat&lt;/P&gt;&lt;P&gt;       exceptions&lt;/P&gt;&lt;P&gt;            inconsistent_interface = 1&lt;/P&gt;&lt;P&gt;            program_error          = 2&lt;/P&gt;&lt;P&gt;            others                 = 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    message id sy-msgid type sy-msgty number sy-msgno&lt;/P&gt;&lt;P&gt;            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TB_FIELDCAT declaration : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:  tb_fieldcat     type slis_t_fieldcat_alv,  " Field Catalog&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TB_FIELDCAT will contain the fieldcatalog for the internal table TB_FINAL. This you can pass to ALV report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can modify the field catalog to add DO_SUM parameters:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Getting the Header Text for the Coloumns&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  loop at tb_fieldcat into x_fieldcat.&lt;/P&gt;&lt;P&gt;    clear l_tabix.&lt;/P&gt;&lt;P&gt;    l_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    case x_fieldcat-fieldname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sales Org&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      when 'VKORG'.&lt;/P&gt;&lt;P&gt;        x_fieldcat-seltext_l = 'Sales Org'(001).&lt;/P&gt;&lt;P&gt;        x_fieldcat-ddictxt   =  l_ddictxt.&lt;/P&gt;&lt;P&gt;        x_fieldcat-key       = c_x.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Channel&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      when 'MENGE'.&lt;/P&gt;&lt;P&gt;        x_fieldcat-do_sum       = c_x.&lt;/P&gt;&lt;P&gt;    endcase.&lt;/P&gt;&lt;P&gt;    modify tb_fieldcat from x_fieldcat index l_tabix.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also check this link -&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="4139116"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ashish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Oct 2007 21:32:50 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-10-22T21:32:50Z</dc:date>
    <item>
      <title>Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915679#M686371</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;I have ALV report that got tons of columns and most of them are showing correctly. But there are two or three where i have a do sum checked got a small problem. The HEADING of the columns says NUMBER instead of its column name...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Look at my code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
********************************************************
  ls_fieldcat-fieldname      =      'ETIME'.
  ls_fieldcat-ref_tabname    =      'REC'.
  ls_fieldcat-ref_fieldname  =      'ETIME'.
  ls_fieldcat-seltext_s      =      'ET      '.
  ls_fieldcat-seltext_m      =      'Et Tm           '.
  ls_fieldcat-seltext_l      =   'End Time             '.
  append ls_fieldcat to pt_fieldcat.
*****************************************************
  ls_fieldcat-fieldname      =                'HOURS'.
  ls_fieldcat-ref_tabname    =                'PC2BF'.
  ls_fieldcat-ref_fieldname  =                'ANZHL'.
  ls_fieldcat-seltext_s      =                'Hrs    '.
  ls_fieldcat-seltext_m      =                'Hors '.
  ls_fieldcat-seltext_l      =                'Hours'.
  ls_fieldcat-decimals_out = 2.
  ls_fieldcat-no_zero = 'X'.
  ls_fieldcat-datatype = 'DEC'.
  ls_fieldcat-do_sum = 'X'.
  append ls_fieldcat to pt_fieldcat.
  ls_fieldcat-no_zero = ''.
  ls_fieldcat-datatype = ''.
  ls_fieldcat-outputlen = ''.
  ls_fieldcat-do_sum = ''.
  ls_fieldcat-decimals_out = ''.
  ls_fieldcat-fieldname = ''.
******************************************************
  ls_fieldcat-fieldname      =                'PNUMB'.
  ls_fieldcat-ref_tabname    =                'PC20E'.
  ls_fieldcat-ref_fieldname  =                'PRAKN'.
  ls_fieldcat-seltext_s      =                'P#     '.
  ls_fieldcat-seltext_m      =     'Pre #       '.
  ls_fieldcat-seltext_l      =   'Premium #           '.
  ls_fieldcat-datatype       =                'NUMC'.
  append ls_fieldcat to pt_fieldcat.
  ls_fieldcat-datatype       = ''.
*************************************************
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The column with Hours is showing NUMBER with the total sum but the column before and after that shows correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried taken out the&lt;/P&gt;&lt;P&gt; &amp;lt;b&amp;gt; ls_fieldcat-do_sum = 'X'.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then its shows correctly but i need it to do the sum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there anything i need to do in order to show the columns correctly?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help. &amp;lt;b&amp;gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&amp;lt;/b&amp;gt;. thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Anwarul Kabir&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Anwarul Kabir&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Alvaro Tejada Galindo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2007 21:00:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915679#M686371</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-22T21:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915680#M686372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How are generating your field catalog? Are you using function module - REUSE_ALV_FIELDCATALOG_MERGE?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ashish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2007 21:18:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915680#M686372</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-22T21:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915681#M686373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No actually that's all what i am doing to build the catalog. I add each column to   append ls_fieldcat to pt_fieldcat and pass that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*************************************************
* BUILD_FIELD_CATALOG
************************************************
form build_field_catalog USING pt_fieldcat type
                               slis_t_fieldcat_alv.
  data:  ls_fieldcat type slis_fieldcat_alv.
  clear: fieldcat, pt_fieldcat[].
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Anwarul Kabir&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2007 21:22:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915681#M686373</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-22T21:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915682#M686374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why don't you use the function module instead of populating field catalog manually?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2007 21:24:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915682#M686374</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-22T21:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915683#M686375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hmm because i don't know &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; that's how i found a code and i am following that...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO you have an example code so that in future i can follow that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2007 21:25:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915683#M686375</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-22T21:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915684#M686376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is very simple -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am also attaching sample code. But here are the steps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose Your final internal table name is IT_FINAL. Make sure that all fields are declared as LIKE and not TYPE when you are referring to a database field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For eg : EBELN LIKE EKKO-EBELN  &amp;amp; it should not be like EBELN TYPE EKKO-EBELN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then call fm REUSE_ALV_FIELDCATALOG_MERGE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;To build the Field Catlog.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  data : l_tabname type slis_tabname.  " Table Name&lt;/P&gt;&lt;P&gt;  l_tabname = 'TB_FINAL'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  refresh : tb_fieldcat.&lt;/P&gt;&lt;P&gt;  clear   : tb_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call function 'REUSE_ALV_FIELDCATALOG_MERGE'&lt;/P&gt;&lt;P&gt;       exporting&lt;/P&gt;&lt;P&gt;            i_program_name         = g_repid&lt;/P&gt;&lt;P&gt;            i_internal_tabname     = l_tabname&lt;/P&gt;&lt;P&gt;            i_inclname             = g_repid&lt;/P&gt;&lt;P&gt;       changing&lt;/P&gt;&lt;P&gt;            ct_fieldcat            = tb_fieldcat&lt;/P&gt;&lt;P&gt;       exceptions&lt;/P&gt;&lt;P&gt;            inconsistent_interface = 1&lt;/P&gt;&lt;P&gt;            program_error          = 2&lt;/P&gt;&lt;P&gt;            others                 = 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    message id sy-msgid type sy-msgty number sy-msgno&lt;/P&gt;&lt;P&gt;            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TB_FIELDCAT declaration : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:  tb_fieldcat     type slis_t_fieldcat_alv,  " Field Catalog&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TB_FIELDCAT will contain the fieldcatalog for the internal table TB_FINAL. This you can pass to ALV report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can modify the field catalog to add DO_SUM parameters:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Getting the Header Text for the Coloumns&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  loop at tb_fieldcat into x_fieldcat.&lt;/P&gt;&lt;P&gt;    clear l_tabix.&lt;/P&gt;&lt;P&gt;    l_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    case x_fieldcat-fieldname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sales Org&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      when 'VKORG'.&lt;/P&gt;&lt;P&gt;        x_fieldcat-seltext_l = 'Sales Org'(001).&lt;/P&gt;&lt;P&gt;        x_fieldcat-ddictxt   =  l_ddictxt.&lt;/P&gt;&lt;P&gt;        x_fieldcat-key       = c_x.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Channel&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      when 'MENGE'.&lt;/P&gt;&lt;P&gt;        x_fieldcat-do_sum       = c_x.&lt;/P&gt;&lt;P&gt;    endcase.&lt;/P&gt;&lt;P&gt;    modify tb_fieldcat from x_fieldcat index l_tabix.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also check this link -&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="4139116"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ashish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2007 21:32:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915684#M686376</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-22T21:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915685#M686377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks for the code. I will certainly try it next time. But i think for this report it won't work as i have some TYPE columns. and One of them is the hours which is giving me the problem...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2007 21:35:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915685#M686377</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-22T21:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915686#M686378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you change the declaration of column HOURS from TYPE to LIKE? How did you declare this field in your final internal table? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please change once and see. It should work. I am not sure why but TYPE declaration does not work in ALV (when you declare fields using TYPE and data dictionary reference)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ashish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2007 21:41:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915686#M686378</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-22T21:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915687#M686379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well actually i changed it because of the SUM_DO thing. I guess i can change back to its original field and see in your way weather it works or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't have enough time to do so today i will start that tomorow and will let you know how it went...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2007 21:44:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915687#M686379</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-22T21:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915688#M686380</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;I was working on anew report and decided to do in your way. but its giving me Run time error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: BEGIN OF REC OCCURS 0,
  PERNR TYPE TEVEN-PERNR,
  LDATE TYPE TEVEN-LDATE,
  LTIME TYPE TEVEN-LTIME,
  SATZA TYPE TEVEN-SATZA,
  TERID TYPE TEVEN-TERID,
  PLANS TYPE TEVEN-PLANS.


DATA: END OF REC.

...
*************************************************
*  CALL_ALV
**************************************************
form call_alv.

  perform build_field_catalog using field_tab[].
  perform build_eventtab      using events[].
  perform comment_build       using header_alv[].
  perform build_sorttab       using gt_sort[].
  perform build_layout.
* Call ABAP List Viewer
  call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
      i_callback_program      = v_repid
      i_callback_user_command = 'ALV_USER_COMMAND'
      i_structure_name        = 'REC'
      it_fieldcat             = field_tab[]
      it_special_groups       = gt_sp_group[]
      it_sort                 = gt_sort[]
      i_save                  = v_save
      is_variant              = v_variant
      it_events               = events[]
      is_layout               = gd_layout
    tables
      t_outtab                 = REC
    exceptions
      program_error            = 1
      others                   = 2.

endform.                    "call_alv

*********************************************
* BUILD_FIELD_CATALOG
*****************************************
form build_field_catalog USING pt_fieldcat type
                               slis_t_fieldcat_alv.
  data:  ls_fieldcat type slis_fieldcat_alv.
  clear: fieldcat, pt_fieldcat[].

  call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    exporting
      i_program_name = v_repid
      i_internal_tabname = REC
      i_inclname = v_repid
    changing
      ct_fieldcat = ls_fieldcat
    exceptions
      inconsistent_interface = 1
      program_error = 2
      others = 3.

  if sy-subrc &amp;lt;&amp;gt; 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
 else.
    append ls_fieldcat to pt_fieldcat.
  endif.


endform.                    "build_field_catalog

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Anwarul Kabir&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2007 15:39:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915688#M686380</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-01T15:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915689#M686381</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;Change declaration of REC from TYPE to LIKE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF REC OCCURS 0,&lt;/P&gt;&lt;P&gt;  PERNR LIKE TEVEN-PERNR,&lt;/P&gt;&lt;P&gt;  LDATE LIKE TEVEN-LDATE,&lt;/P&gt;&lt;P&gt;  LTIME LIKE TEVEN-LTIME,&lt;/P&gt;&lt;P&gt;  SATZA LIKE TEVEN-SATZA,&lt;/P&gt;&lt;P&gt;  TERID LIKE TEVEN-TERID,&lt;/P&gt;&lt;P&gt;  PLANS LIKE TEVEN-PLANS.&lt;/P&gt;&lt;P&gt;DATA: END OF REC. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In field catalog merge function module, keep a break point and check if field catalog is generated after the function call.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ashish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2007 15:45:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915689#M686381</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-01T15:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915690#M686382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok changed it but as soon as i hit F5 on the call function it breaks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One thing i want to mention here not all the fields have data. but that shouldn't be a reason the error should it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Anwarul Kabir&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2007 15:48:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915690#M686382</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-01T15:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915691#M686383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Change declaration of ls_fieldcat. Also it should be declared as a global variable as you are going to use this in the display function module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:  tb_fieldcat     type slis_t_fieldcat_alv.  " Field Catalog&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ashish&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: Change your display function module call parameters -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Call ABAP List Viewer&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call function 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      i_callback_program      = v_repid&lt;/P&gt;&lt;P&gt;      i_callback_user_command = 'ALV_USER_COMMAND'&lt;/P&gt;&lt;P&gt;      i_structure_name        = 'REC'&lt;/P&gt;&lt;P&gt;      it_fieldcat             = field_tab&lt;/P&gt;&lt;P&gt;      it_special_groups       = gt_sp_group&lt;/P&gt;&lt;P&gt;      it_sort                 = gt_sort&lt;/P&gt;&lt;P&gt;      i_save                  = v_save&lt;/P&gt;&lt;P&gt;      is_variant              = v_variant&lt;/P&gt;&lt;P&gt;      it_events               = events&lt;/P&gt;&lt;P&gt;      is_layout               = gd_layout&lt;/P&gt;&lt;P&gt;    tables&lt;/P&gt;&lt;P&gt;      t_outtab                 = REC&lt;/P&gt;&lt;P&gt;    exceptions&lt;/P&gt;&lt;P&gt;      program_error            = 1&lt;/P&gt;&lt;P&gt;      others                   = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Ashish Gundawar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2007 15:54:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915691#M686383</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-01T15:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915692#M686384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;here is what i have done so far&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Changed declaraion of REC from TYPE to LIKE, &lt;/P&gt;&lt;P&gt;changed ls_fieldcat type slis_t_fieldcat_alv&lt;/P&gt;&lt;P&gt;and made it global.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Still the same error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2007 16:05:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915692#M686384</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-01T16:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915693#M686385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the error you are getting? Did you try to debug the code? Also check the dump analysis, it helps to fix the problem. I believe as the dump occurs on function call, you might not have declared parameters passed to function module correctly. There is type conflict.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ashish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2007 16:07:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915693#M686385</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-01T16:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915694#M686386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok i have also chaged my&lt;/P&gt;&lt;P&gt; call function 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But its not even going that far.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also found the in the merge function when i was passing the table name i didn't use ' ' now i have done that and it still errors out. here what its says&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ_REPORT_LINE_TOO_LONG&lt;/P&gt;&lt;P&gt;the current ABAP application program "SAPLSKBH" had to be terminated because one of the statements could not be executed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2007 16:12:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915694#M686386</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-01T16:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915695#M686387</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;Have you made changes to function module ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'REUSE_ALV_FIELDCATALOG_MERGE'&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      i_program_name = v_repid (Should be declared LIKE SY-REPID)&lt;/P&gt;&lt;P&gt;      i_internal_tabname = REC (a variable should be declared LIKE SLIS_TABNAME, and pass value of REC to this variable)&lt;/P&gt;&lt;P&gt;      i_inclname = v_repid&lt;/P&gt;&lt;P&gt;    changing&lt;/P&gt;&lt;P&gt;      ct_fieldcat = ls_fieldcat (Ihave already told you about this one)&lt;/P&gt;&lt;P&gt;    exceptions&lt;/P&gt;&lt;P&gt;      inconsistent_interface = 1&lt;/P&gt;&lt;P&gt;      program_error = 2&lt;/P&gt;&lt;P&gt;      others = 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ashish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2007 16:16:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915695#M686387</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-01T16:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915696#M686388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no i didn't made any changes tot he function it self...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;v_repid is declared as sy-Repid and it holds the report name (i debuged it)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REC is declared as an internal table. so i should just declare a Variable as slis_tabname and move all data from rec to that variable and pass that as i_internal_tabname?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2007 16:20:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915696#M686388</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-01T16:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915697#M686389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you see parameter i_internal_tabname, it is a character variable which will hold table name.&lt;/P&gt;&lt;P&gt;When you need to generate field catalog, you need to pass internal table NAME for whom you want to generate field catalog (we are not talking about data here). So declare a variable of type slis_tabname and pas svalue of REC to this variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: V_TABNAME TYPE slis_tabname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;V_TABNAME = 'REC'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now pass V_TABNAME to the function module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ashish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2007 16:24:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915697#M686389</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-01T16:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with ALV Report Column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915698#M686390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;here is the whole program. you can upload this run it for your self if that helps in any way...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*&amp;amp;---------------------------*
*&amp;amp; Report  ZHEADCOUNT       *
*&amp;amp;              *


REPORT  ZHEADCOUNT no standard page 
heading message-id zw line-size 255.
*--------------------------------------------
*       Dictionary tables/structures
*--------------------------------------------
tables: teven,
        ZSHIFTS,
        ZHEADCT.
* Global ALV Data Declarations
type-pools slis.

include: rpcxB200, RPTBAL01.

DATA: BEGIN OF REC OCCURS 0,
  PERNR LIKE TEVEN-PERNR,
  LDATE LIKE TEVEN-LDATE,
  LTIME LIKE TEVEN-LTIME,
  SATZA LIKE TEVEN-SATZA,
  TERID LIKE TEVEN-TERID,
  PLANS LIKE TEVEN-PLANS.


DATA: END OF REC.

data:
  begin of x_sortinfo_alv occurs 0,
      spos                  like alvdynp-sortpos,
      fieldname             type slis_fieldname,
      tabname               type slis_fieldname,
      up                    like alvdynp-sortup,
      down                  like alvdynp-sortdown,
      group                 like alvdynp-grouplevel,
      subtot                like alvdynp-subtotals,
      comp(1)               type c,
      expa(1)               type c,
      obligatory(1)         type c,
    end   of x_sortinfo_alv,
    d                like scal-indicator,   
    v_variant        like disvariant,
    v_repid          like sy-repid,
    v_save(1)        type c,
    lv_sortseq       type i,
    s_title(20),     
    fieldcat         type slis_t_fieldcat_alv,
    ls_line          type slis_listheader,
    gd_layout        type slis_layout_alv,
    gt_sp_group      type slis_t_sp_group_alv,
    gt_sort          type slis_t_sortinfo_alv,
    ls_sort          type slis_sortinfo_alv,
    events           type slis_t_event,
    list_top_of_page type slis_t_listheader,
    top_of_page      type slis_formname value 'TOP_OF_PAGE',
    v_exit(1)        type c,
    v_pdsnr like assob-pdsnr,
    ls_fieldcat type slis_t_fieldcat_alv.

constants:
  alv_slis_formname       type slis_formname value 'ALV_USER_COMMAND',
  c_yes                   like space value 'X',
  c_no                    like space value space,
  c_dev LIKE  sy-sysid VALUE 'DEV',
  c_device(4) TYPE c   VALUE 'LOCL'.
*********************************
* define selection screen
*********************************
selection-screen begin of block elmo with frame title text-001.
selection-screen begin of line.
selection-screen comment 1(30) text-002.
select-options  p_terid for TEVEN-TERID.
selection-screen end of line.

selection-screen begin of line.
selection-screen comment 1(30) text-003.
select-options p_shift for ZSHIFTS-DWS.
selection-screen end of line.
selection-screen end of block elmo.

selection-screen begin of block blk2 with frame title text-004.
PARAMETERS: p_vari like disvariant-variant.
selection-screen end   of block blk2.

******************
*  Form  Initialization
**************************
initialization.
  v_repid = sy-repid.
  v_save = 'A'.
  clear v_variant.
  v_variant-report = v_repid.

* Get default variant
  alv_variant = v_variant.
  call function 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
      i_save     = v_save
    CHANGING
      cs_variant = alv_variant
    EXCEPTIONS
      not_found  = 2.
  if sy-subrc = 0.
    p_vari = alv_variant-variant.
  endif.
*------------------------------------
*  At Selection-Screen event (value help)
*-----------------------------------
at selection-screen on value-request for p_vari.
  perform f4_for_variant.
*--------------------------
*  At Selection-Screen event (check input data)
*----------------------------------------
at selection-screen on p_vari.
  if p_vari &amp;lt;&amp;gt; space.
    v_variant-report  = v_repid.
    v_variant-variant = p_vari.
    call function 'REUSE_ALV_VARIANT_SELECT'
      EXPORTING
        i_dialog            = c_no
        it_default_fieldcat = field_tab[]
        i_layout            = gs_layout
      CHANGING
        cs_variant          = v_variant.
    if sy-subrc &amp;lt;&amp;gt; 0.
      call function 'REUSE_ALV_VARIANT_SELECT'
        EXPORTING
          i_dialog            = c_yes
          it_default_fieldcat = field_tab[]
          i_layout            = gs_layout
        CHANGING
          cs_variant          = v_variant.
    endif.
  endif.
*------------------------------------
*                       main logic
*------------------------------------
TOP-OF-PAGE.

START-OF-SELECTION.

GET PERNR.
  RP-PROVIDE-FROM-LAST P0001 SPACE PNPBEGDA PNPENDDA.
* process the data according to the payroll area
  IF PERNR-WERKS EQ P0001-WERKS AND PERNR-BTRTL EQ P0001-BTRTL
     AND PERNR-KOSTL EQ P0001-KOSTL AND PERNR-BUKRS EQ P0001-BUKRS
     AND PERNR-ABKRS EQ P0001-ABKRS AND PERNR-KOKRS EQ P0001-KOKRS.
    PERFORM RETRIEVE_Time.
  ENDIF.

END-OF-SELECTION.
  Perform call_alv.
*==================================*
*                   *
*=================================*
FORM RETRIEVE_Time.

 Clear: REC.

       Select * from teven where PERNR EQ PERNR-PERNR
                             AND TERID IN p_terid
                             AND LDATE &amp;gt;= PNPBEGDA
                             AND LDATE &amp;lt;= PNPENDDA.
            MOVE:
                 TEVEN-PERNR TO REC-PERNR,
                 TEVEN-LDATE TO REC-LDATE,
                 TEVEN-LTIME TO REC-LTIME,
                 TEVEN-SATZA TO REC-SATZA,
                 TEVEN-TERID TO REC-TERID,
                 TEVEN-PLANS TO REC-PLANS.

            APPEND REC.
       endselect.
ENDFORM.                            " RETRIEVE_PAYROLL

*********************************
*  CALL_ALV
******************************
form call_alv.

  perform build_field_catalog using field_tab[].
  perform build_eventtab      using events[].
  perform comment_build       using header_alv[].
  perform build_sorttab       using gt_sort[].
  perform build_layout.
* Call ABAP List Viewer
  call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
      i_callback_program      = v_repid
      i_callback_user_command = 'ALV_USER_COMMAND'
      i_structure_name        = 'REC'
      it_fieldcat             = field_tab
      it_special_groups       = gt_sp_group
      it_sort                 = gt_sort
      i_save                  = v_save
      is_variant              = v_variant
      it_events               = events
      is_layout               = gd_layout
    tables
      t_outtab                 = REC
    exceptions
      program_error            = 1
      others                   = 2.

endform.                    "call_alv
************************************
* BUILD_FIELD_CATALOG
*********************************
form build_field_catalog USING pt_fieldcat type
                               slis_t_fieldcat_alv.
*  data:  ls_fieldcat type slis_fieldcat_alv.
  clear: fieldcat, pt_fieldcat[].

  data : l_tabname type slis_tabname. " Table Name
   l_tabname = 'REC'.


  call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    exporting
      i_program_name = v_repid
      i_internal_tabname = l_tabname
      i_inclname = v_repid
    changing
      ct_fieldcat = ls_fieldcat
    exceptions
      inconsistent_interface = 1
      program_error = 2
      others = 3.

  if sy-subrc &amp;lt;&amp;gt; 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  else.
*    append ls_fieldcat to pt_fieldcat.
  endif.


endform.                    "build_field_catalog
********************************
* BUILD_EVENTTAB
**************************
form build_eventtab using events type slis_t_event.
* Registration of events to happen during list display
  data: tmp_event type slis_alv_event.
  call function 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      i_list_type = 0
    IMPORTING
      et_events   = events.
  read table events with key name = slis_ev_top_of_page into tmp_event.

  if sy-subrc = 0.
    move top_of_page to tmp_event-form.
    append tmp_event to events.
  endif.
endform.                    "build_eventtab
*************************************
* COMMENT_BUILD
***********************************
form comment_build using pt_top_of_page type slis_t_listheader.
  data: v_head_string(255) value space, d1(2), m1(2), y1(2), d2(2), m2(2), y2(2).
  clear: ls_line, pt_top_of_page.
  ls_line-typ  = 'H'.
  data pnpfrom(10).
  data pnpto(10).
  data: print_date(10).
  data: print_time(10).
  d1 = PNPBEGDA+6(2).          d2 = PNPENDDA+6(2).
  m1 = PNPBEGDA+4(2).          m2 = PNPENDDA+4(2).
  y1 = PNPBEGDA+2(2).          y2 = PNPENDDA+2(2).
  concatenate m1 '/' d1 '/' y1 into pnpfrom.
  concatenate m2 '/' d2 '/' y2 into pnpto.
***********************************
  ls_line-info = sy-repid.
  append ls_line to pt_top_of_page.
********************************
  concatenate 'Printed by:' sy-uname 'on' print_date 'at' print_time
  into ls_line-info separated by space.
  append ls_line to pt_top_of_page.
**********************************
  ls_line-info = 'BGM INDUSTRIES, INC.'.
  append ls_line to pt_top_of_page.
*********************************
  concatenate 'Period:' pnpfrom 'to' pnpto
  into ls_line-info separated by space.
  append ls_line to pt_top_of_page.
********************************
endform.                    "comment_build
************************************
*       Build layout for ALV grid report
********************************
form build_layout.
  gd_layout-no_input          = 'X'.
  gd_layout-colwidth_optimize = 'X'.
*  gd_layout-totals_text       = 'Totals'(255).
*  gd_layout-info_fieldname    = 'LINE_COLOR'.
endform.                    " BUILD_LAYOUT
**********************************
* TOP_OF_PAGE
**********************************
form top_of_page.
  call function 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      i_logo             = 'Z_BGLOGO'
      it_list_commentary = header_alv.
endform.                    "top_of_page
*&amp;amp;---------------------------------
*&amp;amp;      Form  build_sorttab
*&amp;amp;-----------------------------------
*       Set up the sorting for the report.
*---------------------------------------
form build_sorttab using pt_sort type slis_t_sortinfo_alv.
  clear lv_sortseq.
* ******************************
  perform build_sort tables pt_sort changing ls_sort.
  ls_sort-fieldname = 'PERNR'.
  ls_sort-subtot    = 'X'.
endform.                    " build_sorttab
*******************************
*  Use to add another sort field.
*********************************
form build_sort
  tables   pt_sort
  changing ls_sort structure x_sortinfo_alv.
  clear ls_sort.
  add 1 to lv_sortseq.
  ls_sort-spos = lv_sortseq.
  ls_sort-up = 'X'.
  ls_sort-tabname = 'REC'.
endform.                    "build_sort


*&amp;amp;-----------------------------------
*&amp;amp;      Form  f4_for_variant
*&amp;amp;----------------------------------
form f4_for_variant.
  call function 'REUSE_ALV_VARIANT_F4'
    EXPORTING
      is_variant = v_variant
      i_save     = v_save
    IMPORTING
      e_exit     = v_exit
      es_variant = alv_variant
    EXCEPTIONS
      not_found  = 2.
  if sy-subrc = 2.
    message id sy-msgid type 'S' number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  else.
    if v_exit = space.
      p_vari = alv_variant-variant.
    endif.
  endif.
endform.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Anwarul Kabir&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2007 16:27:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-report-column/m-p/2915698#M686390</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-01T16:27:18Z</dc:date>
    </item>
  </channel>
</rss>

