<?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: Persistent Class in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/persistent-class/m-p/10252869#M1829541</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was definitely referring to you and was actually hoping either you or Namiesh would see this post since you guys have already talked about this &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_emote jive_macro" src="https://community.sap.com/776/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for a nice explanation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;You don't have to worry how to handle the error if you try to insert a duplicate rec/ modify a rec which doesn't exist.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above statement is clearly a advantage, but even if the table has just 10 records (or even lesser) and we want to select a few of those based on certain condition, based on points 1 &amp;amp; 2 in my question, we still need extra processing in order to move the data from one table to another to be able to do the rest of the process and also build the where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Either there is a different way to use the persistent concept when it comes to accessing multiple records (which I am hoping you will explain) or else I do not see any the advantage.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers on your next blog and I hope you find time for the same soon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vikram.M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 May 2014 18:58:47 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2014-05-09T18:58:47Z</dc:date>
    <item>
      <title>Persistent Class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/persistent-class/m-p/10252865#M1829537</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 recently when thru some blogs in SDN related to persistent class from Former Member. I understand how persistent class works but I am trying to understand why do we need a concept called persistent class when the same can be achieved thru normal selects. I am trying to find answers to the below questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I know is when we call the method get persistent or get_XXX or set_XXX, internally SAP uses a select or insert. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. So why cant we just use the the same ourselves. What is the advantage of creating a persistent object and then using get/set methods? IMO, this only makes things complex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Lets say I want to retrieve multiple records into an internal table: Below is an example from Former Member:&lt;/P&gt;&lt;P&gt;Since we already do a SELECT on SFLIGHT, why not just select the rest of the fields and perform the calculations inside our program the normal way. Every time we perform get_persistent inside the second loop, we make a SELECT on the DB, how would this be performance effective even if its select single based on a key?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also by doing this using persistent class, we first select data into a internal table and then we have to loop thru this table and then move the data into another internal table. This can be completely avoided if we do this the normal way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;isfligt1 -&amp;gt; normal table with the fields from sflight.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select carrid connid fldate from sflight &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into table isflight1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where carrid = p_carrid&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and connid = p_connid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at isflight1.&lt;/P&gt;&lt;P&gt;&amp;nbsp; clear isflight_line.&lt;/P&gt;&lt;P&gt;&amp;nbsp; move-corresponding isflight1 to isflight_line.&lt;/P&gt;&lt;P&gt;&amp;nbsp; append isflight_line to isflight.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at isflight into isflight_line.&lt;/P&gt;&lt;P&gt;&amp;nbsp; isflight_line-my_flight = zca_bc620_00_persist=&amp;gt;agent-&amp;gt;get_persistent(&amp;nbsp; i_carrid = isflight_line-carrid&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i_connid = isflight_line-connid&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i_fldate = isflight_line-fldate ).&lt;/P&gt;&lt;P&gt;&amp;nbsp; modify isflight from isflight_line.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. In the same blog, there was also a question from &lt;A __default_attr="330463" __jive_macro_name="user" class="jive_macro_user jive_macro" data-objecttype="3" data-orig-content="Andy Cliff" href="https://community.sap.com/"&gt; about using where clause to fetch multiple records. Thomas had said that this can be achieved using the query manager functionality. This is done by building the where clause. &lt;/A&gt;&lt;/P&gt;&lt;P&gt;Again my question here is why make it complex to build the where clause and then use query manager when you can simply use where clause on the select?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am pretty sure there is a proper reason why we have persistent class and its advantages over using SQL. I am just trying to find the right place and reasons why someone would prefer using persistence over SQL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know the same question was asked by &lt;A __default_attr="229906" __jive_macro_name="user" class="jive_macro_user jive_macro" data-objecttype="3" data-orig-content="Suhas Shah" href="https://community.sap.com/"&gt; and but I am looking for something in laymen terms to understand why and when use persistent class?&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vikram.M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 13:48:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/persistent-class/m-p/10252865#M1829537</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-09T13:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: Persistent Class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/persistent-class/m-p/10252866#M1829538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Vikram&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In OO-ABAP persistent class is used to store the object permanently with some GUID. In general the object is just run time object, so to make that object state permanently in database we can use persistence class. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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;Abbas.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 14:55:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/persistent-class/m-p/10252866#M1829538</guid>
      <dc:creator>former_member194739</dc:creator>
      <dc:date>2014-05-09T14:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: Persistent Class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/persistent-class/m-p/10252867#M1829539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Syed,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as I know its not necessary to have a GUID in order to use the concept of persistence. &lt;/P&gt;&lt;P&gt;Secondly I understand what persistence is. My question was "why" since I can use INSERT to save data in DB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vikram.M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 17:35:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/persistent-class/m-p/10252867#M1829539</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-09T17:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: Persistent Class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/persistent-class/m-p/10252868#M1829540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Vikram,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you wanted to refer to me - &lt;A __default_attr="167632" __jive_macro_name="user" class="jive_macro_user jive_macro" data-orig-content="Suhas Saha" href="https://community.sap.com/"&gt;&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Persistence classes are not designed for mass processing since each record of the DB table is an object of the Persistence class. So if you want to process 1000x records of a DB table =&amp;gt; you'll be creating 1000x objects which will be a performance overhead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But consider building a custom application involving a few tables &amp;amp; a few records to maintain. You can use the Persistent classes for these tables &amp;amp; coupled with Transaction service you delegate the whole process of maintaining the DB recs to ABAP Object services. You don't have to worry how to handle the error if you try to insert a duplicate rec/ modify a rec which doesn't exist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Recently i developed a custom tab in the Business Partner(BP) screen using BDT framework. In this i had to a custom table to maintain from the BP screen. I decided to use an MVC-architecture for this solution -&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Model: Persistent class mapped to the custom DB table&lt;/LI&gt;&lt;LI&gt;View: BDT custom screen whose processing was handled by the BDT events&lt;/LI&gt;&lt;LI&gt;Controller: Z-class which was sandwiched between the two.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had delegated all the DB operation to the Persistent class and it worked like a charm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am planning to blog about it once i have some time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 18:25:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/persistent-class/m-p/10252868#M1829540</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2014-05-09T18:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: Persistent Class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/persistent-class/m-p/10252869#M1829541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was definitely referring to you and was actually hoping either you or Namiesh would see this post since you guys have already talked about this &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_emote jive_macro" src="https://community.sap.com/776/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for a nice explanation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;You don't have to worry how to handle the error if you try to insert a duplicate rec/ modify a rec which doesn't exist.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above statement is clearly a advantage, but even if the table has just 10 records (or even lesser) and we want to select a few of those based on certain condition, based on points 1 &amp;amp; 2 in my question, we still need extra processing in order to move the data from one table to another to be able to do the rest of the process and also build the where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Either there is a different way to use the persistent concept when it comes to accessing multiple records (which I am hoping you will explain) or else I do not see any the advantage.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers on your next blog and I hope you find time for the same soon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vikram.M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 18:58:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/persistent-class/m-p/10252869#M1829541</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-09T18:58:47Z</dc:date>
    </item>
  </channel>
</rss>

