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: 

How to insert Method of a interface in ABAP code

0 Kudos

Hi,

Plz tell me how to insert a interface METHOD in ABAP code as we do in the case of inserting function in ABAP code using PATTERN Button.

I want insert  'Call method lo_class->zif_acct~get_acct_detail",

But when i use ABAP object patterns,Select call method,Then give the instance name , class/interface name and the method name.

I only get ' Call method lo_class->get_acct_detail.'


So i have to manually correct it .

Please Help.

Regards

Blue

9 REPLIES 9

Tomas_Buryanek
Active Contributor
0 Kudos

This message was moderated.

-- Tomas --

0 Kudos

Thanks,Ctrl + Space worked, but doubleclick method name in new hint box and whole method pattern not appear, if something wrong? Thanks

0 Kudos

What code is written before cursor when you are trying CTRL+SPACE? Is it whole method?

Sometimes you need do it twice to insert pattern.

First time CTRL+SPACE selects method from class/interface and then CTRL+SPACE (+then ENTER or doubleclick) inserts pattern.

But I am afraid that some older SAP releases do not have this feature. Only partially working code completion, without patter..

EDIT: no idea why my post was hidden?...

-- Tomas --

0 Kudos

Two times Ctrl Space is not required.

You are talking about the case where partial method name is given before Ctrl Space and multiple matches are found.

I do Ctrl+Space, up/down arrows to select match from list and then Shift+Enter.

Shift+Enter always works for me.

former_member196280
Active Contributor
0 Kudos

Dear Roger,

Follow the below steps. In this example, I am using class object "CL_GUI_FRONTEND_SERVICES" and method "GUI_UPLOAD".

Click on Pattern. Choose,radio button "ABAP Object Pattern". Press continue

You can try other Radio button option. I have displayed one way of doing it. Enter your class name and method name as shown below. Press continue.. that it you are there. 🙂

Regards,

SaiRam

0 Kudos

Hi Dear SaiRam,

I follow your step, only get ' lo_class->get_acct_detail'  no 'lo_class->zif_acct~get_acct_detail'.

zif_acct is Class Interface created in SE24.


I'm not get code what i wish. Can you help me again?

0 Kudos

Dear Roger,

I mis-read your initial question. I though how to include class method using pattern.

I guess, you need to create your own pattern as SAP does not provide one for interface method. To do so you need to go to the editor in change mode and from menu go to  Utilities--> More Utilities --> Edit Pattern --> Create Pattern (you can create your own pattern for the interface method). It is recommended to create custom pattern if at all it will be used very frequently.

Once pattern is created you can come back to editor and call the newly created pattern using Other Pattern.

Regards,

SaiRam

0 Kudos

Create my own pattern maybe solution,But i'm not  know how to do it. Thanks you.

0 Kudos

It is working on my system, ABAP release 7.31.

  1. DATA lo TYPE REF TO cl_abap_c_reader.
  2. *TRY.
  3.   CALL METHOD lo->if_abap_c_reader~read
  4.     EXPORTING
  5.       length = length
  6.     RECEIVING
  7.       result = result.
  8. * CATCH cx_resource_already_closed .
  9. * CATCH cx_stream_error .
  10. * CATCH cx_parameter_invalid_range .
  11. *ENDTRY.

I called ABAP objects pattern and wrote instance as LO, class/interface as CL_ABAP_C_READER and then F4 help to get IF_ABAP_C_READER~READ, and press enter.