Program 20-C - Orders Table - v3 - Part 1

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

Lecture description

READ an internal table with multiple keys. 

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] So we're going to pick the same program and copy it and call it we treat to become copy all Gert so we don't need the currency table. Instead we need the B key the B one by one. So this is the best table. And then this is business data for the order. This is arder description. This is customer groups and I think there is a 50 or not this the Z. The beauty is the payment terms hematomas captions in different languages. So all debate let me put it in comments here so that you can easily remember things. So Hallberg that I've given a brief description so that you can bring feedback later. So these are the five tables that will be joining and they said we'll start way progressively building up the data and we need to create structures first for these two peoples together. And where do we need zombies to be to let's say VBA key underscore we BPT just so that we are pretty sure that we are joining these two people CMEs elements from both these devices. The C deep OK so I'll be back. Of course you'll be of course. And then we don't need design because we don't have that here. And adapt that a man that is good and we don't need currency we need we be Keady he needs to be. That's the customer group. And then we need a Z to Z z. He's the payment of tips that's available in the BTD to OK. So this program is going to get a bit bigger. Somewhere around 150 200 leads. So I really are documents to us. I don't want to just leave it at that because it's going to be confusing to read after you have developed it. If you look at it maybe three months from now it's going to be very confusing. So in sort of back let's put a nice little comment that. Jargon of we key an maybe key the right control left battle and then you have a nice little comrade there that shows you that this structure is essentially used to join elements from these two things and then what was the next join the next elements. Our structure is from DVA creepy. I don't need a joint just need a couple of fuel from Buckbee work feel is need deviate Kaytee is the order description right. So we need order type order description just Duffys. Well we sort of pipes again and again and again I can do a comma here and then begin off by underscore U-V key. And we need order type an order description the ones that you have used in the previous versions of the programs. OK so this one is next but a comment here. OK. So this is the structure that's used to play MPB you do. Next we need DV ZBB. This is going to contain data from on payment dome's. Right. Again we need just to put our meters and boom the payment down description. So this is our structure we're going to put a comment here saying that this is due to payment types here or do we need next tier 1 5 1. That's customer group description. So there is no structure for the customer group in the world common. They're saying customer X. And finally we want to be a lot of big people. The final table that's going to contain a mix of all the fees that we need to show on the screen. Right. Where do we need to show on the screen. So we basically need one two three four five six seven not even seven because it's on the internet 7. Is all the dirt we need. Eat This is already countered we need might. So one two three four six seven eight nine. We need minefields in the final selection. That's what we want to show on the screen. So let's put all these things together in a structure to again OK so this is a final split. It contains nine elements. One two three four five six and nine and then I'm going to put a comment here that says that this is the final structure. We're going to write out aren't on the screen. And for the day those statements we need for the students let's create work hideous and in Dunner Peebles put all the structures. So these are internal people. And we need workarea. There's no way to create work is all we need to do is ensure that we don't have the tables of work and nothing else remains to seen except they're going to have sort of a TV are going to have W.D. to signify that it's a work area and what is this going to do that is by passing the all bottom and then Dragomir miles. So that way you do a vertical select and then hit the belly button and you're done. Right. And then we are done with a data statement. That's Dr. They saw statements are done now. Nick start with those select options for select options. We can do a you are the order. And let's put the payment terms on the customer groups as well. OK. That's that we're having to read these two additional select options. Most of talk with the select query in the start of an action even we're not going to join the tables. What was the plan. We joined these two tables together that was step number one. And then we pulled it up for these three tables as well and then essentially we construct the final internal table based off of these data and how we're going to do that. What are you going to see in the next 20 minutes. So the first line is between Riebeek and B key on key rebill equals the Beaky the rebill. So there's a common primary key behind these two people. And we don't need the other inner join because we're only going to join two peoples into work into this and done it right the first intimate Deeble the join off be back and B BTD OK. And no word on their conditions. All this remains the same in the past no. Katie we need to make sure that the past not a zero zero zero. I'm wondering explain that bit. OK. So just stick with me here. We be the the ones and zeros it is at zero. OK. I'll explain that little. And then then we'd be curity the payment. He's some of us go down auction and customer the group is in the select group as well. OK. The first selection is complete and absolutely check they do a quick Sendak's just good to go. After the select has been done work you want to do this check. You have to select really got some data. So if this internal table into which data has been pulled in OK and this is how it referred to that done with square brackets these narc initio Indes that there is some data and then some data that has been pulled in you could boot this way or you could do a sizable RC not equal to zero. If say so was equal to zero meaning some data has been pulled. You can do it in both these ways not here. I'm going to do it for all entries and then pull the data for the remaining three internal teams. So what we're essentially doing is as a first step we put it in the data on the joining of these two tables and for all entries in this internal structure structure pool the data for this this and this. All of the relevant data. And how are you going to do that. So for the first internal team this one we need two columns right from this table TV akey where the AARP this this column is equal to the inhumanity that we have already planned. The first thing to do selects right back to Senator Stephen D. D The first column Zygi the second column form BVP the way into Teagle IP under TV. Katie put all entries in the underscore the back under school be BPT right. This is the internal table that we are doing in we going to the where condition where you see the equals disinterment it will be the in Spross people do sign language. So this is the first set ex-GI. Now if you dont know how the for all entries work you'd have to refer to one of the previous videos then discuss about hope for all into sport. So this is an hour to the joint statement read again the bulk of the work is done behind the scenes the data is an it just becomes a set of values. So this is the second selection. And then it's going to fill up the second internal structure similarly. So that was the third select statement a pointed in the payment and the payment done description. And the fourth Silex statement is going to pull in the customer goop descriptions from the one by one did so at this point. What do we have these for dinner tables filled up essentially. We have to combine this data somehow to create this final table of essentially a combination of all these four tables. And how do you create that the way to create that is like this. So before they explain it to you on paper and let me blow a quick loop statement for debug and then show you how I'm going to flip that data. So what I've essentially added in this loop is this is our final structure where what we want to show on the screen. So I'm moving at the first in Dunner. Moving the Milwaukee area then I'm using it move corresponding to move some of the fees from this internal structure to this work area. The final work idea. Right. And then amusin the end state. So this is something that we are seeing a pattern and using a pen I'm appending this work Cadia to my indemnity and then I'm cleaning it. I don't explain it but with it. So there were four different and done all day. So this was a combination of the back and the BPT all of that. We got some of the data that already did work hard to created by did on custom of group payment terms. So on of the fees and then we have three other structures the midterms description order type description. Another one is customer group description. So this is like 0 1. Didn't cost more zero to wholesale customer terms of payment be 0 0 0 1 b media 0 0 0 or 2. Rate order type or is standard order of duty is quotation sources. And the final and on the table is essentially an extended version of the Stevel which is going to have all these tables listed here plus there are corresponding descriptions that are poured in from the stables. So the piece floats on here right here. And in order to do that I'm using a move could have spun me this important statement more corresponding you're going to use that a lot. So this is an internal table with five feet. This is a dinner table with C-9 fees and some of the feel the first feels match. So it is picked the order it feels match mood corresponding intelligently pulls data flow on one structure to another structure which has common elements. Move on the other hand applies to everything. Then if there is a mismatch there is a way to deal with it. But the point being it's not very intuitive. The structures are different the structure of the same movie works perfectly. Because the structure is a different yet we are using more corresponding to move data loss by though. You see I'm looking at it and while corresponding is working here to work Cadia meaning one row at a time I'm essentially moving data from this structure to this structure. OK. Ben workarea This is the work I'm moving from this area. This work area and using the uptrend misty when I am appending this work here in Tennessee. In fact the move corresponding is not pulling all the data from one table to another. What we're doing here is pulling the data to work Kedia Diller Deeble using the into statement and looping at it so that every time we get one one at a time until all the rows and then don't think we are dumb and in the loop every time I move corresponding target structure and then appended to the final table and I clear this that's what this clearness width of any quantum state mean because people tend to forget that even experienced programmers tend to forget it and this causes a lot of problems. What it does is it clears the data makes them blanks or zeroes or whatever the data types dictate. And then again it goes back to the loop. Right. And it fixes the secondo corresponding. No the data is up trash. Pen if there is a second row DePrince the second door if there is a third row that needs to be opened it goes to the third append goes at the last three four five six seven eight or 10 rows in the target table. When you're doing a pen it goes to the OR you get the point right and then make sure that you clear this because the next time in the loop fresh data comes in. This data should be removed. Otherwise it results in wrong data. What I want to do is show that to you using debug. So the loop is finished to execute this. And by the time I'm done this loop is complete. And the idea underscores final the final dinner table should be complete. So the final essentially has all data. One two three and for the first four columns is filled up.