Skip to Content
Author's profile photo Jerry Wang

One Example : My small tip about how to write simple tool for study purpose

In my blog Some more technical details about SAP note I have written a simple tool which allows me to get more deep understanding on SAP note.

Before I wrote that tool, I have no technical knowledge on note at all.  I will share with you how I was able to write a tool by myself by getting source code I need via debugging.

All I know is the fact that I can use tcode SNOTE to download a note in Netweaver system.

1. I click “Goto”->”Download SAP Note”:

/wp-content/uploads/2016/06/clipboard1_978244.png

And maintain a Note number which I would like to download:

/wp-content/uploads/2016/06/clipboard2_978260.png

2. Create a new text file pasting the following content into it:

[FUNCTION]

Command=/H

Title=Debugger

Type=SystemCommand

Save the text file. Drag this file to the download popup in step1, when you see the small “+” icon, drop it.

/wp-content/uploads/2016/06/clipboard3_978261.png

You should see “Debugging switched on” in the bottom screen.

/wp-content/uploads/2016/06/clipboard4_978262.png

3. Click F8 to start download, for me since I have also activated system debugging, so the callstack below seems not so useful for me.

Double click stack11:

/wp-content/uploads/2016/06/clipboard5_978263.png

So from here I can know the main logic of note download is implemented in report scwn_note_download:

/wp-content/uploads/2016/06/clipboard6_978264.png

Set a dynamic breakpoint by clicking the line 334, and click F8. Now code has executed to line 334, we can simply click F5 to step into the report:

/wp-content/uploads/2016/06/clipboard7_978266.png

Within this report I learned a useful function module SCWN_NOTES_DOWNLOAD:

/wp-content/uploads/2016/06/clipboard8_978267.png

All I have to pass into this FM to start note download is note number, version and language:

/wp-content/uploads/2016/06/clipboard9_978268.png

And I continue to step into this FM, I get to know some more function modules with more fine granularity, such as SLIC_GET_LICENCE_NUMBER and SCWN_NOTE_UNPACK_XML, and it is good for me to know finally that the note download is just implemented via a RFC call:

/wp-content/uploads/2016/06/clipboard10_978269.png

In fact most of the source code of my tool are copied from FM SCWN_NOTE_DOWNLOAD.

Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Thomas Zloch
      Thomas Zloch

      You're a member of SAP AGS, if I understand correctly. I find your posts interesting, yet at the same time I am surprised that you have to find out "the hard way" about how SAP stuff works under the hood, just as the rest of us have to do it.

      Isn't there SAP internal, technical documentation available for such things?

      Thomas

      Author's profile photo Jerry Wang
      Jerry Wang
      Blog Post Author

      Hello Thomas,

      No I am not from AGS but an application developer at SAP Labs China. I fully agree with you that sometimes it would be efficient and time-saving to figure out one topic / issue by looking into internal documentation, especially when we are working on some stuff with tight deadline. And when talking about self study, every one has his / her favorite approach. For me, I prefer to deal with code rather than documentation. When I begin to study a new topic, I start with debugging code, then turn back to documentation, and then to code, and so on back and forth.

      And back to this note stuff, I don't find any related design document in our internal portal ( perhaps I didn't use the correct keyword for search ). Even if I find one, I would assume that it would be tagged with "internal" and thus not appropriate to share in SCN. On the contrary, thanks to ABAP that we can almost debug anything we want to debug, and all the knowledge we get via debugging are ok to share externally. This is the reason why I learn new thing via the "hard way" as you mentioned 🙂

      Best regards,

      Jerry

      Author's profile photo Thomas Zloch
      Thomas Zloch

      Thank you for the update. Of course I would not expect or encourage internal documentation to be posted here. Please keep sharing what you find out yourself.

      Cheers

      Thomas