Quantcast
Viewing all articles
Browse latest Browse all 2548

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

In my blog Some more technical details about SAP noteI have written a simple toolwhich 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":


Image may be NSFW.
Clik here to view.
clipboard1.png

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

Image may be NSFW.
Clik here to view.
clipboard2.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.

Image may be NSFW.
Clik here to view.
clipboard3.png

You should see "Debugging switched on" in the bottom screen.

Image may be NSFW.
Clik here to view.
clipboard4.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:

Image may be NSFW.
Clik here to view.
clipboard5.png


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

Image may be NSFW.
Clik here to view.
clipboard6.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:


Image may be NSFW.
Clik here to view.
clipboard7.png

Within this report I learned a useful function module SCWN_NOTES_DOWNLOAD:

Image may be NSFW.
Clik here to view.
clipboard8.png

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

Image may be NSFW.
Clik here to view.
clipboard9.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:

Image may be NSFW.
Clik here to view.
clipboard10.png

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


Viewing all articles
Browse latest Browse all 2548

Trending Articles