Application Development and Automation 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: 
Read only

Pass <OBJECT> to method (analog to java)

Former Member
0 Likes
984

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
Read only

Former Member
0 Likes
935

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
Read only

Former Member
0 Likes
936

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.

Read only

0 Likes
935

Hi Sheetal,

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

Regards Mario

Read only

0 Likes
935

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.

Read only

0 Likes
935

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

Read only

0 Likes
935

Hi Mario,

Check the code here

ABAP Objects instanceOf command

Regards,

Sheetal.

Read only

0 Likes
935

Hi Sheetal,

that's it.

Thanks a lot

Mario