Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Pass <OBJECT> to method (analog to java)

Former Member
0 Kudos

Hello everybody,

in JAVA all classes inherited from the superclass <object>.

So it is possible to get the information/metadata abound the object within a method by processing

e.g.

if (obj instanceof String) {

Is there a analogon in ABAP?

Wghen yes, how has the coding to be?

Thanks

Regards

Mario

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Mario,

Yes its the same in ABAP also. All classes inherit from superclass OBJECT. The root node of all inheritance trees in ABAP objects is the pre-defined empty class OBJECT.

Hoping this helps you

Inheritance (SAP Library - ABAP Programming (BC-ABA))

Regards,

Sheetal.

6 REPLIES 6

Former Member
0 Kudos

Hi Mario,

Yes its the same in ABAP also. All classes inherit from superclass OBJECT. The root node of all inheritance trees in ABAP objects is the pre-defined empty class OBJECT.

Hoping this helps you

Inheritance (SAP Library - ABAP Programming (BC-ABA))

Regards,

Sheetal.

0 Kudos

Hi Sheetal,

Is there any sample coding? I do not know how to write the coding.

Regards Mario

0 Kudos

Hi Mario,

You can get lot of sample coding based on what you want specifically. Like if you give an example scenario i can help you further

Regards,

Sheetal.

0 Kudos

Hi Sheetal,

asuming I have a method with just one  import-Parameter.

The Client is passing either a string or a integer to the method.

So the import-Parameter has to be from type object. OK?

Inside the method the coding has to fin out if a string or an int is passed.

How do I have to define the Import Parameter?

How can I figure out string or int (like JAVA: instanceOf)

Thanks

Regards

Mario

0 Kudos

Hi Mario,

Check the code here

ABAP Objects instanceOf command

Regards,

Sheetal.

0 Kudos

Hi Sheetal,

that's it.

Thanks a lot

Mario