<?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: Sort the classical report in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-the-classical-report/m-p/6802770#M1467684</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This example will help you for logic, here the fields are taken manually.&lt;/P&gt;&lt;P&gt;You can do it dynamically also, there are some methods available for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT abc NO STANDARD PAGE HEADING.

TYPE-POOLS:abap.

DATA:it TYPE TABLE OF marc.
DATA:wa TYPE marc.
TYPES:BEGIN OF ty,
      field1 TYPE abap_compname ,
      field2 TYPE abap_compname ,
      END OF ty.
DATA: wa_field TYPE ty.
DATA:lv_value TYPE char25,
     lv_field TYPE char25.

AT LINE-SELECTION.
  GET CURSOR FIELD lv_field VALUE lv_value.
  SORT it BY (lv_value) ASCENDING.
  sy-lsind = 0.
  PERFORM write_data.

START-OF-SELECTION.
  SELECT * FROM marc INTO TABLE it UP TO 100 ROWS.
  wa_field-field1 = 'MATNR'.
  wa_field-field2 = 'WERKS'.
  PERFORM write_data.

FORM write_data .
  WRITE AT 1 wa_field-field1 HOTSPOT ON.
  WRITE AT 19 sy-vline.
  WRITE AT 20 wa_field-field2 HOTSPOT ON.
  WRITE AT 25 sy-vline.
  HIDE wa_field.

  WRITE /  sy-uline.
  LOOP AT it INTO wa.
    WRITE:/1 wa-matnr,
          19 sy-vline,
          20 wa-werks,
          25 sy-vline.
  ENDLOOP.
ENDFORM.                    " WRITE_DATA
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 31 Mar 2010 09:12:12 GMT</pubDate>
    <dc:creator>kesavadas_thekkillath</dc:creator>
    <dc:date>2010-03-31T09:12:12Z</dc:date>
    <item>
      <title>Sort the classical report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-the-classical-report/m-p/6802767#M1467681</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 a classical report. Now on the report screen I want to sort the report by clicking on column headings.&lt;/P&gt;&lt;P&gt;How can we sort the classical report?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;RH&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Mar 2010 13:31:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-the-classical-report/m-p/6802767#M1467681</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-30T13:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Sort the classical report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-the-classical-report/m-p/6802768#M1467682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;catch the click, recognize on what the user clicked and then sort your Internal table by the field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then process again your write statements.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Mar 2010 13:33:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-the-classical-report/m-p/6802768#M1467682</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-30T13:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Sort the classical report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-the-classical-report/m-p/6802769#M1467683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for reply but how to do that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Mar 2010 07:22:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-the-classical-report/m-p/6802769#M1467683</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-31T07:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Sort the classical report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-the-classical-report/m-p/6802770#M1467684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This example will help you for logic, here the fields are taken manually.&lt;/P&gt;&lt;P&gt;You can do it dynamically also, there are some methods available for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT abc NO STANDARD PAGE HEADING.

TYPE-POOLS:abap.

DATA:it TYPE TABLE OF marc.
DATA:wa TYPE marc.
TYPES:BEGIN OF ty,
      field1 TYPE abap_compname ,
      field2 TYPE abap_compname ,
      END OF ty.
DATA: wa_field TYPE ty.
DATA:lv_value TYPE char25,
     lv_field TYPE char25.

AT LINE-SELECTION.
  GET CURSOR FIELD lv_field VALUE lv_value.
  SORT it BY (lv_value) ASCENDING.
  sy-lsind = 0.
  PERFORM write_data.

START-OF-SELECTION.
  SELECT * FROM marc INTO TABLE it UP TO 100 ROWS.
  wa_field-field1 = 'MATNR'.
  wa_field-field2 = 'WERKS'.
  PERFORM write_data.

FORM write_data .
  WRITE AT 1 wa_field-field1 HOTSPOT ON.
  WRITE AT 19 sy-vline.
  WRITE AT 20 wa_field-field2 HOTSPOT ON.
  WRITE AT 25 sy-vline.
  HIDE wa_field.

  WRITE /  sy-uline.
  LOOP AT it INTO wa.
    WRITE:/1 wa-matnr,
          19 sy-vline,
          20 wa-werks,
          25 sy-vline.
  ENDLOOP.
ENDFORM.                    " WRITE_DATA
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Mar 2010 09:12:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-the-classical-report/m-p/6802770#M1467684</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-03-31T09:12:12Z</dc:date>
    </item>
  </channel>
</rss>

