190 likes | 395 Views
ABAP and Stuff. MINS298c-01 Fall 1998. Overview. Control Break Logic in ABAP Nested Selects Debugger Extended Check Runtime Comparisons. Control Breaks Made Easy. Terr Region Total ----------------------------- A 100 3
E N D
ABAP and Stuff MINS298c-01 Fall 1998
Overview • Control Break Logic in ABAP • Nested Selects • Debugger • Extended Check • Runtime Comparisons
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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. Endselect. • What can you tell about the relationship between the Tables?
Debugger (p597) • Allows you to • watch program execute step by step • check contents of • fields • tables • change contents • establish breakpoints
Extended Check (p596) • Catches inconsistencies • unreachable code • uncalled subroutines • notifies you of potential problems • may explain unexpected results
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