16_intro to abap exercises

Upload: jose-antonio-campos-segura

Post on 03-Jun-2018

234 views

Category:

Documents


2 download

TRANSCRIPT

  • 8/12/2019 16_Intro to ABAP Exercises

    1/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    The following exercises are designed to help you understand the basics of the ABAPprogramming language.

    !"e solutions #or t"e rograms can $e #ound in ac%age &'ABAP47!R(). Writtensolutions can be found in your ABAP manuals.

    Be#ore *ou $egin t"e Introduction to ABAP exercises+ *ou must create a ne, Pac%age anda ne, -"ange Reuest+ so *our ,or% is stored as it mig"t $e on a client roect.To do this, find the sheet used for your first Package and Change e!uest "xercise and use thisif you need it to help you through the abbre#iated instructions below$

    Create a new Package, by going to the epository Browser %transaction &"'(), and typing'APXXB in the package field %whereXX is the last two digits of your logon id). Click on thedisplay pushbutton, and create the new Package, calling it something like *+ntro to ABAPPackage for your name-.

    01!E: 2"en *ou "it t"e save $utton+ do not use *our revious -"ange Reuest. +nstead,when the Change e!uest /uery &creen appears, click on the -reate Reuest pushbutton,enter a short description, such as *+ntro to ABAP Change e!uest for your name-, and sa#e.

    Write down the number of your change re!uest here$ 0000000000000000000000000000

    1se the green arrow to go back to your new Package, and ensure that all your programs in the+ntroduction to ABAP section of the course are stored in this Package.

    2arch 3((4Page 5

  • 8/12/2019 16_Intro to ABAP Exercises

    2/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater + Exercise

    The purpose of this exercise is for you to learn how to create an ABAP report program. Thereare many ways for you to create a program.

    To create a program from within the epository Browser, perform the following steps$

    5. "nsure your new package %6APXXB) is displayed in the epository Browser3. Click on the package name.7. Click on the *Create pushbutton %or choose menu path 89e#elopment ob:ect - Create;). pushbutton).

    The next screen you come to is the Program Attributes screen. ere you maintain the attributesof your program. The re!uired attributes are a title, type, and application.

    D. "nter a title for your program %e.g. &imple ABAP eport Program)'. "nter *5 for the program type. Type *5 indicates that this program is a report %executable)

    program. We will learn other program types in future sections of the ABAP course.E. "nter *& for the program application. This application is a means to classify programs in

    different areas. For example, *& classifies the program as a system %or basis) program and

    *F classifies the program as a financial accounting program.5(. Click on the *&a#e pushbutton %or choose menu path 8Program - &a#e;).

    55. +n the dialog box that is displayed, enter your change re!uest and press the *"nter key %orclick on the *Continue =green check> pushbutton). 6our change re!uest may be defaulted. +fnot, you can click on the *@wn re!uest pushbutton to get a display of your change re!uests.

    53. Back in the Program Attributes screen, click on the *&ource code pushbutton to na#igate intoyour program in the ABAP "ditor.

    +n the ABAP "ditor, notice that the 8"P@T; statement is defaulted for you. +n the nextexercise, you will add code to this program to create a simple ABAP report. Before mo#ing on tothe next exercise, you should become familiar with the menubar and toolbar options in the ABAP"ditor.

    2arch 3((4Page 3

  • 8/12/2019 16_Intro to ABAP Exercises

    3/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater 3+ Exercise

    Program 0ame$ 6APxx(705 %where *xx is the last two digits of your logon id)

    The purpose of this exercise is for you to create a simple ABAP report using system fields, icons,and numbered text elements %text symbols).

    1sing the program you created in the pre#ious example, code the appropriate statements togenerate the report shown in the sample output$

    For the current date, time, and user name %logon id), use the following system fields$ &6G9AT12, &6G1H"+T, and &6G1A2". To display all the a#ailable system fields, click on the*elp pushbutton in a program and enter the table structure 8&6;.

    1se the following icons$ +C@09AT", +C@0T+2", and +C@0A99"&&. To display all thea#ailable icons, execute the program 8&@W+C@; from the initial screen of the ABAP "ditor%transaction code 8&"7';).

    6ou should not use any text literals in the program. To display your name and address lines, usethe numbered text elements %text symbols).

    1se the 8Titles and eaders; section of the text elements to maintain the reports list header%81ser Address +nformation;).

    2arch 3((4Page 7

  • 8/12/2019 16_Intro to ABAP Exercises

    4/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater 4+ Exercise

    Program 0ame$ 6APxx(

  • 8/12/2019 16_Intro to ABAP Exercises

    5/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    2arch 3((4Page 4

  • 8/12/2019 16_Intro to ABAP Exercises

    6/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater 4+ Exercise

    Program 0ame$ 6APxx(

  • 8/12/2019 16_Intro to ABAP Exercises

    7/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    2arch 3((4Page D

  • 8/12/2019 16_Intro to ABAP Exercises

    8/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater 4+ Exercise 3

    Program 0ame$ 6APxx(

  • 8/12/2019 16_Intro to ABAP Exercises

    9/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater 5+ Exercise

    Program 0ame$ 6APxx(405 %where *xx is the last two digits of your logon id)

    The purpose of this exercise is for you to be able to use the basic @pen &/ 8&""CT;statement to read data from a database table.

    6ou are to create a program that reads the data in the 62@N+" table and generates a report with

    this information. The 62@N+" table contains Academy Award information. This table is not astandard &AP table %notice that its name starts with a 86;). We created this table for the purposeof your ABAP exercises. Jeep in mind that the concepts you learn using the 62@N+" table canbe applied to anyABAP 9ictionary table.

    Before coding this program, you should examine the structure of the 62@N+" table. Also, youshould #iew the table contents. 6ou can display a tables contents using the 9ata Browser%transaction code 8&"5?;). 6ou can also display a tables contents from the ABAP 9ictionary bychoosing the 81tilities - Table contents; menu path.

    2aintain the column headings for the report using the text elementsO howe#er, do not maintainany text symbols.

    &ee the sample output to determine the contents and layout of the report. 2ake sure that you

    can scroll to the right to see the entire Academy Award note %hint$ get help on the "P@Tstatement).

    Be sure to check &6G&1BC to determine if any records exist in 62@N+". +f not, write anappropriate message. The &6G&1BC check should always come immediately after the8"9&""CT;. 9o you know why it should always occur at this point and not within the8&""CT "9&""CT; loopQ

    2arch 3((4Page E

  • 8/12/2019 16_Intro to ABAP Exercises

    10/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    Please note that the actual contents of the 62@N+" table may be different when you create thisprogram from the contents at the time of the following screen print. This is true for all screenprints displaying database records. 6ou can always execute the solution programs to determinethe exact contents that your reports should display.

    -"ater 5+ Exercise

    Program 0ame$ 6APxx(403 %where *xx is the last two digits of your logon id)

    The purpose of this exercise is for you to be able to restrict the records retrie#ed from thedatabase table.

    6ou are to create a program that reads the data in the 62@N+" table for a specific categoryentered as a parameter. &ee the sample output to determine the contents and layout of thereport. Again, make sure that you can scroll to the right to see the entire Academy Award note.

    6ou can copy your pre#ious program and make the necessary changes. To copy a program,select it in the epository Browser and click on the *Copy pushbutton %or choose the89e#elopment ob:ect - Copy; menu path). 6ou can also copy a program from the initial screenof the ABAP "ditor %transaction code 8&"7';).

    2aintain the column headings for the report using the text elementsO howe#er, do not maintainany text symbols.

    2arch 3((4Page 5(

  • 8/12/2019 16_Intro to ABAP Exercises

    11/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    Be sure to check &6G&1BC to determine if any records exist in 62@N+" for the specifiedcategory. +f not, write an appropriate message. The &6G&1BC check should always comeimmediately afterthe 8"9&""CT;.

    2arch 3((4Page 55

  • 8/12/2019 16_Intro to ABAP Exercises

    12/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    otice the dropGdown arrow on the category parameter. 6ou should notcreate a search help forthis parameter. The dropGdown arrow to get a list of possible #alues is on this parameterbecause it was defined 8+J" 62@N+"GCAT"I@6;. The category field in the 62@N+" tablepoints to a domain that has a set of #alid #alues. Because of the #alid #alues at the domainle#el, any parameter defined 8+J"; the category field will ha#e a dropGdown arrow to get a list ofpossible #alues.

    -"ater 6+ Exercise

    2arch 3((4Page 53

  • 8/12/2019 16_Intro to ABAP Exercises

    13/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    Program 0ame$ 6APxx(?05 %where *xx is the last two digits of your logon id)

    The purpose of this exercise is for you to become familiar with control statements in ABAP.

    6ou are to create a program that acts as a calculator to perform addition, subtraction,multiplication, or di#ision. @n the selection screen, the user should enter two integers and anoperator %R, G, M, or L).

    The report generated should show the two integers, the operator, and the result. &ee the sampleoutput to determine the contents and layout of the report. +f an in#alid operator is entered, anappropriate message should be displayed on the report. +f trying to di#ide by Sero, an

    appropriate message should be displayed on the report.

    9o not maintain any text elements. emember to use the 8+J"; addition when defining#ariables where#er possible.

    2arch 3((4Page 57

  • 8/12/2019 16_Intro to ABAP Exercises

    14/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    2arch 3((4Page 5

  • 8/12/2019 16_Intro to ABAP Exercises

    15/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater 6+ Exercise

    Program 0ame$ 6APxx(?03 %where *xx is the last two digits of your logon id)

    The purpose of this exercise is for you to become familiar with control statements in ABAP.

    Control break processing is common to all programming languages, including ABAP. 6ou are tocreate a program that calculates the total seats occupied for each artist in the 6C@C"T table.The 6C@C"T table contains information about music concerts. This table is not a standard&AP table %notice that its name starts with a 86;). We created this table for the purpose of your

    ABAP exercises. Jeep in mind that the concepts you learn using the 6C@C"T table can beapplied to anyABAP 9ictionary table.

    Before coding this program, you should examine the structure of the 6C@C"T table. Also,you should #iew the table contents. 6ou can display a tables contents using the 9ata Browser%transaction code 8&"5?;). 6ou can also display a tables contents from the ABAP 9ictionary bychoosing the 81tilities - Table contents; menu path.

    &ee the sample output to determine the contents and layout of the report. The following fieldswill be used in the report$ 6C@C"TGAT+&T, 6C@C"TG"N"T9AT", 6C@C"TG&"AT&2A, 6C@C"TG&"AT&@CC, and 6C@C"TG@CAT+@.

    The total seats occupied should be printed at each artist break. CA1T+@$ ABAP may notunderstand the difference between the first record selected and a normal control break. +f thisdoes not make sense now, it will when you begin testing your program. %hint$ the system field

    &6G9BCT indicates the records selected in a &""CT loop and it is incremented with each looppass).

    Because you are grouping the data in the 6C@C"T table by artist, you need to be sure thatthe table is sorted on this field. Because you cannot assume that it is sorted in this manner, youcan specify the order in which to retrie#e records. Code your 8&""CT; statement as follows$

    &""CT M F@2 6C@C"T @9" B6 AT+&T.

    We will co#er the 8@9" B6; addition %and others) in a later chapter.

    2aintain the column headings for the report using the text elementsO howe#er, do not maintainany text symbols.

    2arch 3((4Page 54

  • 8/12/2019 16_Intro to ABAP Exercises

    16/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    2arch 3((4Page 5?

  • 8/12/2019 16_Intro to ABAP Exercises

    17/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater 7+ Exercise

    Program 0ame$ 6APxx(D05 %where *xx is the last two digits of your logon id)

    The purpose of this exercise is for you to become familiar with internal table processing.

    6ou are to create a program that generates a report of the top fi#e concerts with the highestattendance %seats occupied).

    6ou should create an internal table %with a header line) with fields for the following information$artist, date, seats occupied, and location.

    ead the 6C@C"T table entries into the internal table and list the top fi#e concerts on thereport. +f no entries exist in the table, an appropriate message should be displayed. &ee thesample output to determine the contents and layout of the report.

    9o notmaintain any text elements.

    2arch 3((4Page 5D

  • 8/12/2019 16_Intro to ABAP Exercises

    18/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater 7+ Exercise

    Program 0ame$ 6APxx(D03 %where *xx is the last two digits of your logon id)

    The purpose of this exercise is for you to become familiar with internal table processing.

    6ou are to create a program that generates a report of the concerts with attendance o#er 5',(((%seats occupied). The report should also display the total combined attendance for theseconcerts.

    6ou should create an internal table %with a header line) with fields for the following information$artist, date, seats occupied, and location.

    ead the 6C@C"T table entries into the internal table and list the concerts with attendanceo#er 5',((( %note$ the internal table should contain allthe concert entries, but the report shouldbe limited to those concerts with attendance o#er 5',(((). +f no concerts meet this criteria, anappropriate message should be displayed. This list should be sorted by concert attendance indescending order. &ee the sample output to determine the contents and layout of the report.

    9o notmaintain any text elements.

    2arch 3((4Page 5'

  • 8/12/2019 16_Intro to ABAP Exercises

    19/45

  • 8/12/2019 16_Intro to ABAP Exercises

    20/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater + Exercise

    Program 0ame$ 6APxx('05 %where *xx is the last two digits of your logon id)

    The purpose of this exercise is for you to become familiar with passing parameters tosubroutines.

    6ou are to create a program that generates a report with Academy Award information %from the62@N+" table) for a particular year entered as a parameter. The main processing of thisprogram should be in two subroutines.

    The first subroutine should be passed the year entered as a parameter. This parameter should

    be passed by #alue. +n this subroutine, all records for the specified year should be selected. +fno records exist for the year, an appropriate message should be displayed. For each recordselected, a second subroutine should write out the records information.

    The second subroutine should be passed the field string %structure) that contains the recordselected. The year, category, and winner should be written to the report in this subroutine. &eethe sample output to determine the layout of the report. 9o notmaintain any text elements.

    2arch 3((4Page 3(

  • 8/12/2019 16_Intro to ABAP Exercises

    21/45

  • 8/12/2019 16_Intro to ABAP Exercises

    22/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    2arch 3((4Page 33

  • 8/12/2019 16_Intro to ABAP Exercises

    23/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater + Exercise 3

    Program 0ame$ 6APxx('07 %where *xx is the last two digits of your logon id)8unction (rou$ 6Fxx8unction 9odule 60&A"&0xx

    The purpose of this exercise is for you to become familiar with creating function modules.

    6ou should copy the pre#ious program %6APxx('03) to create this new program %6APxx('07).Change the program to use your own function module, 860&A"&0xx; %where *xx is the last twodigits of your logon id).

    Before creating the new function module, you must create your own function group called 86Fxx;%where *xx is the last two digits of your logon id).

    The function module you create should calculate the total sales for a concert. This total sales isbased on an attendance number %seats occupied) and a ticket price. Before calculating the totalsales, this function module should check to see that the concert has already taken place %i.e. theconcert date is before the current date). +f not, an exception should be raised.

    The output is identical to the pre#ious exercise.

    2arch 3((4Page 37

  • 8/12/2019 16_Intro to ABAP Exercises

    24/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater + Exercise

    Program 0ame$ 6APxx(E05 %where *xx is the last two digits of your logon id)

    The purpose of this exercise is for you to become familiar with selecting a single record.

    6ou are to create a program that generates a report with Academy Award information %from the62@N+" table) for a specific year and category. The year and category should be entered asparameters. 9efine the year parameter 8+J" 62@N+"GAA6"A; and the category parameter8+J" 62@N+"GCAT"I@6;.

    The report should display the year, category, winner, and nominees for the specified year and

    category. +f an entry does not exist, an appropriate message should be displayed. The reportwill contain information in the following 62@N+" fields$ AA6"A, CAT"I@6, W+",A2"5, A2"3, A2"7, A2"

  • 8/12/2019 16_Intro to ABAP Exercises

    25/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater ;+ Exercise

    Program 0ame$ 6APxx5(05 %where *xx is the last two digits of your logon id)

    The purpose of this exercise is for you to become familiar with using aggregate functions.

    6ou are to create a program that generates a report with concert information %from the6C@C"T table).

    This report should include the number of entries in the table, the sum of the seats occupied, themaximum number of seats occupied, and the a#erage number of seats occupied. 6ou shoulduse aggregate functions to calculate these amounts.

    &ee the sample output to determine the contents and layout of the report.

    9o notmaintain any text elements.

    emember that the actual information you will see on your report depends on the data in the6C@C"T table at the time you execute your program. +f your report looks different than theabo#e screen print, execute the solution program to #erify the actual contents of the table. Thisshould be done for any report accessing information from a database table.

    2arch 3((4Page 34

  • 8/12/2019 16_Intro to ABAP Exercises

    26/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater ;+ Exercise

    Program 0ame$ 6APxx5(03 %where *xx is the last two digits of your logon id)

    The purpose of this exercise is for you to become familiar with using cursor processing.

    6ou are to create a program that generates a report with Academy Award information %from the62@N+" table). 6ou should use a cursor to select only the year, category, and winner fields forall records in the 62@N+" table. The selected records should be in descending order bycategory. Within each category, the selected records should be in descending order by year.

    &ee the sample output to determine the contents and layout of the report. 9o notmaintain any

    text elements.

    2arch 3((4Page 3?

  • 8/12/2019 16_Intro to ABAP Exercises

    27/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    Exercise 3

    Program 0ame$ 6APxx5(07 %where *xx is the last two digits of your logon id)

    1nderstanding the concept of inner and outer :oins will be an important part of your ABAPtraining. Pro:ects will generally discourage the use of nested selects andLor logical databases.For all the exercises that follow, you should use :oins where#er possible.

    A

  • 8/12/2019 16_Intro to ABAP Exercises

    28/45

  • 8/12/2019 16_Intro to ABAP Exercises

    29/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    This exercise will familiariSe you with the concept of sub!ueries. This is a #ery brief exercise,and should only take you a few minutes.

    1sing a subG!uery, find all the records in the &CA table, that do not exist in &F+IT. Writeout the name of the airline carrier, and their carrier +ds.

    6ou report will return 5D records.

    =uestion:

    ow is your sub!uery related to the inner :oin found in chapter 55Q

    -"ater + Exercise

    Program 0ame$ 6APxx5305 %where *xx is the last two digits of your logon id)

    2arch 3((4Page 3E

  • 8/12/2019 16_Intro to ABAP Exercises

    30/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    The purpose of this exercise is for you to become familiar with using authority checks.

    6ou are to create a program that checks the acti#ities allowed %e.g. create, change, display, anddelete) on #endor master records for the user executing the program. The acti#ity should beentered as a parameter. This parameter should be a length 3 numeric character field.

    &ome of the #alid acti#ities on the #endor master records are$(5 G create(3 G change(7 G display(? G mark for deletion

    The appropriate authority ob:ect for this authoriSation check is 8F0FA50APP;. This authorityob:ect has two fields$

    ACTNT %acti#ity)APPJH %application)

    6ou should suppress the check for the 8APPJH; field. The check for the 8ACTNT; field should beon the acti#ity parameter.

    To code the 8A1T@+T6GC"CJ @B"CT; statement, use the menu path 8"dit - +nsertstatement; %or the *Pattern pushbutton). 6ou need to enter the name of the authority ob:ect inthe 8AuthorityGCheck; field and the system will automatically code the appropriate 8A1T@+T6GC"CJ @B"CT; statement. By using this method, you cannot make a mistake typing in theproper authority ob:ect name and field names.

    The report generated by this program is simple. The line written to the report will indicatewhether the authority for the selected acti#ity was passed or failed. &ee the sample output forthe content and layout of the report in both scenarios.

    Although the processing logic of this program is not complex, imagine this authority check beingused in a program that is maintaining #endor master records. Without the authority check, anyuser executing the program may be able to change or delete records.

    Pass Authority Check$

    2arch 3((4Page 7(

  • 8/12/2019 16_Intro to ABAP Exercises

    31/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    Fail Authority Check$

    2arch 3((4Page 75

  • 8/12/2019 16_Intro to ABAP Exercises

    32/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater 3+ Exercise

    Program 0ame$ 6APxx5705 %where *xx is the last two digits of your logon id)

    The purpose of this exercise is for you to become familiar with using nested 8&""CT;statements to access information in hierarchically related tables %i.e. key fields are passed downto lower le#el tables).

    6ou are to create a program that retrie#es #endor information from the FA5 and FB5 tables.These tables contain #endor master records and are hierarchically related. Both of these tablesare clientGdependent %i.e. 2A9T is one of the key fields). emember that with @pen &/, youdo not ha#e to specify the client in the W"" clause. By default, @pen &/ statements

    operate on data for the current client.

    FA5 contains general #endor data %e.g. #endor name and address). The key field to this table,besides the client, is the #endor number %+F).

    FB5 contains a #endors company code information. @ne #endor can be assigned to multiplecompany codes %i.e. FB5 can contain multiple records per #endor). The key fields to this table,besides the client, are the #endor number %+F) and the company code %B1J&).

    1se nested 8&""CT; statements to access the data for each #endor and generate a report. Tolimit the total number of #endors displayed on the report, the 8&""CT; statement for FA5should use the condition$ W"" +F B"TW"" *N"9(53 A9 *N"95((.

    &ee the sample output to determine the contents and layout of the report. otice that the top ofthe report begins with a 8N"9@ +F@2AT+@; line. Also, the total number of #endorsprocessed is listed at the end of the report %hint$ you should not ha#e to define a #ariable for thiscountO the system field &6G9BCT =database count> indicates the number of records processedby a 8&""CT; statement).

    The following fields from FA5 and FB5 should appear on the report$FA5G+F %#endor number)FA5GA2"5 %#endor name 5)FB5GB1J& %company code)

    9o notmaintain any text elements.

    2arch 3((4Page 73

  • 8/12/2019 16_Intro to ABAP Exercises

    33/45

  • 8/12/2019 16_Intro to ABAP Exercises

    34/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    2arch 3((4Page 7

  • 8/12/2019 16_Intro to ABAP Exercises

    35/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater 3+ Exercise

    Program 0ame$ 6APxx5703 %where *xx is the last two digits of your logon id)

    The purpose of this exercise is for you to become familiar with using a logical database toaccess information in hierarchicallyGrelated tables %i.e. key fields are passed down to lower le#eltables).

    6ou should copy the pre#ious program %6xx5

  • 8/12/2019 16_Intro to ABAP Exercises

    36/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater 3+ Exercise 3

    Program 0ame$ 6APxx5707 %where *xx is the last two digits of your logon id)

    The purpose of this exercise is for you to become familiar with using a logical database toaccess information in hierarchicallyGrelated tables %i.e. key fields are passed down to lower le#eltables).

    6ou should copy the pre#ious program %6xx5

  • 8/12/2019 16_Intro to ABAP Exercises

    37/45

  • 8/12/2019 16_Intro to ABAP Exercises

    38/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    2arch 3((4Page 7'

  • 8/12/2019 16_Intro to ABAP Exercises

    39/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater 3+ Exercise 4

    Program 0ame$ 6APxx570< %where *xx is the last two digits of your logon id)

    The purpose of this exercise is for you to become familiar with using a logical database toaccess information in hierarchically related tables %i.e. key fields are passed down to lower le#eltables). This program is more detailed than the pre#ious ones in this chapter, so read theexercise carefully.

    6ou are to create a program that uses the logical database J9F to retrie#e #endor informationfrom the FA5, FB5, and B&+J tables. These tables contain #endor master records and arehierarchically related. All three tables are clientGdependent %i.e. 2A9T is one of the key fields).

    emember that with @pen &/, you do not ha#e to specify the client in the W"" clause. Bydefault, @pen &/ statements operate on data for the current client.

    FA5 contains general #endor data %e.g. #endor name and address). The key field to this table,besides the client, is the #endor number %+F).

    FB5 contains a #endors company code information. @ne #endor can be assigned to multiplecompany codes %i.e. FB5 can contain multiple records per #endor). The key fields to this table,besides the client, are the #endor number %+F) and the company code %B1J&).

    B&+J contains in#oices for particular #endor and company code. A #endor in one company codecan ha#e many in#oices %i.e. B&+J can contain multiple records per #endor and company code).&ome of the key fields to this table, besides the client, are the #endor number %+F), the

    company code %B1J&), fiscal year %IA), and accounting document number %B").

    Along with displaying the #endors and company codes, this report should display the openin#oices for a particular #endor and company code. An in#oice is 8open; if B&+JGB&C is *75.The report should also contain a total in#oice amount per company code. This amount should bedisplayed only if it is greater than Sero. A total in#oice amount per #endor should also bedisplayed.

    &ee the sample output to determine the contents and layout of the report. Again, the top of thereport should contain a 8N"9@ +F@2AT+@; line and the end of the report should containthe number of #endors processed.

    2arch 3((4Page 7E

  • 8/12/2019 16_Intro to ABAP Exercises

    40/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    imit the total number of #endors displayed on the report by specifying the range of #endorsfrom *N"9(

  • 8/12/2019 16_Intro to ABAP Exercises

    41/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    "nd of eport$

    2arch 3((4Page

  • 8/12/2019 16_Intro to ABAP Exercises

    42/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater 4+ Exercise

    Program 0ame$ 6APxx5

  • 8/12/2019 16_Intro to ABAP Exercises

    43/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater 4+ Exercise

    Program 0ame$ 6APxx5

  • 8/12/2019 16_Intro to ABAP Exercises

    44/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater 5+ Exercise

    Program 0ame$ 6APxx5405 %where *xx is the last two digits of your logon id)

    The purpose of this exercise is for you to become familiar with processing using extracts.

    6ou are to create a program that generates a report of the sales document data held in tables#bak %&ales 9ocument eader table) and #bap %&ales 9ocument +tem table). The report shoulddisplay the header and line detail information for the fields #bakG#beln %document number),#bakGkunnr %customer number), #bakGerdat %creation date) #bapGposnr %item number) and #bapGmatnr for each sales documents with document numbers from

  • 8/12/2019 16_Intro to ABAP Exercises

    45/45

    SAP R/3 Release 4.7Exercises: Introduction toABAP Programming SAP Develoment ABAP !raining

    -"ater 6+ Exercise

    Program 0ame$ 6APxx5?05 %where *xx is the last two digits of your logon id)

    Copy the program 65?05 to your own package. Change the to your ABAP number.Correct the code so that it compiles. Then use the 9ebugger to correct any other errors.

    Exercise

    Program 0ame$ 6APxx5?03 %where *xx is the last two digits of your logon id)

    Copy the program 65?03 to your own package. Change the to your ABAP number.Correct the code so that it compiles. Then use the 9ebugger to correct any other errors.

    Exercise 3

    Program 0ame$ 6xx5?07 %where *xx is the last two digits of your logon id)

    Copy the function module 60&A"&09"B1I0 %can be found at the #ery bottom of theob:ects in package 65D() to your own function group that you created in the exercises for chapterD. Change the to your ABAP number. Copy the program 65?07 to your own package.

    Change the to your ABAP number. +n the program, change the function call to the functionmodule you :ust copied. Correct the code so that it compiles. Then use the 9ebugger to correctany other errors.