Skip to Content

Any advantage in creating a referrence to a standard class to access a method within that class ?

Hi,

Is there any advantage in creating a referrence to a standard class and then using that reference to call the method within that standard class ?

CL_ABAP_DATFM=>CONV_DATE_EXT_TO_INT.

Create a reference of Standard class and then accessing a method using that referrence.

data:ref_class  type ref to CL_ABAP_DATFM.
ref_class->CONV_DATE_EXT_TO_INT.

Thanks,

K.Kiran.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Apr 28, 2017 at 09:27 AM

    ref_class->CONV_DATE_EXT_TO_INT. is semantically misleading, since it is calling a static method as though it is an instance method. Bad programming in my view.

    Add comment
    10|10000 characters needed characters exceeded

    • Matthew already answered but I suspect someone thought they had to create a reference in order to use the method and then the code got copy-pasted from there. I'm not at all surprised since I've seen some questionable code over and over either written by the same person or the same consulting company. Also made me wonder WTF many times and question my own sanity.