Download presentation
Presentation is loading. Please wait.
1
ABAP and Stuff MINS298c-01 Fall 1998
2
Overview Control Break Logic in ABAP Nested Selects Debugger Extended Check Runtime Comparisons
3
Control Breaks Made Easy Data: TR_TAB like TERR_REGION occurs 0 with header line. LOOP AT TR_TAB. AT FIRST. WRITE: ‘ Terr Region Total’. ENDAT. AT NEW Terr. VLINE. Sub = 0. WRITE Terr. ENDAT. ADD Count to Sub. WRITE: Region, Count. AT END OF Region. WRITE: Sub. ADD Sub to Total. ENDAT. AT LAST: WRITE: Total. ENDAT. ENDLOOP. Terr Region Total ----------------------------- A 100 3 200 2 300 1 6 ---------------------------- B 100 4 150 4 8 ---------------------------- C 100 1 175 5 300 3 9 23
4
Control Breaks Made Easy Terr Region Total ----------------------------- A 100 3 200 2 300 1 6 ---------------------------- B 100 4 150 4 8 ---------------------------- C 100 1 175 5 300 3 9 23 Data: TR_TAB like TERR_REGION occurs 0 with header line. LOOP AT TR_TAB. AT FIRST. WRITE: ‘ Terr Region Total’. ENDAT. AT NEW Terr. VLINE. Sub = 0. WRITE Terr. ENDAT. ADD Count to Sub. WRITE: Region, Count. AT END OF Region. WRITE: Sub. ADD Sub to Total. ENDAT. AT LAST: WRITE: Total. ENDAT. ENDLOOP.
5
Control Breaks Made Easy Terr Region Total ----------------------------- A 100 3 200 2 300 1 6 ---------------------------- B 100 4 150 4 8 ---------------------------- C 100 1 175 5 300 3 9 23 Data: TR_TAB like TERR_REGION occurs 0 with header line. LOOP AT TR_TAB. AT FIRST. WRITE: ‘ Terr Region Total’. ENDAT. AT NEW Terr. VLINE. Sub = 0. WRITE Terr. ENDAT. ADD Count to Sub. WRITE: Region, Count. AT END OF Region. WRITE: Sub. ADD Sub to Total. ENDAT. AT LAST: WRITE: Total. ENDAT. ENDLOOP.
6
Control Breaks Made Easy Terr Region Total ----------------------------- A 100 3 200 2 300 1 6 ---------------------------- B 100 4 150 4 8 ---------------------------- C 100 1 175 5 300 3 9 23 Data: TR_TAB like TERR_REGION occurs 0 with header line. LOOP AT TR_TAB. AT FIRST. WRITE: ‘ Terr Region Total’. ENDAT. AT NEW Terr. VLINE. Sub = 0. WRITE Terr. ENDAT. ADD Count to Sub. WRITE: Region, Count. AT END OF Region. WRITE: Sub. ADD Sub to Total. ENDAT. AT LAST: WRITE: Total. ENDAT. ENDLOOP.
7
Control Breaks Made Easy Terr Region Total ----------------------------- A 100 3 200 2 300 1 6 ---------------------------- B 100 4 150 4 8 ---------------------------- C 100 1 175 5 300 3 9 23 Data: TR_TAB like TERR_REGION occurs 0 with header line. LOOP AT TR_TAB. AT FIRST. WRITE: ‘ Terr Region Total’. ENDAT. AT NEW Terr. VLINE. Sub = 0. WRITE Terr. ENDAT. ADD Count to Sub. WRITE: Region, Count. AT END OF Region. WRITE: Sub. ADD Sub to Total. ENDAT. AT LAST: WRITE: Total. ENDAT. ENDLOOP.
8
Control Breaks Made Easy Terr Region Total ----------------------------- A 100 3 200 2 300 1 6 ---------------------------- B 100 4 150 4 8 ---------------------------- C 100 1 175 5 300 3 9 23 Data: TR_TAB like TERR_REGION occurs 0 with header line. LOOP AT TR_TAB. AT FIRST. WRITE: ‘ Terr Region Total’. ENDAT. AT NEW Terr. VLINE. Sub = 0. WRITE Terr. ENDAT. ADD Count to Sub. WRITE: Region, Count. AT END OF Region. WRITE: Sub. ADD Sub to Total. ENDAT. AT LAST: WRITE: Total. ENDAT. ENDLOOP.
9
Control Breaks Made Easy Terr Region Total ----------------------------- A 100 3 200 2 300 1 6 ---------------------------- B 100 4 150 4 8 ---------------------------- C 100 1 175 5 300 3 9 23 Data: TR_TAB like TERR_REGION occurs 0 with header line. LOOP AT TR_TAB. AT FIRST. WRITE: ‘ Terr Region Total’. ENDAT. AT NEW Terr. VLINE. Sub = 0. WRITE Terr. ENDAT. ADD Count to Sub. WRITE: Region, Count. AT END OF Region. WRITE: Sub. ADD Sub to Total. ENDAT. AT LAST: WRITE: Total. ENDAT. ENDLOOP.
10
Control Breaks Made Easy Terr Region Total ----------------------------- A 100 3 200 2 300 1 6 ---------------------------- B 100 4 150 4 8 ---------------------------- C 100 1 175 5 300 3 9 23 Data: TR_TAB like TERR_REGION occurs 0 with header line. LOOP AT TR_TAB. AT FIRST. WRITE: ‘ Terr Region Total’. ENDAT. AT NEW Terr. VLINE. Sub = 0. WRITE Terr. ENDAT. ADD Count to Sub. WRITE: Region, Count. AT END OF Region. WRITE: Sub. ADD Sub to Total. ENDAT. AT LAST: WRITE: Total. ENDAT. ENDLOOP.
11
Control Breaks Made Easy Terr Region Total ----------------------------- A 100 3 200 2 300 1 6 ---------------------------- B 100 4 150 4 8 ---------------------------- C 100 1 175 5 300 3 9 23 Data: TR_TAB like TERR_REGION occurs 0 with header line. LOOP AT TR_TAB. AT FIRST. WRITE: ‘ Terr Region Total’. ENDAT. AT NEW Terr. VLINE. Sub = 0. WRITE Terr. ENDAT. ADD Count to Sub. WRITE: Region, Count. AT END OF Region. WRITE: Sub. ADD Sub to Total. ENDAT. AT LAST: WRITE: Total. ENDAT. ENDLOOP.
12
Control Breaks Made Easy Terr Region Total ----------------------------- A 100 3 200 2 300 1 6 ---------------------------- B 100 4 150 4 8 ---------------------------- C 100 1 175 5 300 3 9 23 Data: TR_TAB like TERR_REGION occurs 0 with header line. LOOP AT TR_TAB. AT FIRST. WRITE: ‘ Terr Region Total’. ENDAT. AT NEW Terr. VLINE. Sub = 0. WRITE Terr. ENDAT. ADD Count to Sub. WRITE: Region, Count. AT END OF Region. WRITE: Sub. ADD Sub to Total. ENDAT. AT LAST: WRITE: Total. ENDAT. ENDLOOP.
13
Control Breaks Made Easy Terr Region Total ----------------------------- A 100 3 200 2 300 1 6 ---------------------------- B 100 4 150 4 8 ---------------------------- C 100 1 175 5 300 3 9 23 Data: TR_TAB like TERR_REGION occurs 0 with header line. LOOP AT TR_TAB. AT FIRST. WRITE: ‘ Terr Region Total’. ENDAT. AT NEW Terr. VLINE. Sub = 0. WRITE Terr. ENDAT. ADD Count to Sub. WRITE: Region, Count. AT END OF Region. WRITE: Sub. ADD Sub to Total. ENDAT. AT LAST: WRITE: Total. ENDAT. ENDLOOP.
14
Control Breaks Made Easy Terr Region Total ----------------------------- A 100 3 200 2 300 1 6 ---------------------------- B 100 4 150 4 8 ---------------------------- C 100 1 175 5 300 3 9 23 Data: TR_TAB like TERR_REGION occurs 0 with header line. LOOP AT TR_TAB. AT FIRST. WRITE: ‘ Terr Region Total’. ENDAT. AT NEW Terr. VLINE. Sub = 0. WRITE Terr. ENDAT. ADD Count to Sub. WRITE: Region, Count. AT END OF Region. WRITE: Sub. ADD Sub to Total. ENDAT. AT LAST: WRITE: Total. ENDAT. ENDLOOP.
15
On Change Of You control the logic Example Perform Headings LOOP AT TR_TAB ON CHANGE OF Region Perform Region_Break. ON CHANGE OF Terr Perform Region_Break. Perform Terr_Break. ENDLOOP. Perform Region_Break. Perform Terr_Break. Perform Footings.
16
Nested Selects (p236) What is the outcome of the following nested selects Example Select * From Customers Select * From Bookings Where Customerid = Customer-id and order_date = ‘19990101’. Write: / customers-name, bookings-fldate. Endselect. What can you tell about the relationship between the Tables?
17
Debugger (p597) Allows you to –watch program execute step by step –check contents of fields tables –change contents –establish breakpoints
18
Extended Check (p596) Catches inconsistencies –unreachable code –uncalled subroutines notifies you of potential problems may explain unexpected results
19
Runtime Comparisons Given that there are many ways to accomplish the same thing in ABAP, SAP provides a means to compare them side by side. Predefined comparisons Can put own code in Use SE30 to run comparisons
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.