You are on page 1of 9

http://www.sapdev.co.

uk

Lesson 1 Logging into SAP

Step 1 - Executing the SAP logon Pad Running SAP is just the same as running any other piece of software on your PC, one way being to double click on the associate icon/shortcut on your desktop which in this case will look something like the following "SAP logon pad" icon.

Step 2 - Select SAP system to log into Next double click on the system you want to log in too. If your logon pad does not have any entries you will need to add one using the correct details provided by your basis team or elsewhere depending on how you are accessing your SAP system.

Step 3 - Logging into SAP Right you have now reached the key point and have access to an SAP system, all you have to do now is enter your username and password.

Now press enter and if your username and password are correct you should see a screen similar to the following.

Lesson 2 : First ABAP Report Program Now that you have logged into SAP it is time to create your first ABAP report and get it to display some simple "helloworld" text. Simply follow the simple steps below to do this. Step 1 - Execute transaction SE80 The first step is to execute transaction SE80 by typing it into the command box in the top left hand corner. This transaction encapsulates all the development technologies in one place. Yes there is a dedicated transaction SE38 to create reports/programs but SE80 does everything that that does and getting used to it will mean all your developments are done in one place once. Then when you get to developing technologies like BSP and Web dynpro which are only accessed via SE80 you will be very familiar with this transaction.

Step 2 - Select Program / Report Now select "Program" from the drop within the 'Repository Browser' section

Step 3 - Give the Program / Report a name Now enter a name for your report starting with the letter Z, i.e. ZHELLOWORLD and press enter followed by yes.

Un-check the 'With TOP INCL.' and press the green tick

Now simply press save on the next attributes screen

On the following screen just leave it as a local object($TMP) and hit the 'Local Object' button, but be aware that this means it is not transportable to the next(QAS??) system and will not ask you for a transport to assign the program too. This will be covered in a future lesson!!

Step 5 - View new program Now double click on the new program name in the left hand colum and the current code will be displayed on the right

Step 6 - Change program code Now press the change icon and put the program into change mode

Step 7 - Add code to display helloworld text Now add the following line of code to your program and press the save button. Just for info the '/' after the write: statement instructs the text to be on a new line write:/ 'Hello World'.

Step 8 - Activate and test code Now press the Active button followed by the test button

You should see a screen similar to the following showing the Helloworld text or what ever text you have entered into the write statement.

Step 9 - Further reading on the write statement Now you have implemented a simple write statement you can check out this page for more information on the write statement SAP Check statement

Lesson 3 : ABAP Business Report

Now that you have logged in and create a very basic report using the write statement to display some text it is now time to introduce the select command so you can retrieved data from a database table to display in your report. For this we are going to use table EKKO to get the data for the report. There is actually a lot involved in this lesson as we need to declare data types to store data, fetch the data and then display it but there is no point in covering this in separate lessons as you cant really see whats happing until its all put together. Not the comments within the code which can be added any where into ABAP code by adding a '*' at the very beginning of the line or by adding '"' imediately before the text. Step 1 - Add code to create data types Starting with the helloworld program created in lesson 2, add the folloing code to declare you data variables.

* Creates a single line structure variable with the same structure as the ekko database data: wa_ekko type ekko. * Creates a multi line table variable with the same structure as the ekko database data: it_ekko type standard table of ekko.
Step 2 - Add code to select data from table Now add the following code to perform the select

Select up to from into

* 10 rows ekko table it_ekko.

"* means get all fields "only retrieves 10 rows "Gets data from ekko table "Internal table to store retrieved data in

Step 3 - Add code to display data Now add the following code to display the data to the user

loop at it_ekko into wa_ekko. write:/ wa_ekko-ebeln. field endloop.

"loops around the data in table it_ekko "Writes data currently stored in wa_ekko-ebeln "end of loop

Step 4 - Further reading on the select statement Now you have implemented a simple select statement you can check out this page for more information on the select statement and how it can be used

Lesson 4 : Selection Screen to the report :


Now that you hav created your first abap report it is time to add a selection screen to it so that the user can restrict the amount of data that will be retrieved. Step 1 - Add code to create selection screen parameter Starting with the basic program created in lesson 3, add the folloing code to below the data declaration.

* Creates a selection screen parameter called p_ebeln Parameter: p_ebeln type ekko-ebeln.
Step 2 - Update SELECT statement Now add parameter to SELECT code to restrict selection based on user input

Select up to from into where param

* 10 rows ekko table it_ekko ebeln eq p_ebeln.

"* means get all fields "only retrieves 10 rows "Gets data from ekko table "Internal table to store retrieved data in "restrict select based on user input in to selections

Step 3 - Test Save activate and test the code and you should see a selection screen similar to the following

Step 4 - Further reading on the selection screen Now you have implemented a simple selection screen you can check out here for more information on the building your abap report selection screen

You might also like