Skip to Content
avatar image
Former Member

No CALL METHOD syntax used in Dynpro programming

Hi Gurus,

I have just starded with Web Dynpro ABAP. I found that while writing code we don't use CALL METHOD .

i.eTABLE_NODE = WD_CONTEXT->GET_CHILD_NODE('MY_TABLE_NODE').

How can we directly call a method using interface variable e.g WD_CONTEXT without syntax CALL METHOD?

Can anyone explain?

I am not much familiar with OOPs.

Thanks in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jun 11, 2007 at 11:13 AM

    Hi

    let me add some more clarification .

    A be an interface , having three method definitions.

    B is a class which implements A ( So B will be having implementation of 3 methods of A as well as some additional methods of B , let it 2 ). so B will be having total five method implementation.

    So when create an instance of B and assign that to a variable of A , only the 3 methods will be copied .

    You could go to the thread Class for IF_WD_CONTEXT_NODE for more info.

    And you can't directly call from a variable of the interface unless an object is assigned to it.

    Thanks

    Anzy

    Please awrd points if this solves your problem

    Message was edited by:

    Mohammed Anzy S

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Shinu,

      This is with reference to your code - the line in which you are getting the error.

      In general, when we use the assignment operator ( = ), the data type on either side should be the same or compatible types. In your case, the following things have to be noted:

      1. The method 'test' does not return any data. It simply writes some text.

      2. The mode of assignment is not correct. As mentioned earlier, the types on either side of the assignment operation are incompatible.

      You can try the following, however, if that is your need. If you want to call the method '

      test

      ' from the interface object '

      inter1

      ', then do it as follows:

      inter1 = inter.
      
      call method inter1->test.

      Further, whenever you are calling a method of an interface or a class, it is always better to use the 'CALL

      METHOD cls_name->meth_name

      ' syntax. Though the '

      call method

      ' part is optional, it is considered a good programming convention and the code also looks more professional.

      Hope this helps you. Please post back in case you have further queries.

      Regards,

      Ram

  • Jun 11, 2007 at 11:12 AM

    Hi

    The interface will be holding an instance of the implementaion class of the IF_WD_CONTEXT_NODE...so we can directly call that method...without using the call method...

    Thanks

    Anzy

    Add comment
    10|10000 characters needed characters exceeded