<?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: increasing a table field in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/increasing-a-table-field/m-p/1077759#M96799</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok, found the way with your help guys. Thanks a lot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Oct 2005 16:56:15 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-10-13T16:56:15Z</dc:date>
    <item>
      <title>increasing a table field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/increasing-a-table-field/m-p/1077753#M96793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt; someone knows a way to increase a table field value by one whenever a record is inserted on the same table?.&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table: zvquery&lt;/P&gt;&lt;P&gt;fields: client, partner, type, count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So whenever you insert a new record on table zvquery, field count increases automatically by 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Oct 2005 16:35:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/increasing-a-table-field/m-p/1077753#M96793</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-13T16:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: increasing a table field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/increasing-a-table-field/m-p/1077754#M96794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is no such functionality in ABAP.  We use number ranges.  You call a function module to get the next available number and then use that number to update the database.  You set up the number range in transaction SNRO.  Then this function module to get the next number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  call function 'NUMBER_GET_NEXT'
       exporting
        nr_range_nr      = '01' " This is the number range interval  
        object           = 'ZSDINQUIRY'  " This is your object
       importing
            number                  = next_number
       exceptions
            interval_not_found      = 1
            number_range_not_intern = 2
            object_not_found        = 3
            quantity_is_0           = 4
            quantity_is_not_1       = 5
            interval_overflow       = 6
            buffer_overflow         = 7
            others                  = 8.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Welcome to SDN.  Please remember to award points for helpful answers and mark your posts as "Solved" if your question has been answered.  Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Oct 2005 16:38:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/increasing-a-table-field/m-p/1077754#M96794</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-10-13T16:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: increasing a table field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/increasing-a-table-field/m-p/1077755#M96795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You will have to explicitly code it when you update the table.&lt;/P&gt;&lt;P&gt;data count type I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select count( * ) into count from zvquery.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;zvquery-count = count + 1 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;zvquery-partner = 'XXX'.&lt;/P&gt;&lt;P&gt;zvquery-type = 'XX'.&lt;/P&gt;&lt;P&gt;insert zvquery.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Oct 2005 16:39:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/increasing-a-table-field/m-p/1077755#M96795</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-13T16:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: increasing a table field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/increasing-a-table-field/m-p/1077756#M96796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No automated way. You have to do it programmatically. You can get the count of the existing records add one to it and insert your new record with that value. You can also do it using custom number ranges(tcode SNRO) and then using the FM NUMBER_GET_NEXT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Oct 2005 16:41:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/increasing-a-table-field/m-p/1077756#M96796</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-13T16:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: increasing a table field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/increasing-a-table-field/m-p/1077757#M96797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sanjay, Srinivas,  As two of the top contributors to this forum,  I value your opinions greatly,  I was wondering if you had a preference here.  Do you prefer to use number ranges here or getting the next number from the db table.  Is one better than the other.  Your thoughts?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Oct 2005 16:44:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/increasing-a-table-field/m-p/1077757#M96797</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-10-13T16:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: increasing a table field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/increasing-a-table-field/m-p/1077758#M96798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rich,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all I really doubt why a count is reqd as you can always get a count of number of records from count( * ) and moreover the count will mostly have the value which is already in the Primary index .  So let the poster reply back as to what is the requirement to put a count field. Nonetheless Number range is preferred but that is when you want it to be a unique key field like PO Number / SO Number etc . Number range has its overheads unless you really want to develop a new application . This table seems to be a simple custom table for partner maintenance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Oct 2005 16:53:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/increasing-a-table-field/m-p/1077758#M96798</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-13T16:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: increasing a table field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/increasing-a-table-field/m-p/1077759#M96799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok, found the way with your help guys. Thanks a lot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Oct 2005 16:56:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/increasing-a-table-field/m-p/1077759#M96799</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-13T16:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: increasing a table field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/increasing-a-table-field/m-p/1077760#M96800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rich, coming from top most contributor, that is more than a complement for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I prefer number ranges as opposed to the other approach simply because, number ranges automatically provides you integrity of the number assigned. By that what I mean is, if we program to read the count of the records and increment it, then there are chances that if more than one person executing this program or entering records into it, will get the same numbers. This will not be the case with number range because the moment you call the function module, that number will be reserved and will not be available to another call to the number range object. That avoids the duplicate number assignment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also if the number of records in the table increases, then getting a count(*) is a performance issue, compared to a NUMBER_GET_NEXT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Srinivas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Oct 2005 16:57:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/increasing-a-table-field/m-p/1077760#M96800</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-10-13T16:57:24Z</dc:date>
    </item>
  </channel>
</rss>

