Professional Documents
Culture Documents
Interview Questions
Interview Questions
Variable Step-loops
In case of variable step-loops, at runtime we can increase the
number of repetitive blocks depending on the size of the screen.
ABAP/4 Memory
All ABAP programs can also access the SAP memory. This is a
memory area to which all sessions within a SAPgui have access.
You can use SAP memory either to pass data from one program to
another within a session, or to pass data from one session to
another. Application programs that use SAP memory must do so
using SPA/GPA parameters (also known as SET/GET parameters).
These parameters are often used to preassign values to input
fields. You can set them individually for users, or globally
according to the flow of an application program. SAP memory is
the only connection between the different sessions within a
SAPgui.
export text1
text2 from 'ex and im' to memory id 'MEM'.
WRITE :/ T1.
WRITE :/ T2.
****************************OUTPUT **************
export and import
ex and im
0 xxxxxxxxxx
0 ex and im
4 xxxxxxxxxx
***************ABAP MEMORY
parameters ****************
with
export
text = 'xxxxxxxxxx'.
and
import
REPORT YSP_0138
APPLY
SELECT-OPTIONS:VBELN
EXTENSION.
THIS
FOR
STATEMENT
VBAK-VBELN
FOR
ACTING
NO-INTERVELS
LIKE
NO
Example
interface IPerson
{
void Eat();
void Sleep();
int Weight
{
set;
get;
}
}
In order to use this interface, you must declare your class in the
same way that you declare a class inheriting from any other
object.
Example
public class Man:IPerson
{
int iWeight;
public Man()
{
}
You get the following result when you run the above code.
Man:Eat
Man:Sleep
*
CLASS zcl_base_functions DEFINITION ABSTRACT.
PUBLIC SECTION.
METHODS: set_my_name ABSTRACT IMPORTING iv_text TYPE
STRING .
METHODS: write_name.
PRIVATE SECTION.
DATA: my_name TYPE STRING.
ENDCLASS.
*
"zcl_base_functions DEFINITION
"write_name
"zcl_base_functions IMPLEMENTATION
What is an Interface?
An interface is not a class. It is an entity which cant have
implementation. An interface can only contain empty method
declaration and components. Interface components are always
public. We can later change the visibility of the components within
the implementing class using the ALIASES.
Simple Interface
INTERFACE zif_order.
METHODS: set_order_data IMPORTING iv_order_Data TYPE
STRING.
METHODS: create_order.
ENDINTERFACE.
*
CLASS zcl_sales_order DEFINITION.
PUBLIC SECTION.
INTERFACES: zif_order.
ENDCLASS.
Differences
Since both abstract class and interface are different entity, they
have few differences:
Multiple Inheritance:We can achieve multiple inheritance
using Interfaces. Since ABAP doesnt support more than one
Super class, we can have only one abstract class as Super
class.
New Functionality:If we add a new method in the
Interface, all the implementing classes have to implement
this method. If we dont implement the method, it would
result into Run-time error. For Abstract class, if we add a nonabstract method, its not required to redefine that in each
and every inherited class.
Default Behavior:We can have a default behavior of a nonabstract method in abstract class. We cant have any
implementation in Interface as it only contains the empty
stub.
Visibility:All interface components are PUBLIC by default.
For Abstract class, we can set the visibility of each
component.
Recommendations
Based on the above mentioned differences, we can come to this
recommendations:
If want to have multiple inheritance, you need to use
Interface. As we can have more than one interface in the
class definition, we can achieve multiple inheritance.
If wish to create multiple flavors of the object with some
default operations, you should consider creating abstract
class. As it provides you the flexibility to add the default
operations directly to base class and all the subclass would
get the new default operation.
All the pool table stored table in table pool does not need
to have any foreign key relationship but in the case of
cluster table it is must. And pool and cluster table is
basically use to store application data.
For pool and cluster table you can create secondary index
and you can use select distinct, group for pool and cluster
table. You can use native SQL statement for pool and
cluster table.