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: 

Is there a wizard prog to make an impl skeleton from class def?

rdiger_plantiko2
Active Contributor
0 Kudos

I am thinking of writing a program which generates a skeleton for the class implementation from its definition.

Basically, the program will have the following steps:

- In a text edit control, the developer can paste the ABAP code of a class definiton, or only of one of its sections.

- The developer hits "Execute".

- The operating method is called - it gets the code as a stringtab.

- It tokenizes the code using the ABAP-statement "scan abap-source"

- It scans for all method definitions (first token of the statement  = 'METHOD')

- For each method definition m, it generates

  "method m.

   endmethod."

- The result, passed as a stringtab, and embraced by "class ... implementation." ... "endclass.", will be passed back to the program

- The program outputs the result in a text edit control for easy copy/paste.

I think a little program of this kind could be worth the effort to write it.

Before starting with such a tool, I would like to ask around whether such a tool already exists in the standard somewhere?

- Rüdiger

1 ACCEPTED SOLUTION

jeroen_verbrugge2
Active Participant
0 Kudos

Hi,

Did you think about an integration into the ABAP editor via a custom dynamic pattern?

Seems a colleague is doing something similar:

http://scn.sap.com/community/abap/blog/2012/08/06/back-to-the-future--part-05

I think you did most of the work already....

Check http://wiki.sdn.sap.com/wiki/display/HOME/DYNAMIC+PATTERN+-+Custom+Create+Pattern+in+ABAP+Editor.for more information about dynamic pattern creation.

11 REPLIES 11

matt
Active Contributor
0 Kudos

I'm fairly sure no such thing exists. Nice idea though.

0 Kudos

OK, I am done. For me, it is useful. Maybe it's useful for someone else.

Works on SAP_BASIS >= 702, but is likely to run already on 700.

http://pastebin.com/ZanNsBmU

Currently, interface methods are not resolved. Only the methods that are plainly contained in the definition are extracted.

Have fun! 🙂

0 Kudos

Nice idea You can also post it as a document or Wiki in SCN.

0 Kudos

Hi Kesavadas,

thanks for your suggestion, I wasn't very present in the SCN the last years, so I don't know all its features. Is there a repository for ABAP programs in the SCN, contributed by users? Syntax-Highlighting, versioning? Where would you place such kind of code?

Regards,

Rüdiger

0 Kudos

Hi,

You can create it in any one these areas:

Create a document here ABAP Development - "Click "write a document" and publish it " or

Create a wiki page here http://wiki.sdn.sap.com/wiki/pages/createpage-entervariables.action?spaceKey=stage&templateId=113147...

The Wiki repository is available here http://wiki.sdn.sap.com/wiki/display/ABAP/ABAP+Development+and+Programming

Kesav

0 Kudos

Hi Kesavadas,

something is going wrong there. ... 😞  right now I'm in the mood to stick to pastebin... Pastebin works fine, and everybody who is interested could get the code from there. It almost takes me more time to work through this Wiki editing process than to write the report itself.

The page, when displayed, is

http://wiki.sdn.sap.com/wiki/display/stage/Tool+to+generate+a+class+implementation+from+its+definiti...

and whenever I edit and save it, it discards all my input and goes to

http://wiki.sdn.sap.com/wiki/pages/editpage.action?pageId=288162930

displaying the blank template page.

Any idea, what's going on here?

Just curious

Rüdiger

P.S: I opened an SCN support thread for this http://scn.sap.com/thread/3199926

jeroen_verbrugge2
Active Participant
0 Kudos

Hi,

Did you think about an integration into the ABAP editor via a custom dynamic pattern?

Seems a colleague is doing something similar:

http://scn.sap.com/community/abap/blog/2012/08/06/back-to-the-future--part-05

I think you did most of the work already....

Check http://wiki.sdn.sap.com/wiki/display/HOME/DYNAMIC+PATTERN+-+Custom+Create+Pattern+in+ABAP+Editor.for more information about dynamic pattern creation.

0 Kudos

Hi Jeroen,

thanks for pointing my attention to that blog. Indeed, in the meantime I had placed the code for generating the method skeleton into an editor pattern.

I will extend the wiki soon by a description of this last step of the story.

Regards,

Rüdiger

0 Kudos

Hi Rüdiger,

Nice work! . Is it possible for you to add the parameters along with their types as comments , when you generate the skeleton. That would do a big favour where we could avoid repeated top down navigation.

Thanks,

Venkat.

0 Kudos

Hi Venkat,

I have seen too many noisy comments than to be enthusiastic about generating additional comments. But you may be right that in this case it would be a time-saving feature. Searching the IMPORTING, EXPORTING, CHANGING, RETURNING RAISING keywords in the METHODS statement should be not too cumbersome. The parameter clause consists of the tokens

IMPORTING | EXPORTING | CHANGING | RETURNING

VALUE(<NAME>)  | <NAME>

TYPE <REFERENCETYPE> | LIKE <REFERENCEVAR>

where angular brackets denote a symbolic name. It should be not too difficult to extract these parts and to reproduce them as comments in the target code. 

Regards,

Rüdiger