Program 1 - Hello World

Siva Prasad
A free video tutorial from Siva Prasad
SAP Trainer and Consultant
4.4 instructor rating • 10 courses • 81,612 students

Learn more from the full course

SAP ABAP Training - in Plain English

ABAP for absolute beginners - No Programming knowledge required

18:30:01 of on-demand video • Updated August 2018

  • Write ABAP Programs
  • Interpret existing ABAP programs
  • Be conversant with most major programming constructs and paradigms, specifically Enterprise Application programming
English [Auto] I'm happy you did so far along. So let's talk first Dean about the first program that they're going to write of course Hello world. Traditionally that's something start off in programming languages. So how do you rate your program hello world program. Go put your cursor here and type in the thirty eight hit enter or click this green check mark and this screen is called abab entered. So Sep provides it's own editor to write about programs you can read it on Notepad already can't read any of that and learn about can only be written about it. In Sep and this other screen starts it and what do we do here. Create a program where we say hello or could that be in the program. Let's try it. Click on Create. You want to try to create a program called Hello dash word and what does it say here. It says use underscore as a supporter. Meaning the program has a certain type of naming convention. You can have any kind of characters of any kind. It has sort of rules that has to be followed. Don't worry I'm not going to talk about all that was just tools no special characters like Tasha's underscored is OK. That is some of the especially special characters that are acceptable. But most programs that use are straight typically either have an out of school or even a score. That's the first. OK sounds good and retarded created now. Kwiat them is into the key access key lovable. We have an access you don't instead of hello underskirt world. Just type in the hello underscore word OK Z. Start with the letter C and then click on Create it says hello. Underscore already exists so somebody has already created the program. Most of the time insisted that you'll be working on a shared system right. Sep gives you access to a system but it gives access to many of the people to the same system SEPs a shared system. Many people access the same instance so there's something called this namespace because many people are writing programs simultaneously there can be only one unique name meaning. In this case if somebody else writes a Z underscore how the word it sees it's already taken. If you want to check it you can just go to display and as you can see this is already taken somebody has written some piece of course. But we're not going to bother to board that program because we don't care to write our own Hello world. So go back click on this green arrow it's sort of the hello would have your own little prefix so that nobody treads on your program. So the prefix that I'm going to use for all my programs is z z Cibber and then we get to start with for the first day programs. Well this is you know one per second day programs and going days say 0 2 0 3 so that I can clearly pick out what is a program but I want to show you the one word the program but I want to show you 42 so on and so forth and Z Civa the prefix here ensures that they'll give me many Hello World programs starting with Z but I don't think anybody is going to create something starting with these Ceiba if your name is Joe. You can start with Z Joe. And then anything else you want because the probability of somebody else creating the same program same program name is remote. Right. So I'm going to use this prefix and click on it. OK. It's just I need to give it a title title or the program is going to be hello. Then you go to programming. What kind of program is this what are many different kinds of programs. In this case we're going to choose an executable program. What do you but what it means. Just say executable program and click see. And then it tells you another that will pop up and says the package learn how to worry about it. Just click local object OK and then it has it in a couple of lines. You're like like something here. And then exegeses work. And then the name of the program that we have given right. So go into it and let me explain and type in light U.S. base and then use a single code and though we're then endorsing the code and that's a well let's try to execute this program. How do you execute it. Or tested go here and click on this one that looks like a zip line that it sees something at the bottom. What are the what is up since the last statement is not complete. It says you're missing OK. Which line number is that on number 11. Right. So rule number 11 is this way. It's got to get out of here. The Left read it shows you all the numbers starting with one all the way up to whatever will be the number of lanes your way. In this case the level line says you're missing a PDA or busy a period here the end. So this is one of the rules of abab. Every statement ends with a PDA and OK let's try it again. And they this time Brickworks say's Hello world. Isn't that easy now. How hard is this to write Hello world. Now if you're used to some of the programming languages like C or Java this should seem very trivial right. The word right looks very much like an English word on them string a stick. The key thing to understand here is right is call as a key word in about it's part of a BOP's or cabinet the syntax. If you make C now only later works if you want to do something like a prank as it were. Print hello work that whoops it's is what is not defined. Chuck you're spinning so meaning the point being SEPs trying to say hey I don't understand the word but where are you trying to say. Because print is not part of a BOP's vocabulary. And about has a huge set of words their vocabulary is very large. Not to worry we're going to go there Step-By-Step so wonderfully the student selector delete it and then execute it. Everything works fine. OK that was easy right now. Can I say right double quote. Hello doc. Can I do that. That's straight hundreds is the last date when it is not complete period missing. Where does it say that you've got to admit. Well a double called in abab does not define a statement or of a sentence or to string everything after the first double quote becomes a common comment that Bob does not bother. So if you put a doc here what happens is acute then this is right statement must be followed by additions. So you got to write something you can just write a blank and if you tried to write Hello using a double code that doesn't work either because everything after a double quote is a common What's a common. It's not for SEP-IRA interpreter it's for us grammar's to make quick notes. For example if you're doing a complicated piece of logic do a calculation you can write code for it and then do a little bit of footnotes there saying you know what. This is the reason why I'm doing this logic or this is how I'm going to talk about this logic in English programmatically. It's an other story so comments are used extensively in language the way to write a comment in the BB. Use a start with a start at the very beginning. So if you write just look at the way the the right statement goes. It's all in blue. Go here and when a stop is he becomes gry. All of it becomes gry. That means abab is not going to bother about that statement it's not going to look at that statement. It doesn't care about the state because it's a comment. It's not meant to be run by the system. It's for the eyes of the programmer. We'll talk Willibald comments later. What one of the ways to avoid the comment is to put a stop at the very beginning. We're going to do extensive comedy any time you start writing complicated logic. We're gonna do comedy because it's easy to do and it makes the life of you easy as a programmer and programs that you write could be read by many other programmers and makes their life easier as well. Some have believed that so one way to write a comment is what is taught at the very beginning of the line and then everything else in that line come to comment or you can do something like this. What does this do. Put a space put in a court and say this learning croons how to. You see that it's all great. A great line is great. It means abab is only going to bother her so up until this point after the double quote It's useless what about it's just for human consumption. Right. So if you want to start a comment at the very beginning of the lane. Start with a start like this. But if you want to come into the middle of the line and then all the way to the end of the line start with a double click. These are the two ways in which you can do comment. OK. So let's execute but then we're going to talk about something else. Call is a syntax check. Every time you hit on execute execute this program if there is a problem with the syntax with the language throws up one right at the bottom of the screen. But you don't have to execute every time you want to check if the program is right. Simpatica speaking you could click on the syntax trigger one with the two boxes become that they've everything is OK. It says the program is syntactically correct. If it's not for example then we do that. This is not syntactically correct. If we do this it's it's ok. I've got a problem. The last one is missing. Pedia a comment go back again. But one of the things is good and the next thing that you do if running your program is activate that program that Wharton is right next to this index Cziko read the program and it says which program one would activate and it's the your program automatically. You don't have to do a thing just to continue if your program is syntactically correct your object or program is activated OK. Then we would execute then you see that there is a title here called Hello world. And where does that come from. You go back you can go to properties. You'll remember this. The first screen that is Dr.. This is very you mentioned the title hello would know that this is where you define the purpose of the program. Well in this case it's very simple hello world. But imagine writing a program to show the list of materials that has been sold for the day. Right. The how would you want to put a title for that material listing by day. Right. That's about it. Typically your ideas will be given by the user whatever the use of gifts is take it what it so that's sort of hello world program. So I've learned what is an opportunity to help get there use s e to create the transaction code it's called is a transaction called report that you put up here. Right. 8:38 you just talked a little bit about the naming convention. Your program always has to start with a Z all the way into z or white and then in a descriptive name like hello world Mr. materials or list of customers list of employees what are make sure it doesn't have special characters like bash or in underscored is allowed. Use that sapwood it works the ANSI Common Core star. The very beginning. Commerce thing untidily in double quotes is the beginning of the comment until the very end of the line you typically use it to start a comma in the middle of the line you have seen orders of Whitestar write is used to print something on the screen. You have seen what does a program for every program needs a table that shows the user what the program does and then you have seen what does a syntax check every program needs to be checked for syntax before being executed. Was it syntactically incorrect. The program will feel so make sure that you Booysen back check the executable. If everything is OK with the syntax then activated the program now the reason to activate a program is a burden where there is a lot of deepend in CS that I understand and we're not going to go there yet. Just make sure that you activate the program every time you make changes to the program or create the code on the first day and then we know how they execute the program.