+ All Categories
Home > Documents > 18_Online Programming Exercises.doc

18_Online Programming Exercises.doc

Date post: 04-Jun-2018
Category:
Upload: jyotsana-sharma
View: 224 times
Download: 0 times
Share this document with a friend

of 28

Transcript
  • 8/14/2019 18_Online Programming Exercises.doc

    1/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    The following exercises are designed to help you understand online programming. Remember that anonline program can also be called a module pool program, a dialog program, or a transaction.

    For many of the online programs you create, you will be using the YMO!"#O$% database table thatcontains &cademy &ward information. 'e created this table for the purpose of demonstrating onlineprogramming techni(ues. )eep in mind that the concepts you learn using the YMO!"#O$% table canbe applied to anyonline program using any&*&$ +ictionary tables-.

    "ach of the exercises contains a testing section. This is nota comprehensie test plan. The (uestionsas/ed in this section for each program should be used to ma/e sure the basics in your program arefunctioning properly. !f you can thin/ of any other important testing conditions, feel free to list them.

    Te sol!tions "or te programming section can #e "o!n$ in pac%age &'ABAP47TR(). !f you arehaing trouble figuring out how an online program should wor/, execute the solution online program.'ritten solutions can be found in your &*&$ manuals.

    Be"ore *o! #egin EA+, Online Programming exercises- *o! m!st assign *o!r create$ o#ects toa Pac%age an$ a +ange Re!est provi$e$ #* te instr!ctor- so *o!r 0or% is store$ as it migt#e on a client proect.

    March 0112$age 3

  • 8/14/2019 18_Online Programming Exercises.doc

    2/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    +apter 1- Programming Section

    Online program name4 5&$MYO$xx3 where 6xx7 is the last two digits of your logon id-Transaction code4 YO$xx3

    !nitial screen4 81115creen 81114 next screen 9 81135creen 81134 next screen 9 8111

    The purpose of this exercise is for you to create a simple online program to become familiar with thebasic components of an online program. &s you are creating this online program, try to identify eachcomponent you are creating4 screen attributes, screen layout, field attributes, flow logic, $*O modules,$&! modules, and global data.

    This online program will act as an adding machine. On the initial screen 8111-, the user will enter twointegers. &fter pressing the 6"nter7 /ey, the user should be ta/en to the next screen 8113-.

    On this second screen, the two integers from the first screen will be displayed along with the result of theaddition operation. These three fields should be display fields only i.e. the user should not be able toenter alues in these three fields-. &fter pressing the 6"nter7 /ey, the user should be ta/en bac/ to theinitial screen. The preious alues should be cleared out when the user returns to the initial screen.

    &ll three integer fields should be eight bytes long.

    &n example of these two screens can be seen on the next page.

    +on7t forget you need to create a transaction code to execute this online program. *ecause you haenot learned how to code an exit in an online program, the easiest way to execute the program is to use a:o;tcode

  • 8/14/2019 18_Online Programming Exercises.doc

    3/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    5creen 8111

    5creen 8113

    March 0112$age A

  • 8/14/2019 18_Online Programming Exercises.doc

    4/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    Testing Section

    3- ?an you enter a number with decimals on the initial screenB expected 9 no-

    0- !s the result being calculated correctlyB expected 9 yes-

    A- &re all three alues displayed on the second screenB expected 9 yes-

    C- ?an you enter alues on the second screenB expected 9 no-

    2- &re the alues cleared out when you return to the initial screenB expected 9 yes-

    D- +oes the program loop from screen 8111 to 8113 and bac/ to 8111 as you press 6"nter7B expected9 yes-

    March 0112$age C

  • 8/14/2019 18_Online Programming Exercises.doc

    5/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    +apter 3- Programming Section

    Online program name4 5&$MYO$xx0 where 6xx7 is the last two digits of your logon id-Transaction code4 YO$xx0!nitial screen4 81115creen 81114 next screen 9 8113

    The purpose of this exercise is for you to learn how to create the arious graphical elements on a screen4radio buttons, chec/ boxes, frames, and pushbuttons. You will not code any logic into this program.

    'o! so!l$ not spen$ more tan 42 min!tes on tis program.

    The !nstructor% input:output template should be A1Elength character field. The "aluation% input:outputtemplate should be a scrollable field with a defined length of D1 characters and a isible length of A1characters. The 65ubmit "aluation7 pushbutton should hae an icon and be assigned the function code"&@%.

    March 0112$age 2

  • 8/14/2019 18_Online Programming Exercises.doc

    6/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    Testing Section

    3- &re the radio buttons mutually exclusieB expected 9 yes-

    0- !s the 6"aluation7 template scrollableB expected 9 yes-

    March 0112$age D

  • 8/14/2019 18_Online Programming Exercises.doc

    7/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    +apters 42- Programming Section

    Online program name4 5&$MYO$xxA where 6xx7 is the last two digits of your logon id-Transaction code4 YO$xxA!nitial screen4 81115creen 81114 next screen 9 81135creen 81134 next screen 9 8111

    The purpose of this exercise is for you to learn how to use &*&$ +ictionary fields in an online program.You will build upon this program in future exercises.

    5creen 8111

    On this initial screen, the user will enter a year and category. These fields both the templates and textlabels- should be painted% from the YMO!"#O$% table. The year template should be a re(uired field.

    &fter pressing the 6"nter7 /ey, the user should be ta/en to the next screen 8113-.

    5creen 8113

    On this second screen, the two alues from the first screen will be displayed. These two fields should bedisplay fields only. &lso on this screen, the winner, the fie nominees, and the notes should be displayedfor the specified year and category. These fields both the templates and text labels- should be painted%from the YMO!"#O$% table. These fields should be both input and output fields. &fter pressing the6"nter7 /ey, the user should be ta/en bac/ to the initial screen. The preious alues should be clearedout when the user returns to the initial screen.

    &n example of these two screens can be seen on the next page.

    March 0112$age

  • 8/14/2019 18_Online Programming Exercises.doc

    8/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    5creen 8111

    5creen 8113

    March 0112$age =

  • 8/14/2019 18_Online Programming Exercises.doc

    9/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    Testing Section

    3- &re $!?%, M&@%, and F"M% the only acceptable entries for the category template on the initialscreenB expected 9 yes-

    0- !s the year field re(uired on the initial screenB expected 9 yes-

    A- !s the proper record being selected from YMO!"#O$%B expected 9 yes- GHote4 loo/ at the tablecontents in the &*&$ +ictionary 5"33- or +ata *rowser 5"3D-I

    C- &re the winner, nominees, and notes fields open for input on the second screenB expected 9 yes-

    2- &re the year and category fields display only on the second screenB expected 9 yes-

    D- !f you enter a nonEexisting record e.g. 3831, $!?- on the initial screen, are the winner, nominees,

    and notes fields blan/ on the second screenB expected 9 yes-

    - &re the alues cleared out when you return to the initial screenB expected 9 yes-

    =- +oes the program loop from screen 8111 to 8113 and bac/ to 8111 as you press 6"nter7B expected9 yes-

    March 0112$age 8

  • 8/14/2019 18_Online Programming Exercises.doc

    10/28

  • 8/14/2019 18_Online Programming Exercises.doc

    11/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    Testing Section

    N This section will only test for new functionality

    3- !f an inalid year is entered, is an appropriate error message is displayed and the year and categoryfields left open for inputB expected 9 yes-

    G+on7t forget to test the boundaries here. 63807 should pass the year chec/, but 6380D7 shouldnot. @i/ewise, 63887 should pass the year chec/, but 6388=7 should not.I

    0- !f a record does not exist, is an appropriate error message is displayed and the year and categoryfields left open for inputB expected 9 yes-

    A- 'hen either chec/ fails, does the user hae to ma/e a change to moe on to the next screenBexpected 9 yes-

    C- +o default alues appear in the year and category fieldsB expected 9 yes-

    2- On the second screen, is the cursor positioned on the notes fieldB expected 9 yes-

    +apters 89- Programming Section

    Online program name4 5&$MYO$xx2 where 6xx7 is the last two digits of your logon id-Transaction code4 YO$xx2!nitial screen4 81115creen 81114 next screen 9 81115creen 81134 next screen 9 81135creen 8110 dialog box-4 next screen 9 8110

    The purpose of this exercise is for you to learn how to use a Jraphical Kser !nterface JK!- in an onlineprogram and how to dynamically determine the screen se(uence based on the user7s actions.

    'o! so!l$ cop* *o!r SAP6'OPxx4 program to create program SAP6'OPxx2. First create thenew pac/age, then select program 5&$MYO$xxC in the Ob>ect *rowser and clic/ on the copypushbutton or use the +eelopment ob>ect E< ?opy% menu path-. Ma/e sure you select all thecomponents to copy documentation, ariants, JK! status, screens, includes-. You will be prompted tocreate new include programs EE >ust clic/ on the 6?opy7 pushbutton or press the 6"nter7 /ey. The $ac/agescreen should appear E enter the new $ac/age here, and ensure the new ?hange Re(uest is used.

    March 0112$age 33

  • 8/14/2019 18_Online Programming Exercises.doc

    12/28

  • 8/14/2019 18_Online Programming Exercises.doc

    13/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    5creen 8113

    This screen should use the JK! status 65"?OH+7 with the following function codes4 "!T, !H!T, andMO+!.

    On this screen, the user will ultimately be able to insert or update a record with the 6Modify Record7pushbutton. You will not add this functionality to the 6MO+!7 function code until the next example.

    !f the user clic/s on the 6"xit7 pushbutton which ino/es the 6"!T7 function code-, the transaction shouldbe terminated. !f the user clic/s on the 6!nitial 5creen7 pushbutton which ino/es the 6!H!T7 functioncode-, the user should be ta/en bac/ to screen 8111. !f the user presses the 6"nter7 /ey, the user shouldnot be ta/en bac/ to screen 8111.

    You will need to add two new fields to this screen. First, the critic template should be painted% from theYMO!"#O$% table only the template should be painted%, not the /ey word-. This field should be adisplay only field. 5econd, you should create the 6"nter ?ritic7 pushbutton and assign it the function code6H&M"7. !f the user clic/s on the 6"nter ?ritic7 pushbutton which ino/es the 6H&M"7 function code-, theuser should be ta/en to screen 8110 a dialog box-.

    March 0112$age 3A

  • 8/14/2019 18_Online Programming Exercises.doc

    14/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    March 0112$age 3C

  • 8/14/2019 18_Online Programming Exercises.doc

    15/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    5creen 8110

    You will hae to create this new screen. !t is a dialog box that will be called% from screen 8113. Theonly two fields on this screen should be painted% from the YMO!"#O$% table. You want both the critictemplate and critic /ey word.

    This screen should use the JK! status 6T!R+7 with the function code 6R"T7. This function code shouldbe assigned to the 6"nter7 /ey.

    !f the user presses the 6"nter7 /ey which ino/es the 6R"T7 function code-, the user should be ta/en bac/to the calling% screen.

    +O HOT FORJ"T TO ?O+" & '&Y OKT OF T!5 +!&@OJ *OPPP

    March 0112$age 32

  • 8/14/2019 18_Online Programming Exercises.doc

    16/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    Testing Section

    N This section will only test for new functionality

    3- !f the user clic/s on the 6"xit7 pushbutton on screen 8111 or 8113, is the transaction terminatedBexpected 9 yes-

    0- !f the user clic/s on the 6!nitial 5creen7 pushbutton on screen 8113, is the user returned to screen8111B expected 9 yes-

    A- !f the user clic/s on the 6"dit Record7 pushbutton on screen 8111 and the record does not exist, is anappropriate error message displayed and the year and category fields left open for inputB expected9 yes-

    C- !f the user clic/s on the 6&dd Record7 pushbutton on screen 8111 and the record already exists, is anappropriate error message displayed and the year and category fields left open for inputB expected9 yes-

    2- !f the user clic/s on the 6&dd Record7 pushbutton on screen 8111 and the record does not exist, is theuser ta/en to screen 8113 with all the fields except the year and category- blan/B expected 9 yes-

    G& good way to test this one completely is to try to add an existing record e.g. 388C, $!?-. Youshould get an error message. Then, change the year and category to one that does not exist andclic/ on 6&dd7 again. &ll the fields except the year and category- should be blan/ on screen8113.I

    2- !s the critic field display only on screen 8113B expected 9 yes-

    D- !f the user clic/s on the 6"nter Hame7 pushbutton on screen 8113, is the user ta/en to the dialog boxscreen 8110B expected 9 yes-

    - !f the user hits the 6"nter7 /ey on screen 8110, is the user ta/en bac/ to screen 8113 with theappropriate critic displayedB expected 9 yes-

    March 0112$age 3D

  • 8/14/2019 18_Online Programming Exercises.doc

    17/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    +apters 8184- Programming Section

    Online program name4 5&$MYO$xxD where 6xx7 is the last two digits of your logon id-Transaction code4 YO$xxD!nitial screen4 81115creen 81114 next screen 9 81115creen 81134 next screen 9 81135creen 8110 dialog box-4 next screen 9 8110

    The purpose of this exercise is for you to learn how to conditionally execute modules, update or insert arecord in the database, and use the logical loc/ing mechanism.

    'o! so!l$ cop* *o!r SAP6'OPxx2 program to create program SAP6'OPxx. First create thenew $ac/age, then select program 5&$MYO$xx2 in the Ob>ect *rowser and clic/ on the copypushbutton or use the +eelopment ob>ect < ?opy% menu path-. Ma/e sure you select all thecomponents to copy documentation, ariants, JK! status, screens, includes-. You will be prompted tocreate new include programs EE >ust clic/ on the 6?opy7 pushbutton or press the 6"nter7 /ey. The $ac/agescreen should appear L enter the new $ac/age here, and ensure the new ?hange Re(uest is used.

    The appearance of the screens will not change in this program. Ma/e sure that the 6"!T7 and 6!H!T7function codes on your JK! are defined as type 6"7 function codes.

    To use the logical loc/ing mechanism, you can use the existing loc/ ob>ect 6"Q#MO!"7 or you cancreate your own. !f you create your own loc/ ob>ect, it should be named 6"Q#MO!"7 where 67 isthe last two digits of your logon id-. Remember that a loc/ ob>ect is an &*&$ +ictionary ob>ect.

    &dd the following functionality to the program4

    5creen 8111

    !f the user clic/s on the 6"xit7 pushbutton which ino/es the 6"!T7 function code of type 6"7-, thetransaction should be terminated een before the automatic screen field chec/s occur.

    !f the user clic/s on the 6"dit Record7 or 6&dd Record7 pushbutton and the record is currently loc/ed, anerror message should be issued e.g. This record is currently loc/ed%-. !f this error message isdisplayed, the year and category fields should be open for input.

    5creen 8113

    !f the user clic/s on the 6Modify Record7 pushbutton which ino/es the 6MO+!7 function code-4

    3- The record will be updatedin the database if the user had clic/ed on the 6"dit Record7pushbutton 6"+!T7 function code- on the initial screen

    or

    0- The record will be insertedinto the database if the user had clic/ed on the 6&dd Record7pushbutton 6&++7 function code- on the initial screen.

    March 0112$age 3

  • 8/14/2019 18_Online Programming Exercises.doc

    18/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    !f the update:insert is successful, the changes should be confirmed to the database and the user shouldbe ta/en bac/ to screen 8111. !f the update:insert is not successful, the changes should be canceledand the user should be ta/en bac/ to screen 8111. You can display appropriate messages for eachscenario, but ma/e sure that the user can return to the initial screen i.e. do not use an error or abendmessage-.

    !f the user clic/s on the 6"xit7 pushbutton which ino/es the 6"!T7 function code of type 6"7-, thetransaction should be terminated een before the automatic screen field chec/s occur.

    !f the user clic/s on the 6!nitial 5creen7 pushbutton which ino/es the 6!H!T7 function code of type 6"7-, theuser should be ta/en bac/ to screen 8111 een before the automatic screen field chec/s occur.

    *efore the user returns to screen 8111, the record should be unloc/ed. Remember that you will haemore than one way bac/ to the initial screen.

    March 0112$age 3=

  • 8/14/2019 18_Online Programming Exercises.doc

    19/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    Testing Section

    N This section will only test for new functionality

    3- !f the user clic/s on the 6"xit7 pushbutton on screen 8111 or 8113, is the transaction terminatedbefore any automatic screen field chec/s occurB expected 9 yes-

    0- !f the user clic/s on the 6!nitial 5creen7 pushbutton on screen 8113, is the user returned to screen8111 before any automatic screen field chec/s occurB expected 9 yes-

    A- &re records being loc/ed and unloc/ed correctlyB expected 9 yes-G& good way to test this one is to hae multiple sessions running the transaction. 'ith mult ipletransactions, you can try to edit:add a record that is currently loc/ed. Once you determine thatthe loc/ing% is wor/ing, ma/e sure that the records are being unloc/ed%.I

    C- !s the record being updated:insertedB expected 9 yes-

    March 0112$age 38

  • 8/14/2019 18_Online Programming Exercises.doc

    20/28

  • 8/14/2019 18_Online Programming Exercises.doc

    21/28

  • 8/14/2019 18_Online Programming Exercises.doc

    22/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    Testing Section

    N This section will only test for new functionality

    3- !f the user clic/s on the 6'inners for Year7 pushbutton on screen 8111 and at least one record existsfor the specified year, is the user ta/en to screen 811AB expected 9 yes-

    0- !f the user clic/s on the 6'inners for Year7 pushbutton on screen 8111 and no records exist for thespecified year, is the appropriate error message issuedB expected 9 yes-

    A- &re the correct alues being placed in the stepEloop fieldsB expected 9 yes-

    C- !f the user presses the 6"nter7 /ey on screen 811A, is the user ta/en bac/ to screen 8111B expected9 yes-

    +apter 8- Programming Section

    Online program name4 5&$MYO$xx= where 6xx7 is the last two digits of your logon id-Transaction code4 YO$xx=!nitial screen4 81115creen 81114 next screen 9 81135creen 81134 next screen 9 81135creen 8311 5ubscreen-4 next screen 9 8311

    !n this exercise, you will create and program which uses a tabstrip control that changes 0it teapplication server. Your tabstrip control will return fields from the YMO!"#O$ table based on a yearthat the user enters in screen 8111 and which tab is selected in screen 8113. &ll your tabs will displaythe same fields in subscreen 8311.

    March 0112$age 00

  • 8/14/2019 18_Online Programming Exercises.doc

    23/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    Screen 999

    Screen 998

    March 0112$age 0A

  • 8/14/2019 18_Online Programming Exercises.doc

    24/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    +apter 8- Programming Section

    Online program name4 5&$MYO$xx8 where 6xx7 is the last two digits of your logon id-Transaction code4 YO$xx8!nitial screen4 81115creen 81114 next screen 9 81135creen 81134 next screen 9 81135creen 8311 5ubscreen-45creen 8313 5ubscreen-4

    !n this exercise, you will create and program which uses a tabstrip control that changes 0ito!t teapplication server. Your tabstrip control will return fields from the YMO!"#O$ table based on the yearand category that the user enters in screen 8111. Remember, all field held within the tabstrip must bepopulated before the tabstrip screen is displayed. !n your tabstrip, you will hae two tabs. One will holdthe information of a winner for a specific category, while the other holds nominee information.

    March 0112$age 0C

  • 8/14/2019 18_Online Programming Exercises.doc

    25/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    8111

    8113 'inner-

    March 0112$age 02

  • 8/14/2019 18_Online Programming Exercises.doc

    26/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    8113 Hominees-

    +apter 87 Ta#le +ontrol;

    Programming SectionOnline program name4 5&$MYO$xx31 where 6xx7 is the last two digits of your logon id-Transaction code4 YO$xx31!nitial screen4 81115creen 81114 next screen 9 81135creen 81134 next screen 9 8113

    !n this exercise, you will create a program that uses a table control. Your table control will display inscreen 8113-, fields from the YMO!"#O$ table based on a year that the user enters in screen 8111.

    March 0112$age 0D

  • 8/14/2019 18_Online Programming Exercises.doc

    27/28

    SAP R/3 Release4.7

    Online Programming:Exercises SAP Development ABAP Training

    The YMO!"#O$ fields to display in screen 8113 are4 Y"&R?, ?&T"JORY, '!HH"R, H&M"3,H&M"0, H&M"A, H&M"C and H&M"2. The year and category columns are fixed columns, while theothers are scrollable.

    8111

    For this screen7s $&!, you should select records for the chosen year and put those records in an internaltable.

    March 0112$age 0

  • 8/14/2019 18_Online Programming Exercises.doc

    28/28


Recommended