<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>object &#8211; SAP EWM Help</title>
	<atom:link href="https://www.sapewmhelp.com/question-tag/object/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.sapewmhelp.com</link>
	<description>SAP EWM questions answered by experts — ABAP, S/4HANA, warehouse management</description>
	<lastBuildDate>Sun, 03 Aug 2025 06:37:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.2</generator>
	<item>
		<title>What is an Abstract Class in SAP ABAP?</title>
		<link>https://www.sapewmhelp.com/question/what-is-an-abstract-class-in-sap-abap/</link>
					<comments>https://www.sapewmhelp.com/question/what-is-an-abstract-class-in-sap-abap/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Sun, 03 Aug 2025 06:37:17 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=what-is-an-abstract-class-in-sap-abap</guid>

					<description><![CDATA[An abstract class is a class that cannot be instantiated directly. It serves as a blueprint for other classes. Abstract classes typically include: Abstract methods, which are declared but not implemented. Concrete methods, which can be implemented and inherited. Feature Description Not instantiable Cannot use CREATE OBJECT on abstract classes. Used for inheritance Serve as [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>An abstract class is a class that cannot be instantiated directly. It serves as a blueprint for other classes. Abstract classes typically include:</p>
<ul>
<li>Abstract methods, which are declared but not implemented.</li>
<li>Concrete methods, which can be implemented and inherited.</li>
</ul>
<table>
<thead>
<tr>
<th>Feature</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Not instantiable</td>
<td>Cannot use <code>CREATE OBJECT</code> on abstract classes.</td>
</tr>
<tr>
<td>Used for inheritance</td>
<td>Serve as base classes for child classes.</td>
</tr>
<tr>
<td>Can contain abstract methods</td>
<td>These must be implemented in subclasses.</td>
</tr>
<tr>
<td>Can contain concrete methods</td>
<td>These can be used directly by child classes.</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code><!--StartFragment --><span><span>REPORT </span>zrep_lclclass<span>.</span>

<span>CLASS </span>lcl_animal <span>DEFINITION </span>ABSTRACT<span>.</span>
  <span>PUBLIC </span><span>SECTION</span><span>.</span>
    <span>METHODS</span><span>:</span>
      speak ABSTRACT<span>,</span>
      <span>move</span><span>.         </span><span>" This can be implemented if needed</span>
<span>ENDCLASS</span><span>.</span>

<span>CLASS </span>lcl_animal <span>IMPLEMENTATION</span><span>.</span>
  <span>METHOD </span><span>move</span><span>.</span>
    <span>WRITE</span><span>: </span>'Animal <span>is </span>moving'<span>.</span>
  <span>ENDMETHOD</span><span>.</span>
<span>ENDCLASS</span><span>.</span>

<span>" Concrete subclass</span>
<span>CLASS </span>lcl_dog <span>DEFINITION </span><span>INHERITING </span><span>FROM </span>lcl_animal<span>.</span>
  <span>PUBLIC </span><span>SECTION</span><span>.</span>
    <span>METHODS</span><span>:</span>
      speak <span>REDEFINITION</span><span>.</span>
<span>ENDCLASS</span><span>.</span>

<span>CLASS </span>lcl_dog <span>IMPLEMENTATION</span><span>.</span>
  <span>METHOD </span>speak<span>.</span>
    <span>WRITE</span><span>: </span>'Woof!'<span>.</span>
  <span>ENDMETHOD</span><span>.</span>
<span>ENDCLASS</span><span>.</span>

<span>START-OF-SELECTION</span><span>.</span>
  <span>" Parent Class</span>
  <span>DATA</span><span>(</span>lo_animal<span>) </span><span>= </span><span>NEW </span>lcl_animal<span>( </span><span>)</span><span>.</span>
  lo_animal<span>-&gt;</span>speak<span>( </span><span>)</span><span>.</span>
  <span>WRITE</span><span>: </span>'Animal can speak'<span>.</span>
  <span>SKIP</span><span>.</span>
  <span>" child class</span>
  <span>DATA</span><span>(</span>lo_dog<span>) </span><span>= </span><span>NEW </span>lcl_dog<span>( </span><span>)</span><span>.</span>
  lo_dog<span>-&gt;</span>speak<span>( </span><span>)</span><span>.</span>
  lo_dog<span>-&gt;</span><span>move</span><span>( </span><span>)</span><span>.</span></span> </code></pre>
<p>Output:<br />
Check the Program ( CTRL + F2 ).<br />
<img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/08/abstract-class.png" /></p>
<p>if not initated the Parent class then the output will be.<br />
<img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/08/abstract-class-2.png" /></p>
<p>Output:<br />
<img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/08/abstract-class-3.png" /></p>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/what-is-an-abstract-class-in-sap-abap/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is Singleton Class ? how to use Singleton class in SAP ABAP ?</title>
		<link>https://www.sapewmhelp.com/question/what-is-singleton-class-how-to-use-singleton-class-in-sap-abap/</link>
					<comments>https://www.sapewmhelp.com/question/what-is-singleton-class-how-to-use-singleton-class-in-sap-abap/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Thu, 31 Jul 2025 19:28:18 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=what-is-singleton-class-how-to-use-singleton-class-in-sap-abap</guid>

					<description><![CDATA[A Singleton class is a design pattern that restricts the instantiation of a class to one single object throughout the lifecycle of a program. This is useful when exactly one object is needed to coordinate actions across the system — such as logging, configuration management, or connection handling. Key Characteristics of Singleton Pattern: Only one instance of the class [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>A<span> </span><strong>Singleton class</strong><span> </span>is a design pattern that restricts the instantiation of a class to<span> </span><strong>one single object</strong><span> </span>throughout the lifecycle of a program. This is useful when exactly one object is needed to coordinate actions across the system — such as logging, configuration management, or connection handling.</p>
<h3 data-start="346" data-end="391">Key Characteristics of Singleton Pattern:</h3>
<ul>
<li>Only one instance of the class exists.</li>
<li>The class controls its own instantiation.</li>
<li>A global access point is provided to access.</li>
</ul>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code><!--StartFragment --><span><span>*&amp;---------------------------------------------------------------------*</span>
<span>*&amp; Report  ZREP_LCLCLASS</span>
<span>*&amp;</span>
<span>*&amp;---------------------------------------------------------------------*</span>
<span>*&amp;</span>
<span>*&amp;</span>
<span>*&amp;---------------------------------------------------------------------*</span>

<span>REPORT </span>zrep_lclclass<span>.</span>

<span>CLASS </span>lcl_class_singleton <span>DEFINITION </span><span>CREATE </span><span>PRIVATE</span><span>.</span>
  <span>PUBLIC </span><span>SECTION</span><span>.</span>
  <span>" to check the instance is created or not.</span>
    <span>CLASS-METHODS</span><span>: </span>m_factory RETURNING <span>VALUE</span><span>(</span>r_instance<span>) </span><span>TYPE </span><span>REF </span><span>TO </span>lcl_class_singleton<span>.</span>
  <span>" getter and setter methods</span>
    <span>METHODS </span><span>: </span>get_attribute RETURNING <span>VALUE</span><span>(</span>r_attribute<span>) </span><span>TYPE </span><span>i</span><span>,</span>
              set_attribute <span>IMPORTING </span>m_attribute <span>TYPE </span><span>i</span><span>.</span>

  <span>PRIVATE </span><span>SECTION</span><span>.</span>
<span>*    CLASS-DATA: obj_instance TYPE REF TO lcl_class_singleton.</span>
    <span>DATA </span>gv_attribute <span>TYPE </span><span>i</span><span>.</span>
<span>ENDCLASS</span><span>.</span>

<span>class </span>lcl_class_singleton <span>IMPLEMENTATION</span><span>.</span>
    <span>method </span>m_factory<span>.</span>
        <span>if </span>r_instance <span>is </span><span>not </span><span>BOUND</span><span>.</span>
            r_instance <span>= </span><span>new </span>lcl_class_singleton<span>( </span><span>)</span><span>.</span>
        <span>endif</span><span>.</span>
   <span>ENDMETHOD</span><span>.</span>

   <span>method </span>get_attribute<span>.</span>
       r_Attribute <span>= </span>gv_Attribute<span>.</span>
   <span>ENDMETHOD</span><span>.</span>

   <span>method </span>set_attribute<span>.</span>
     gv_Attribute <span>=  </span>m_attribute<span>.</span>
   <span>ENDMETHOD</span><span>.</span>
 <span>ENDCLASS</span><span>.</span>

 <span>START-OF-SELECTION</span><span>.</span>
 <span>" create an instance of class</span>
   <span>data</span><span>(</span>lo_obj<span>) </span><span>=  </span>lcl_class_singleton<span>=&gt;</span>m_factory<span>( </span><span>)</span><span>.</span>
 <span>" set the value for the attribute.</span>
   lo_obj<span>-&gt;</span>set_attribute<span>( </span><span>10 </span><span>)</span><span>.</span>

   <span>" try to create another instace of the class.</span>
    <span>data</span><span>(</span>lo_obj2<span>) </span><span>= </span>lcl_class_singleton<span>=&gt;</span>m_factory<span>( </span><span>)</span><span>.</span>
   <span>" check the attribute of the new instance</span>
   <span>" it should be same as go_obj as it contains a static attribute</span>
   <span>" get the data and print it.</span>
   <span>write</span><span>: </span>'First object attribute <span>value </span>'<span>, </span>lo_obj<span>-&gt;</span>get_attribute<span>( </span><span>)</span><span>.</span>
   <span>write </span><span>:</span>/ 'Second object attribute <span>value </span>'<span>, </span>lo_obj2<span>-&gt;</span>get_attribute<span>( </span><span>)</span><span>.</span></span> 
</code></pre>
<p>Output:<br />
<img decoding="async" class="content-img" src="https://www.sapewmhelp.com/wp-content/uploads/2025/08/SIngleton-class-2.png" /></p>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/what-is-singleton-class-how-to-use-singleton-class-in-sap-abap/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
