<?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: read data randomly in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-data-randomly/m-p/2904402#M683115</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Get the random number using the RANDOM_AMOUNT function into lv_number&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then use the syntax&lt;/P&gt;&lt;P&gt;read table itab index lv_number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also, make sure than your lv_number value is not greater than the number of rows in your internal table&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Oct 2007 11:09:26 GMT</pubDate>
    <dc:creator>former_member189059</dc:creator>
    <dc:date>2007-10-30T11:09:26Z</dc:date>
    <item>
      <title>read data randomly</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-data-randomly/m-p/2904399#M683112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How can I read data records from an internal table in a random order?&lt;/P&gt;&lt;P&gt;My aim is to select records randomly from an internal table without speciafying a key.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 12:01:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-data-randomly/m-p/2904399#M683112</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-19T12:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: read data randomly</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-data-randomly/m-p/2904400#M683113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can select based on the index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Satish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 12:02:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-data-randomly/m-p/2904400#M683113</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-19T12:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: read data randomly</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-data-randomly/m-p/2904401#M683114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use RANDOM_AMOUNT to generate random number for index...&lt;/P&gt;&lt;P&gt;and read theline from itab corresponding to this index...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Oct 2007 12:08:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-data-randomly/m-p/2904401#M683114</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-19T12:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: read data randomly</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-data-randomly/m-p/2904402#M683115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Get the random number using the RANDOM_AMOUNT function into lv_number&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then use the syntax&lt;/P&gt;&lt;P&gt;read table itab index lv_number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also, make sure than your lv_number value is not greater than the number of rows in your internal table&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2007 11:09:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-data-randomly/m-p/2904402#M683115</guid>
      <dc:creator>former_member189059</dc:creator>
      <dc:date>2007-10-30T11:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: read data randomly</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-data-randomly/m-p/2904403#M683116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the function RANDOM_AMOUNT gives decimal numbers&lt;/P&gt;&lt;P&gt;Use this code to get only integers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZKRIS_RANDOM
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

report  zkris_random.

selection-screen begin of block b1 with frame title title1.
  selection-screen begin of block b2 with frame title title2.
    parameters: low type i.
    parameters: high type i.
  selection-screen end of block b2.
  parameters: num_vals type i.
selection-screen end of block b1.

initialization.
title1 = 'Parameters'.
title2 = 'Limits'.

start-of-selection.

  types: begin of random_numbers_type,
    random_nr type i,
    end of random_numbers_type.

  data: random_numbers type random_numbers_type  occurs 0 with header line.


  constants: a type i value 21,
             c type i value 101,
             m type i value 32768,
             start type i value 500.

  data: new_num type i,
        interval type i.

  data: last_num type i.

  if high &amp;lt; low or num_vals &amp;lt; 1.
    write: 'parameter error'.
    exit.
  endif.

  if last_num is initial.
    last_num = start.
  endif.

  clear random_numbers[].
  interval = high - low + 1.


  do num_vals times.
    new_num = ( a * last_num + c ) mod m.
    last_num = new_num.

    random_numbers-random_nr = ( new_num mod interval ) + low.
    append random_numbers.
  enddo.


  loop at random_numbers.
    write:/ random_numbers-random_nr.
  endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2007 11:12:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-data-randomly/m-p/2904403#M683116</guid>
      <dc:creator>former_member189059</dc:creator>
      <dc:date>2007-10-30T11:12:42Z</dc:date>
    </item>
  </channel>
</rss>

