<?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 Reading dynamic table column based on user selection in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/reading-dynamic-table-column-based-on-user-selection/m-p/2693283#M623207</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am having a problem of reading and manipulating the data stored in a standard SAP table. The following example simulates the table and what i am trying to do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table: Storing sales data for sales person&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SALES_PERSON    REGION   YEAR   MTH_S1  MTH_S2  MTH_S3 MTH_S4...&lt;/P&gt;&lt;P&gt;Richard  S               NORTH    2007     100          200         300        400&lt;/P&gt;&lt;P&gt;John K                    SOUTH    2007      50           100         100        20&lt;/P&gt;&lt;P&gt;Brad P                    NORTH    2007     300          100         100        50&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;User have have the following selection option:&lt;/P&gt;&lt;P&gt;1. Month.&lt;/P&gt;&lt;P&gt;The program will calculate the sales based on the individual month selected&lt;/P&gt;&lt;P&gt;Example, if user select Month = 3, then program take only MTH_S3 column value&lt;/P&gt;&lt;P&gt;So total sales = 300&lt;EM&gt;100&lt;/EM&gt;100=500&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Month range&lt;/P&gt;&lt;P&gt;The program will calculate the sales based on the month range selected&lt;/P&gt;&lt;P&gt;Example, if user select Month 2 to 4, then program take MTH 2 to MTH_S4 columns value&lt;/P&gt;&lt;P&gt;So total sales = 400 (for MTH_S2) + 500 (for MTH_S3) + 470 (for MTH_S4) = 1370&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How should i write the logic or code for this requirement?&lt;/P&gt;&lt;P&gt;Hope someone can help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Pang HK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Aug 2007 11:10:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-14T11:10:55Z</dc:date>
    <item>
      <title>Reading dynamic table column based on user selection</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reading-dynamic-table-column-based-on-user-selection/m-p/2693283#M623207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am having a problem of reading and manipulating the data stored in a standard SAP table. The following example simulates the table and what i am trying to do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table: Storing sales data for sales person&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SALES_PERSON    REGION   YEAR   MTH_S1  MTH_S2  MTH_S3 MTH_S4...&lt;/P&gt;&lt;P&gt;Richard  S               NORTH    2007     100          200         300        400&lt;/P&gt;&lt;P&gt;John K                    SOUTH    2007      50           100         100        20&lt;/P&gt;&lt;P&gt;Brad P                    NORTH    2007     300          100         100        50&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;User have have the following selection option:&lt;/P&gt;&lt;P&gt;1. Month.&lt;/P&gt;&lt;P&gt;The program will calculate the sales based on the individual month selected&lt;/P&gt;&lt;P&gt;Example, if user select Month = 3, then program take only MTH_S3 column value&lt;/P&gt;&lt;P&gt;So total sales = 300&lt;EM&gt;100&lt;/EM&gt;100=500&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Month range&lt;/P&gt;&lt;P&gt;The program will calculate the sales based on the month range selected&lt;/P&gt;&lt;P&gt;Example, if user select Month 2 to 4, then program take MTH 2 to MTH_S4 columns value&lt;/P&gt;&lt;P&gt;So total sales = 400 (for MTH_S2) + 500 (for MTH_S3) + 470 (for MTH_S4) = 1370&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How should i write the logic or code for this requirement?&lt;/P&gt;&lt;P&gt;Hope someone can help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Pang HK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2007 11:10:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reading-dynamic-table-column-based-on-user-selection/m-p/2693283#M623207</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-14T11:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: Reading dynamic table column based on user selection</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reading-dynamic-table-column-based-on-user-selection/m-p/2693284#M623208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;plz specify the table u r using i mean the standard sap table&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2007 11:22:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reading-dynamic-table-column-based-on-user-selection/m-p/2693284#M623208</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-14T11:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Reading dynamic table column based on user selection</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reading-dynamic-table-column-based-on-user-selection/m-p/2693285#M623209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try something like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES:&lt;/P&gt;&lt;P&gt; t247.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS:&lt;/P&gt;&lt;P&gt;  s_month FOR t247-mnr NO-EXTENSION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;  BEGIN OF fs_data,&lt;/P&gt;&lt;P&gt;    person(30),&lt;/P&gt;&lt;P&gt;    area(10),&lt;/P&gt;&lt;P&gt;    year(4),&lt;/P&gt;&lt;P&gt;    mon1 TYPE kbetr,&lt;/P&gt;&lt;P&gt;    mon2 TYPE kbetr,&lt;/P&gt;&lt;P&gt;    mon3 TYPE kbetr,&lt;/P&gt;&lt;P&gt;    mon4 TYPE kbetr,&lt;/P&gt;&lt;P&gt;    mon5 TYPE kbetr,&lt;/P&gt;&lt;P&gt;  END OF fs_data,&lt;/P&gt;&lt;P&gt;  t_data LIKE STANDARD TABLE OF fs_data,&lt;/P&gt;&lt;P&gt;  w_no_months TYPE i,&lt;/P&gt;&lt;P&gt;  w_kbetr TYPE kbetr,&lt;/P&gt;&lt;P&gt;  w_total TYPE kbetr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT t_data INTO fs_data.&lt;/P&gt;&lt;P&gt;    CLEAR w_kbetr.&lt;/P&gt;&lt;P&gt;    DO 5 TIMES VARYING w_kbetr FROM fs_data-mon1&lt;/P&gt;&lt;P&gt;                                                      NEXT fs_data-mon2.&lt;/P&gt;&lt;P&gt;    IF sy-index IN s_month.&lt;/P&gt;&lt;P&gt;      w_total = w_total + w_kbetr.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;    ENDDO.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;change the value 5, according to the no.of months in ur internal table&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2007 11:48:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reading-dynamic-table-column-based-on-user-selection/m-p/2693285#M623209</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-14T11:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Reading dynamic table column based on user selection</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reading-dynamic-table-column-based-on-user-selection/m-p/2693286#M623210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using the FMBDT table&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2007 01:38:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reading-dynamic-table-column-based-on-user-selection/m-p/2693286#M623210</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-15T01:38:20Z</dc:date>
    </item>
  </channel>
</rss>

