Program 3 - List of Countries

Siva Prasad
A free video tutorial from Siva Prasad
SAP Trainer and Consultant
4.4 instructor rating • 10 courses • 81,451 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] Third program is about printing a list of countries Well we know the list of countries like Iran or India us for an Arab states see Canada. Swarms of NSDAP already has all the data in. We're going to find out where they're at a table inside ACP. I want to view the content of the people. How do we do that. Well as the Purdey 8 opened up it you know that there is a transaction called the 16 that can be used to Blow's data in people's. We're going to talk about PayPal's and the Borda is 16 and put in t. I think it's 00 why he does Yep isn't it. And then it execute. It's on in a different language don't. That's because we have to send the language English and execute. This is more like it. Aren't you what Australia C or Canada. D for Germany I include India us for it and it states and so forth. We just need to look at these two columns country key I mean and want to get it out on the report. Where is this data stored. This data is stored in a data misdeal called bezels Edo. Pete what does a do to. We're going to talk more about database tables in the Data Dictionary section. You'll be a little bit in the mixed program but at table is basically like a great idea right. If you're worked on Excel you would understand what good food means write those columns. That's what a good means database tables in ASAP are essentially rows and columns. For example look at this Excel Stabat from except the first column shows you the material in the second column shows your description of the material two columns. And these are the rows the first row second row third row row row so rows and columns is a table. And just like every Excel has a name you started with a name right. Data in tables is stored but the name in this case the name of the table is 0 0 5. A cryptic name but doesn't matter. Lessoning and in that table we will pull out these two columns country key and the meat. How do you do that. First we have to understand what are the names of these columns Cetywayo name are just you know what you see on the screen. But internally the they have a name that's used to represent that column in order to do that. We have to go to a transaction called s.c LeBron as he left. OK. S11 is called a abab dictionary. We to talk about the mixed program in a bit more detail. So this is sort of the structure of that grid as deflate gate. So if you click on display that table then there it says that country key is called Land 1. That's the name technical name or the field or call and country name is called Land X.. OK so these are the columns from the table we want to show in the screen right now a stop for a bit before I write the program and talk for a few minutes on the architecture of Sep. Now FCB follows a three tiered architecture. In fact because of the three tiered architecture that follows previously it used to be called our fleet our last three the before that it used to follow Poupee architecture. And it was called R2. Art News history. So we didn't get the present docketed should've SEPs a three tier architecture. What do I mean by that. Let me define cleated architecture with a simple example. You log onto your Gmail on your computer go to your browser type in Gmail or then some magic is going to happen behind the scenes are you going to get your mail or it asks you for a username password you enter that and you get your degree and you get your email. What's happening behind the scenes is your browser. I'm not going to go to the details of how this transaction happens but from the perspective of the architecture the 7:57 architecture the request is made to one of Google's Eemian So which in turn is going to look at the Googles database infinitely many uses a relational database but let's just assume that they so a database like so and the data is all there you use the past were my emails all of that stuff is right there in the database. So this is the data store. This is where all the data is stored. This is where the logic is stored. Now the data is stored in the database and the logic is stored in what is call an application or app server or pay this Bozer is called as the client. And that's why his call is a client server architecture next day because the third bill is core. The data is. So it's just the first to you. This is the second tier. This is the third tier right three tiers essentially if we follow the same kind of architecture. What you see on the user's desktop in this case this screen right here. Imagine this like a browser. Right. This is SEPs but also it's called the so. The closer in this case is the UI and CPG UI. This is where you execute transactions you view data you ask for data and then this goes to the SEP application so and behind the scenes there's going to be a database in place where all the data is stored. For example we have seen the list of countries right. For India you want us for it and it does all the data is actually stored in the databases. It's not stored here it's stored here. Right. So it's stored here in a tabular format like so. And what we're going to do is write a program that runs here and runs here the program runs here. The programs always run on the absolute and it will go look on the table that we ask it to look in this case 0 0 5 is the name of the table brings up the data and then displays it on the users to stop simple right. This is a three tiered architecture OK let's let the program you want to keep the screen open and then open another screen. And when going to do that is by and then I'm going to open another window right click on this button. Crewdson use session and we want to push you to the. All right. We're going to let this program go to is he 38 and then we're of the program say so the program name is going to be 0 3. That's the third program. No score countries under score last. So you're going to print out a list of countries right concrete list of countries executable program OK. Saved as a local object. You had to go on the screen we're taping S11 that's used to define the structure of a 0 0 5 OK and then click on display. So we will pullout land one the country key land X the country OK how do we do that. First thing that you have to do is define this table in the program which is essentially saying the program that I'm going to look at the Stevel reader to find that is by using the Peebles. So tables d 0 0 5 p doc I'm going to look at this table. That's what it says. OK OK. And then I'm going to select from the table and write it on the screen. Right. The key word is select select see and what I'm going to select I'm going to select everything from the people that in all the columns in the table. OK. Form which table the 0 0 5 t ok and not and then what I'm going to do with the select once I select the data I will write it onto the screen. Right. And then what am I going to write. B. 0 0 5 B dash. What's the name of the first column that I want to date. I want to put the key first key is land. One word is the country key. Some will say new land 1. Then I'm going to also do write the 0 0 Why b an X right. So that's the country needs. The second column I'm tricky tricky and Contarini. OK. But then if you're right to select this way you have to write and select. Don't worry about it. There are many ways to write a select statement and we're going to see all the variations as we go forward for now. Just like the way we have done a do or end do you going to do and select automatically with adjusting it tab and your statement is complete. Pretty pre-book say if things get checked for letters no letters I read the program OK and then execute what are got here. We got all different kinds of languages right. We don't want Japanese Chinese or can we only want English. How do you do that. This column say process is going to contain the language key and really want English right. Remember I've have it previously to go back and in the hands to succeed by saying then I'd start from the stable. All right well. Espie are they as equals. And so essentially what you're seeing is you're filtering the rows and columns and saying I want this column select by this rule with this condition right again and would do a pretty printer check wasn't Ducs I read the program and it execute. This is better. Right. We got everything in English but we wanted in a list like just do columns. Not so many carbs. How do you do that. You put a slash at the very beginning so that every time it loops through this select the first statement is going to be written on a separate line. This is more like it. Right. The first column is the key and the second column is the one off that Cricky OK school back and look at the select one more. What's really happening. What the select segment is doing IIS. Let me let me go back to the PowerPoint. We're distracted. We're just doing this. It's running here. And what are you saying to that select statement is select start meaning all the columns from the table d 0 0 5 t. Right. That's what we meant by select start from zero zero five right and it pulled up everything. But we wanted to only filter by English language so that is a column there called Spross as it is right and we say read SEP-IRA s equals English. So anything that's not in English if for example this rule is English. This is French. This is Chinese English again. It's going to eliminate this rose and going to only the first and fourth row. For example what we're going to talk more about the select statement in a different chapter. Pono what I want to focus is how Huggett getting that data from someplace in the database in some table doing some manipulation. Then showing it to the user. Essentially most of the about programs work in this model. The user sends a request which is executing a pro app so the court banned that program which essentially gets data from the data is one table waiting tables hundred tables depending on how complex the business is. Manipulates the data formats in a particular way and sends it to the user. You come to think of it. Anything that runs from a remote machine it could be G-mail. See your mail is not on your computer. Mail is in the database. Somewhere in Palo Alto. I don't know where I'm sitting in India or I'm sitting in San Francisco or I'm sitting in China and using a browser I can get that data right. The way I got a list of countries is almost similar to the way I get my e-mail. I have a request for a list of countries I execute the program. The program is run on the SEP apps. Which version features did offer a particular table in the database and it massages the data. Does it need to be done and then shows it to me in an honest we can make that it is as simple or as complicated as we want. We can have colors we can have bold letters you can have all different kinds of things. But the point I want to make is essentially you have to understand this architecture before you move on to write more complicated programs. A program typically pulls data from the table massages it shows it back to the user in a format that he wants. Right. There are different formats and we're going to talk about all those formats as we go forward. All right. So that was the list of countries was easy right. So in this chapter you have seen what's a data browser tableaus that is used to view the data in the database the transaction for that is is C-16 database definition can be found in a sea level in stocks in all the data the we have seen words that predate architecture. We are trying to combatted with apps like Gmail or anything that's popular like Facebook. They all follow this kind of a two tiered architecture where use that has the interface like a browser or a map. And then in the middle there is an app so were that pass all the code and it reaches up to a database fetches the data massages it and shows it to the user and a nice farm it could be on the browser or it could be on the SEP Gyi it could be on an app it could be in any format to the use words. It's all in the logic of the program. And then you've seen what's in people's statement specifically declares to the program that it's that we're going to use your particular database table going to do a bit more behind the scenes. But we're not going to worry about that at this point. And then we have seen a really barebones example of a select statement or we have done is that it did all the columns from a table where language is English and then we have used the right statement to print out just two columns country key country right right now with a list of countries program the next program is the list of materials.