<?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: ALV Data Grouping in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-data-grouping/m-p/4944736#M1153191</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vamshi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To do this, you probably need to maintain an internal table and a work area to sort records based upon the first four columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Declare a work area and an internal table.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA : it_sort TYPE slis_t_sortinfo_alv,
 wa_sort TYPE slis_sortinfo_alv.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, append the internal table using the work area to sort the internal table based upon the first four columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
wa_sort-spos = 1.
wa_sort-fieldname = 'EBELN'. "field name 1
wa_sort-tabname = 'IT_EKPO'. "internal table in which the records are selected
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.

wa_sort-spos = 2.
wa_sort-fieldname = 'EBELP'. "field name 2
wa_sort-tabname = 'IT_EKPO'. "internal table in which the records are selected
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.

wa_sort-spos = 3.
wa_sort-fieldname = 'MENGE'. "field name 3
wa_sort-tabname = 'IT_EKPO'. "internal table in which the records are selected
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.

wa_sort-spos = 4.
wa_sort-fieldname = 'NETPR'. "field name 4
wa_sort-tabname = 'IT_EKPO'. "internal table in which the records are selected
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, simply pass this internal table into the 'REUSE_ALV_GRID_DISPLAY'.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'.
 EXPORTING
  i_callback program = sy-repid "program report id
  is_fieldcat = it_field "for field catalogs
  it_sort = it_sort "your sort internal table
 TABLES
  t_outtab = it_ekpo "internal table from which the records will be displayed
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will generate the ALV output as per your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this solves your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Tarun Gambhir&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Dec 2008 17:31:52 GMT</pubDate>
    <dc:creator>I355602</dc:creator>
    <dc:date>2008-12-12T17:31:52Z</dc:date>
    <item>
      <title>ALV Data Grouping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-data-grouping/m-p/4944734#M1153189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I having an requirement. I have ALV report which shows the PO details as mentioned below.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;PO No      PO Item     PO Quan   PO Val   GR No    GR Qan   GR Val       GR Date   Pur.Req No    etc&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;12344           10             50.000    500.00    A12        15.000      150.00   10.12.2008    xx123&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;12344           10             50.000    500.00    A13        15.000      150.00   11.12.2008    xx124&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;12344           10             50.000    500.00    A14        20.000      300.00   12.12.2008    xx125&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Friends My requirement is similar data needs to be grouped as shown below.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;PO No      PO Item     PO Quan   PO Val   GR No    GR Qan   GR Val       GR Date   Pur.Req No    &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;12344           10             50.000    500.00    A12        15.000      150.00   10.12.2008    xx123&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;                                                                A13        15.000      150.00   11.12.2008    xx124&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;                                                                A14        20.000      300.00   12.12.2008   xx125&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dear Friends please provide some examples for this ASAP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thankq&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vamshi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Dec 2008 15:42:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-data-grouping/m-p/4944734#M1153189</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-11T15:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Data Grouping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-data-grouping/m-p/4944735#M1153190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Declare the four first columns as [sort criteria|https://www.sdn.sap.com/irj/scn/advancedsearch?query=sort&lt;EM&gt;criteria&lt;/EM&gt;ALV&lt;EM&gt;grid&lt;/EM&gt;it_sort+&amp;amp;cat=sdn_all], ALV (grid) will group the columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Dec 2008 15:47:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-data-grouping/m-p/4944735#M1153190</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2008-12-11T15:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Data Grouping</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-data-grouping/m-p/4944736#M1153191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vamshi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To do this, you probably need to maintain an internal table and a work area to sort records based upon the first four columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Declare a work area and an internal table.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA : it_sort TYPE slis_t_sortinfo_alv,
 wa_sort TYPE slis_sortinfo_alv.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, append the internal table using the work area to sort the internal table based upon the first four columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
wa_sort-spos = 1.
wa_sort-fieldname = 'EBELN'. "field name 1
wa_sort-tabname = 'IT_EKPO'. "internal table in which the records are selected
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.

wa_sort-spos = 2.
wa_sort-fieldname = 'EBELP'. "field name 2
wa_sort-tabname = 'IT_EKPO'. "internal table in which the records are selected
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.

wa_sort-spos = 3.
wa_sort-fieldname = 'MENGE'. "field name 3
wa_sort-tabname = 'IT_EKPO'. "internal table in which the records are selected
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.

wa_sort-spos = 4.
wa_sort-fieldname = 'NETPR'. "field name 4
wa_sort-tabname = 'IT_EKPO'. "internal table in which the records are selected
wa_sort-up = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, simply pass this internal table into the 'REUSE_ALV_GRID_DISPLAY'.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'.
 EXPORTING
  i_callback program = sy-repid "program report id
  is_fieldcat = it_field "for field catalogs
  it_sort = it_sort "your sort internal table
 TABLES
  t_outtab = it_ekpo "internal table from which the records will be displayed
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will generate the ALV output as per your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this solves your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Tarun Gambhir&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Dec 2008 17:31:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-data-grouping/m-p/4944736#M1153191</guid>
      <dc:creator>I355602</dc:creator>
      <dc:date>2008-12-12T17:31:52Z</dc:date>
    </item>
  </channel>
</rss>

