Program 4 - List of Materials ( Part 1 )

Siva Prasad
A free video tutorial from Siva Prasad
SAP Trainer and Consultant
4.4 instructor rating • 10 courses • 91,766 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] OK our fourth program list of materials so far we have executed the program. The program brought us a set of results. Right now most of the time the user is given a choice for example and we want to show the list of countries we could use that a choice saying give me all the countries in English or if he's a Chinese user you could say give me all the countries in Chinese. So we want to give that power to the user to choose the language in which the countries are displayed. But that was not how our list of countries program was done. Right. It just shows the results in English. That's it user doesn't have a choice. Now we can give a choice to the user by dividing that program with two screens. The first screen is going to show the choice of selection. Ok what do you want for example in this program. We can say OK this program is going to show you the list of materials do want to choose by do you want to choose all the materials you want to choose only finished Kirsti want to choose only electronic materials you get the point right. You're giving the user some choices OK. So their site for the program is a list of countries list. We are going to say materials list material underscore mist and concrete putting a description list that it's an executable program. Click on see and look up. OK started this program. Where is the list of materials stored. Must be off to get to understand the table where the data is stored. So let's open another screen to relate an the transaction S11 on the table where the materials in less distorted. It's called Mada and we are a on display it is general PTEN data JCP only has power of people's world. In fact some very close to 100000 people. So that's a topic for another day. So it has seven different columns like the A.D the date when that deal was cleared it in the name of the person who was cleared of the deal. The middle number. Right. Of the different fees you want to just show all the materials just the middle name. Then it was gaitered who has it and we want to give the user a choice of selecting the user or filtering by the user Wessely. Right. So T-Bolts tab and Mada that's the only way to and you're going to select data right. Select store. Of course we want to select everything from Mada. How many deals do you want to select. We don't have everything. Let's say we want to select just hundreds of €20. You can just find that by doing an up to 20 hours a day is keyword up. So it's not really used a lot. You know just using test programs because in a productive environment you will never have to do an app because you want to show everything. I'd rather have the user front of the but in this case but you just show windows going up to $20 and then what are we trying to do. You're trying to write colon slash and then this sort of writing pre-select statements because just late one select statement and say Mada the hash map not the name of the material. That come up in the same line we also weren't right when it was created. SD Mara bash eat us DA come on. And the person who has created the him Mata in him. And then in select Daut pretty Let's see that isn't it. No. DAVID Sure. Then execute. It's showing perennials. The first one deals that it sees in the table. They are really really filtered by the user. Right. Let's begin immortally right. And more are Levi OK. So go back and you want to give a chance to the user. You could as well say where that user name or any am equal to mommy. That's easy. But we want to give a chance to the user. So we're to do that IIS one of the options these vomitous on. You don't need to do a colon if you're just doing one key We're just putting a call in just in case if you want to use more parameters. And what do we want to search by we want to search for all the materials created by a particular person. Lordly right and Evernham is the name of the person who has created that particular material. So barometers we underscore any We underscore Pells the programmer who's looking at the program that it's a paper on. OK we'll get to that. You know as we like more complicated programs Ulam and the need for a particular type of naming convention. But now just start all parameters of the underscore stored all data with the DNA score in each project has their own nomenclature. So I'm not going to go to that so we underscore the space type Maatta. In fact you don't have to do a model and you could just have a Dexie's OK. Looks good OK. And then I read it Ciccu execute it you see a different screen. This is the screen where the user has a choice of selecting what he wants from button. In this case you're just giving him one free the name of the user who has created it. You could give more fields if you want. Know the dates within which that material was created or anything you want you know anything that that table holds but now let's put in mommy or and. Capital small doesn't matter. What exactly would it doesn't do anything right. It brings everybody tornadoes but we only want Morleys materials. The details that that particular user has created they go back in order here. It's all up to Cornelius. You need a very close here. Yeah. Any atom equals we underscore your in him worth doing. That is saying that I want to pull everything from this table where this column mom right at mom whenever it is created by these only let's say Mommy right working. Check. This index is OK. A debate and execute it. Now I'm going to type in Wadleigh and executive. It works now. It only put the materials the model the user has created. We're to do that is by declaring the parameters the parameters creates a screen where the user can select the parameter. In this case I am specifically asking about to create a parameter for selection of pipe at home which is the name of the user and what the user enters that it's going to be stored in this way evil whatever the user entered in that screen is going to be stored in this variable. Where did I enter. I've entered Marmie. So that's going to be stored in this is this variable. And when the select statement runs it's it's going to frood by adding them equals whatever the user has entered. And that's going to be in this case mommy so this select statement is only going to pull all the materials created by modeling. And that's what is being written onto the screen. And this is how the parameters keyword works. But there is an other way call select Options which is a more elaborated view of the use of select parameters. But we're going to talk about that later. So that was parameters right. You could have as many parameters as you want and we'll create more parameters as we create more complicated programs. All right. So the next thing is when you execute this well looks a little bit be in the school and not work. I would rather want the user to have is to have a descriptive text user would rather see created by or whatever. Right. The way to do that is by going to go to text elements selection texts. Nobody here you could put a description whatever description you want or you could just let it flow down from a dictionary. So if you go back here the data dictionary S11 is declared with a description of me or the person who created it. Right. So if you just call this at relabel that is a description for that created by. Right. So if you click on the dictionary you get it and so you get it's getting automatically heard from the field label associated with a data element. What are you what that data element is going to get. OK. Now actually read these text elements like so it know back. Exactly. This is nice looking great clean by in sort of the underscore. Right. The rest of the logic works just fine. So enter the name and then it pulls all the materials created by that user. So this is text elements OK. Next thing is going to focus a little bit more on the data dictionary. The data dictionary holds the definition of a people. In this case it's holding the definition of the table model and it says it has so many columns. Errors. Swarms of that and it also shows you what kind of a data type it is. This is a character uplinked pool. This is a character of link 18 right. This is the numeric same number of sheets for example. It's a numeric of length three units of measure which is measured in kilos or is it measured in miles or liters or gallons. That's a unit. So each column has to be defined with a particle of data type. You can just say it was a column and it couldn't hold anything you want. No that doesn't work with databases. A relational database needs a precise definition of what type of column is going to be for the Stevel and before I go to the data dictionary I want to talk a little bit about the business context. Meaning why do those tables exist in ASAP. You know those tables full of material as tables for a list of countries there are so many different people say why do these tables exist in ACP SEP is a class of product called the ERP stands for enterprise resource planning ERP. Just to give a little background before we go on about because this is really important because unless you understand the environment and the data you're working with will not be able to understand about it in the right context. So what is an ERP and ERP is a software used to run the operations of a company. What kind of operations typical operations that a company does sales purchases H.R. activities accounting other logistics Riddell's management all the enterprise level activities of a company are with the help of ERP software ASAP. Just happens to be one such software heaven very popular. There are other packages in the ERP space like audit collapse Gerti get Edwards and there's a new generation of products like sales force workday. These are all examples of ERP SCBA nautical are the biggest in the cloud. Now these products ERP products Minsky's Sep that you're talking about aboud looking at the needs of thousands of companies you started way. In doing so would be a solid piece and the first implementation was an accounting implementation for a chemical company. So the chemical company has a certain set of business rules that needs to be implemented in that accounting package. Then from that point Sebi has done so many implementations across so many different industries that any new requirement that it sees in a company CEO for example SABC training implement its ERP for Johnson and Johnson Johnson Johnson. Let's say a pharmaceutical company or a consumer doesn't matter or whatever. So let's say pharma So Johnson and Johnson might have the same requirements as another pharmaceutical company like Bristol-Myers Squibb or Marcus. So any time there's a new requirement that things should be put in the product itself. Create a quarter for example Novartis which is its stock on raw materials required to create this pharmaceuticals. Johnson and Johnson does that. Bristol-Myers Squibb does that Pfizer does that all these pharma companies procure raw materials to create those medicines. So the procurement is something that's common across all the pharma companies. Right. Same thing with companies like Deloitte. So these companies they need employee management. So H.R. is a function that's required across the light across Accenture across TCAS across IBM so ACB has etcher a module that contains all the logic that is required to run the company. So most of these ERP software is has all the logic burden right out of the box to run a company. And that's the reason why you see so many different peoples and there's millions of lines of code written already by Sep that can just come plug and play and run and replace now that we understand why these tables already exist. We should also understand how to create dibbles as an abab consultant. It's your duty to create new tables if required. They are not always required but they are definitely required and in many instances and the plan is to create a table database table is the data.