<?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>oop &#8211; SAP EWM Help</title>
	<atom:link href="https://www.sapewmhelp.com/question-tag/oop/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>Wed, 27 Aug 2025 09:15:42 +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 a Persistence Class in SAP ABAP?</title>
		<link>https://www.sapewmhelp.com/question/what-is-a-persistence-class-in-sap-abap/</link>
					<comments>https://www.sapewmhelp.com/question/what-is-a-persistence-class-in-sap-abap/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Wed, 27 Aug 2025 09:15:42 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=what-is-a-persistence-class-in-sap-abap</guid>

					<description><![CDATA[A Persistence Class is a special ABAP Objects class generated by the Persistence Service that maps database tables to ABAP objects, allowing you to read, modify, and save table data in an object-oriented way instead of writing SQL manually; it is always created from a Persistence Object (PO) in Class Builder (SE24) and acts like [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>A <strong>Persistence Class</strong> is a special ABAP Objects class generated by the Persistence Service that maps database tables to ABAP objects, allowing you to read, modify, and save table data in an object-oriented way instead of writing SQL manually; it is always created from a Persistence Object (PO) in Class Builder (SE24) and acts like an ABAP ORM (Object Relational Mapping) layer.</p>
<p>&nbsp;</p>
<p><strong>How to Implement a Persistence Class</strong></p>
<h5>Step 1: Prepare a Database Table</h5>
<ul>
<li>Example: Table <code>ZEMPLOYEES</code> with fields <code>EMPID</code>, <code>ENAME</code>, <code>DEPT</code>.</li>
<li>Make sure it has a <strong>primary key</strong> (mandatory).</li>
</ul>
<h5>Step 2: Create a Persistence Object</h5>
<ul>
<li>Go to transaction <strong>SE24</strong>.</li>
<li>Create a new class → select <strong>Persistent Class</strong> type.</li>
<li>Enter database table name (e.g., <code>ZEMPLOYEES</code>).</li>
<li>Save and activate.</li>
</ul>
<p>SAP will automatically generate:</p>
<ul>
<li>Persistence Class (<code>ZCL_EMPLOYEES</code>)</li>
<li>Agent Class (<code>ZCA_EMPLOYEES</code>)</li>
</ul>
<p><strong>Step 3: Use in ABAP Program</strong></p>
<p>DATA: lo_employee TYPE REF TO zcl_employees,<br />
lo_agent TYPE REF TO zca_employees.</p>
<p>&#8221; Get the agent class<br />
lo_agent = zca_employees=&gt;agent.</p>
<p>&#8221; Create new employee object<br />
CREATE OBJECT lo_employee.</p>
<p>&#8221; Set values<br />
lo_employee-&gt;set_empid( &#8216;1001&#8217; ).<br />
lo_employee-&gt;set_ename( &#8216;John Doe&#8217; ).<br />
lo_employee-&gt;set_dept( &#8216;IT&#8217; ).</p>
<p>&#8221; Save to DB<br />
lo_employee-&gt;update( ).</p>
<p>&#8221; Fetch existing employee by key<br />
lo_employee = lo_agent-&gt;get_persistent( &#8216;1001&#8217; ).<br />
WRITE: / &#8216;Employee:&#8217;, lo_employee-&gt;get_ename( ).</p>
<p><strong>Advantages of Persistence Classes</strong></p>
<ul>
<li><strong>Encapsulation</strong> – No need to expose SQL, use methods instead.</li>
<li><strong>Consistency</strong> – Follows object-oriented principles.</li>
<li><strong>Reusability</strong> – Same persistence class can be reused across programs.</li>
<li><strong>Error Handling</strong> – Provided by framework methods (<code>INSERT</code>, <code>UPDATE</code>, <code>DELETE</code>).</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/what-is-a-persistence-class-in-sap-abap/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is the difference between abstract class and an interface ?</title>
		<link>https://www.sapewmhelp.com/question/what-is-the-difference-between-abstract-class-and-an-interface/</link>
					<comments>https://www.sapewmhelp.com/question/what-is-the-difference-between-abstract-class-and-an-interface/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Wed, 27 Aug 2025 07:56:34 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=what-is-the-difference-between-abstract-class-and-an-interface</guid>

					<description><![CDATA[Abstract Class Defined with CLASS ... DEFINITION ABSTRACT. Can have: Attributes (data) Concrete methods (implemented) Abstract methods (declared but not implemented — must be redefined in subclass) Cannot be instantiated directly — only subclasses can be created. Supports inheritance (a subclass inherits implementation + attributes). Can implement interfaces too. Think of an abstract class as [&#8230;]]]></description>
										<content:encoded><![CDATA[<h5><strong>Abstract Class</strong></h5>
<ul>
<li>Defined with <code>CLASS ... DEFINITION ABSTRACT</code>.</li>
<li>Can have:
<ul>
<li><strong>Attributes (data)</strong></li>
<li><strong>Concrete methods</strong> (implemented)</li>
<li><strong>Abstract methods</strong> (declared but not implemented — must be redefined in subclass)</li>
</ul>
</li>
<li>Cannot be instantiated directly — only subclasses can be created.</li>
<li>Supports <strong>inheritance</strong> (a subclass inherits implementation + attributes).</li>
<li>Can implement <strong>interfaces</strong> too.</li>
</ul>
<p>Think of an abstract class as a <strong>partially implemented blueprint</strong>.</p>
</p>
<p><strong>Example :</strong></p>
<p>CLASS cl_vehicle DEFINITION ABSTRACT.<br />
PUBLIC SECTION.<br />
METHODS: start ABSTRACT, &#8221; must be implemented in subclass<br />
stop. &#8221; already implemented<br />
ENDCLASS.</p>
<p>CLASS cl_vehicle IMPLEMENTATION.<br />
METHOD stop.<br />
WRITE: / &#8216;Vehicle stopped.&#8217;.<br />
ENDMETHOD.<br />
ENDCLASS.</p>
<p>&nbsp;</p>
<h5><strong>Interface</strong></h5>
<ul>
<li>Defined with <code>INTERFACE ...</code>.</li>
<li>Can contain:</li>
<li>Method declarations only (no implementation).</li>
<li>Constants, types, attributes (but no data storage).</li>
<li>No concrete code inside (implementation happens in the class that implements it).</li>
<li>A class can implement multiple interfaces (like multiple inheritance).</li>
<li>Cannot be instantiated or inherited — only implemented.</li>
</ul>
<p>Think of an interface as a <strong>contract</strong>: <em>“any class implementing me must provide these methods.”</em></p>
</p>
<p><strong>Example:</strong></p>
<p>INTERFACE if_flyable.<br />
METHODS fly.<br />
ENDINTERFACE.</p>
<p>INTERFACE if_swimmable.<br />
METHODS swim.<br />
ENDINTERFACE.</p>
<p><strong>Key Differences:</strong></p>
<table>
<thead>
<tr>
<th>Feature</th>
<th><strong>Abstract Class</strong></th>
<th><strong>Interface</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Instantiation</strong></td>
<td>Cannot be instantiated</td>
<td>Cannot be instantiated</td>
</tr>
<tr>
<td><strong>Inheritance</strong></td>
<td>Single inheritance only</td>
<td>Multiple interfaces can be implemented</td>
</tr>
<tr>
<td><strong>Implementation</strong></td>
<td>Can have <strong>abstract + concrete methods</strong></td>
<td>Only method <strong>signatures</strong>, no code</td>
</tr>
<tr>
<td><strong>Attributes</strong></td>
<td>Yes (instance &amp; static data possible)</td>
<td>Only <strong>constants/types</strong>, no data</td>
</tr>
<tr>
<td><strong>Purpose</strong></td>
<td>Provide a <strong>base class with shared logic</strong></td>
<td>Define a <strong>contract for behavior</strong></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<h5>When to Use</h5>
<ul>
<li>
<p>Use an <strong>abstract class</strong> when:</p>
<ul>
<li>
<p>You want to share <strong>implementation</strong> across subclasses.</p>
</li>
<li>
<p>You want to define <strong>default behavior</strong> that can be reused.</p>
</li>
<li>
<p>Example: <code>CL_VEHICLE</code> (base) → <code>CL_CAR</code>, <code>CL_TRUCK</code>.</p>
</li>
</ul>
</li>
<li>
<p>Use an <strong>interface</strong> when:</p>
<ul>
<li>
<p>You just need a <strong>common contract</strong> across unrelated classes.</p>
</li>
<li>
<p>You want to achieve <strong>multiple inheritance</strong> of behavior.</p>
</li>
<li>
<p>Example: <code>IF_FLYABLE</code>, <code>IF_SWIMMABLE</code>, <code>IF_SERIALIZABLE</code>.</p>
</li>
</ul>
</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/what-is-the-difference-between-abstract-class-and-an-interface/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to achieve multiple inheritance using interface in SAP ?</title>
		<link>https://www.sapewmhelp.com/question/how-to-achieve-multiple-inheritance-using-interface-in-sap/</link>
					<comments>https://www.sapewmhelp.com/question/how-to-achieve-multiple-inheritance-using-interface-in-sap/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Wed, 27 Aug 2025 07:51:16 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=how-to-achieve-multiple-inheritance-using-interface-in-sap</guid>

					<description><![CDATA[A class can implement multiple interfaces at once, which allows you to combine functionality from many sources. Example:  &#8221; First interface INTERFACE if_flyable. METHODS: fly. ENDINTERFACE. &#8221; Second interface INTERFACE if_swimmable. METHODS: swim. ENDINTERFACE. &#8221; A class implementing multiple interfaces CLASS cl_duck DEFINITION. PUBLIC SECTION. INTERFACES: if_flyable, if_swimmable. METHODS: display. ENDCLASS. CLASS cl_duck IMPLEMENTATION. METHOD [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>A class can implement <strong>multiple interfaces</strong> at once, which allows you to combine functionality from many sources.</p>
<p><strong>Example: </strong></p>
<p>&#8221; First interface<br />
INTERFACE if_flyable.<br />
METHODS: fly.<br />
ENDINTERFACE.</p>
<p>&#8221; Second interface<br />
INTERFACE if_swimmable.<br />
METHODS: swim.<br />
ENDINTERFACE.</p>
<p>&#8221; A class implementing multiple interfaces<br />
CLASS cl_duck DEFINITION.<br />
PUBLIC SECTION.<br />
INTERFACES: if_flyable,<br />
if_swimmable.<br />
METHODS: display.<br />
ENDCLASS.</p>
<p>CLASS cl_duck IMPLEMENTATION.<br />
METHOD if_flyable~fly.<br />
WRITE: / &#8216;The duck is flying.&#8217;.<br />
ENDMETHOD.</p>
<p>METHOD if_swimmable~swim.<br />
WRITE: / &#8216;The duck is swimming.&#8217;.<br />
ENDMETHOD.</p>
<p>METHOD display.<br />
WRITE: / &#8216;I am a duck with multiple abilities!&#8217;.<br />
ENDMETHOD.<br />
ENDCLASS.</p>
<p>START-OF-SELECTION.<br />
DATA(duck) = NEW cl_duck( ).</p>
<p>duck-&gt;display( ).<br />
duck-&gt;if_flyable~fly( ).<br />
duck-&gt;if_swimmable~swim( ).</p>
<p>Output:</p>
<p>I am a duck with multiple abilities!<br />
The duck is flying.<br />
The duck is swimming.</p>
<h5>Key Points:</h5>
<ul>
<li>
<p><code>CLASS … DEFINITION</code> uses <code>INTERFACES:</code> to include multiple interfaces.</p>
</li>
<li>
<p>Methods from interfaces must be implemented in the class.</p>
</li>
<li>
<p>When calling interface methods, you can:</p>
<ul>
<li>
<p>Use <strong>fully qualified names</strong>: <code>object-&gt;if_interface~method( )</code></p>
</li>
<li>
<p>Or, if redefined explicitly as public methods, call them directly.</p>
</li>
</ul>
</li>
<li>
<p>This is the standard way to achieve &#8220;multiple inheritance&#8221; in ABAP.</p>
</li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/how-to-achieve-multiple-inheritance-using-interface-in-sap/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to implement Friend Class in SAP ?</title>
		<link>https://www.sapewmhelp.com/question/how-to-implement-friend-class-in-sap/</link>
					<comments>https://www.sapewmhelp.com/question/how-to-implement-friend-class-in-sap/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Wed, 27 Aug 2025 07:38:43 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=how-to-implement-friend-class-in-sap</guid>

					<description><![CDATA[A friend class can access the protected and private components of another class. This is useful when you want to allow controlled access to internal details of a class without making them public. CLASS main_class DEFINITION. PUBLIC SECTION. METHODS: display. PRIVATE SECTION. DATA: secret TYPE string VALUE &#8216;Top Secret&#8217;. FRIENDS friend_class. &#8221; grant access ENDCLASS. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>A <em>friend class</em> can access the <strong>protected</strong> and <strong>private</strong> components of another class. This is useful when you want to allow controlled access to internal details of a class without making them public.</p>
<p>CLASS main_class DEFINITION.<br />
PUBLIC SECTION.<br />
METHODS: display.<br />
PRIVATE SECTION.<br />
DATA: secret TYPE string VALUE &#8216;Top Secret&#8217;.<br />
FRIENDS friend_class. &#8221; grant access<br />
ENDCLASS.</p>
<p>CLASS main_class IMPLEMENTATION.<br />
METHOD display.<br />
WRITE: / &#8216;Main class display:&#8217;, secret.<br />
ENDMETHOD.<br />
ENDCLASS.</p>
<p>CLASS friend_class DEFINITION.<br />
PUBLIC SECTION.<br />
METHODS: reveal IMPORTING obj TYPE REF TO main_class.<br />
ENDCLASS.</p>
<p>CLASS friend_class IMPLEMENTATION.<br />
METHOD reveal.<br />
&#8221; Directly access the private attribute of main_class<br />
WRITE: / &#8216;Friend class can access:&#8217;, obj-&gt;secret.<br />
ENDMETHOD.<br />
ENDCLASS.</p>
<p>START-OF-SELECTION.<br />
DATA(main) = NEW main_class( ).<br />
DATA(frd) = NEW friend_class( ).</p>
<p>main-&gt;display( ).<br />
frd-&gt;reveal( main ).</p>
<p><strong>Output: </strong></p>
<p>Main class display: Top Secret<br />
Friend class can access: Top Secret</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/how-to-implement-friend-class-in-sap/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
