codejam exercise 1 adt

Upload: mohammed-rasul-salaudeen

Post on 02-Jun-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 CodeJam Exercise 1 ADT

    1/18

  • 8/10/2019 CodeJam Exercise 1 ADT

    2/18

  • 8/10/2019 CodeJam Exercise 1 ADT

    3/18

    ABAP Development Tools for SAP NetWeaver AS ABAP 3

    CodeJam: ABAP for SAP HANA

    B. Getting Started with the ABAP Development Tools for SAP NetWeaver

    Explanation Screenshot

    1. Start the ABAP DevelopmentTools via the desktop shortcut

    (or via theABAPDevelopmentTools.e

    xein your installation folder)

    2. You can find several links onthe Welcome screen, e.g. to

    navigate to the open the onlinehelp for ABAP on HANADevelopment Tools, etc.

    Close the Welcome screen by

    clicking on the Workbenchicon

    in the upper-right corner.

    3. You are in the ABAPperspective.

    If not, open the ABAP

    perspective via the OpenPerspective icon, select ABAPin the popup window, andcontinue with OK.

  • 8/10/2019 CodeJam Exercise 1 ADT

    4/18

    ABAP Development Tools for SAP NetWeaver AS ABAP 4

    CodeJam: ABAP for SAP HANA

    Explanation Screenshot

    4. You are in the ABAPperspective now. Typically, thefirst step is to create an ABAPproject, which serves as theconnection to the ABAPbackend system.

    The ABAP Development Toolsuses the ABAP systeminformation stored in your SAPLogon application; therefore westart with the systemconfiguration in the SAP Logon(see next step).

    5. Go to the SAP Logonapplication and maintain a newsystem entry.

    You will find the system detailsin a separate document, e.g. asa handout document or emailedto you. Use that systeminformation to create thesystem entry.

  • 8/10/2019 CodeJam Exercise 1 ADT

    5/18

    ABAP Development Tools for SAP NetWeaver AS ABAP 5

    CodeJam: ABAP for SAP HANA

    Explanation Screenshot

    6. In the ABAP perspective of theADT, you can create the ABAPproject.

    Right-click in the Project

    Explorer view, select New >

    ABAP Project(shortcut

    Ctrl+Alt+Shift+P).

    7. In the New ABAP Projectdialog, use the Browse buttonto select from the list of existingsystems. Depending on thedescription given in the SAPLogon, you can select thesystem (double-click on thesystem entry).

  • 8/10/2019 CodeJam Exercise 1 ADT

    6/18

    ABAP Development Tools for SAP NetWeaver AS ABAP 6

    CodeJam: ABAP for SAP HANA

    Explanation Screenshot

    8. The system information is filledautomatically. You can justcontinue via the Next button.

  • 8/10/2019 CodeJam Exercise 1 ADT

    7/18

    ABAP Development Tools for SAP NetWeaver AS ABAP 7

    CodeJam: ABAP for SAP HANA

    Explanation Screenshot

    9. Insert the logon credentials forABAP user DEVELOPER##

    (where ##represents your

    group number) with thepassword provided on theseparate document, and

    proceed via the Finish button.

    10. In principle you are ready todo ABAP development now.

    Its helpful to define afavourite package containingthe training materials tosimplify the navigation. Forthis purpose, expand theABAP project you justcreated, right-click on theFavourite Packages entry,and click on Add a Package.

  • 8/10/2019 CodeJam Exercise 1 ADT

    8/18

    ABAP Development Tools for SAP NetWeaver AS ABAP 8

    CodeJam: ABAP for SAP HANA

    Explanation Screenshot

    11. You can filter for specificpackages (as depicted withthe filter TEST_A4H_102 inthe screenshot). Select yourexercise packageTEST_A4H_102_EX_## (withyour group number ##) andcontinue with OK.

    You may want to repeat thesteps to additionally add the

    solutions package to the list ofFavourite Packages.

    You have now successfully

    Created an ABAP Project in the ABAP Development Tools

    Customized the ABAP Project by adding Favorite Packages

    Information: You are in the ABAP development perspective andif thats the first time you experience it you certainly feel lost with the icons, toolbars, views, and tabs within the views. So its time to say a coupleof words about the purpose of all this.A perspective is a collection of menu bars, toolbars, and views, designed to serve best for the task at hand,which, in our scenario, is ABAP development. Therefore, the ABAP perspective gives you the views andtools you might probably need to do ABAP development, like the project explorer, space for the editor view(not visible yet), the outline view, the transport organizer view, etc. You can customize all these views,

    enlarge and minimize them etc. This customizing is saved, so you can restart the studio with exactly thesame settings. A useful tip for youin case you feel like you screwed up the perspectivein the menu baryou can find Windows > Reset Perspective, which will reset all views of the current perspective to thedefault layout.

  • 8/10/2019 CodeJam Exercise 1 ADT

    9/18

    ABAP Development Tools for SAP NetWeaver AS ABAP 9

    CodeJam: ABAP for SAP HANA

    C. Create a HelloWorld program

    In this exercise, youll create an ABAP Hello World program ZR_HELLO_WORLD_##in your ABAP package

    TEST_A4H_102_EX_##(##denoting your group number).

    Explanation Screenshot

    1. In the ABAP perspective,right-click on your package

    A4H_102_EX_##in the

    Project Explorer. Then selectNew > ABAP Program in thecontext menu.

    Remark:The context menuis filled with the recentlyused object. If you cant findthe menu item New ABAPRepository Object, selectNew > Other ABAPRepository Object.

    2. Enter the program name andthe description. Then

    continue via the Nextbutton.

  • 8/10/2019 CodeJam Exercise 1 ADT

    10/18

    ABAP Development Tools for SAP NetWeaver AS ABAP 10

    CodeJam: ABAP for SAP HANA

    Explanation Screenshot

    3. Typically the next step is to

    create or select a transportrequest. However, thedevelopment done in thisexercise is performed onpackage

    TEST_A4H_102_EX_##and

    youre informed that thechange recording is notenabled for the package. Soyou can simply proceed viathe Finishbutton.

    4. The editor view displays theyet-empty (except for the

    REPORTstatement) ABAP

    report.

    5. The next step is to do thenecessary ABAP coding.The program should createthe output depicted in thescreenshot.

    Hint:The username is

    obtained via a class methodof CL_ABAP_SYST.

    Code:ZR_HELLO_WORLD_##REPORT zr_hello_world_00.

    DATA lv_stringTYPE string.DATA lv_nameTYPE sy-uname.

    lv_name= cl_abap_syst=>get_user_name( ).lv_string= |Hello { lv_name}, welcome to the ABAP on HANA CodeJam!|.

    WRITE: lv_string.

  • 8/10/2019 CodeJam Exercise 1 ADT

    11/18

    ABAP Development Tools for SAP NetWeaver AS ABAP 11

    CodeJam: ABAP for SAP HANA

    Explanation Screenshot

    6. Insert the coding and activatethe program via the toolbaricon (shortcut CTRL+F3)

    7. Trigger the ABAP Pretty

    Printer (shortcut Shift+F1)

    If not done yet, you have toconfigure the source codeformatter (aka Pretty Printer).

    8. In the following popupwindow, activate theCheckbox and select your

    favorite Code style.

    Continue with the OKbutton.

  • 8/10/2019 CodeJam Exercise 1 ADT

    12/18

    ABAP Development Tools for SAP NetWeaver AS ABAP 12

    CodeJam: ABAP for SAP HANA

    Explanation Screenshot

    Remark:If you want to changethe ABAP Pretty Printer settings,go in the menu bar to Windows

    > Preferences. Select ABAPDevelopment > Editors >

    Source Code Editorsand

    select the Formatter.

    9. Run the ABAP program

    ZR_HELLO_WORLD_##.Right-click on the program inthe Project Explorer andselect Run As > ABAPApplication from the contextmenu or simply use the well-

    known shortcut F8.

  • 8/10/2019 CodeJam Exercise 1 ADT

    13/18

    ABAP Development Tools for SAP NetWeaver AS ABAP 13

    CodeJam: ABAP for SAP HANA

    D. Advanced Functionality

    The following steps will help you to familiarize yourself with some advanced functionality of the ABAPDevelopment Tools for SAP NetWeaver. You will work with functions which you probably already know fromthe ABAP development in SAP GUI.In particular, you will be using forward navigation, cross-references, element info, and code completion.

    Explanation Screenshot

    1. Enhance your ABAPProgramZR_HELLO_WORLD_##

    (where ##is your group

    number) with the codesnippet given below.

    Code:ZR_HELLO_WORLD_##

    REPORT zr_hello_world_00.

    DATA lv_stringTYPE string.

    DATA lv_nameTYPE sy-uname.DATA ls_t100TYPE t100.

    lv_name= cl_abap_syst=>get_user_name( ).lv_string= |Hello { lv_name}, welcome to the ABAP on HANA CodeJam!|.

    WRITE: lv_string.

    SELECT * FROM t100INTO ls_t100WHERE sprsl= 'E'AND arbgb= 'S_EPM_OIA'.

    WRITE: /ls_t100-text.ENDSELECT.

  • 8/10/2019 CodeJam Exercise 1 ADT

    14/18

    ABAP Development Tools for SAP NetWeaver AS ABAP 14

    CodeJam: ABAP for SAP HANA

    Explanation Screenshot

    2. In the SELECT statement,

    click on the table T100and

    navigate to the DataDictionary via the shortcut F3

    (alternatively keep the CTRL

    key pressed and click on thetable).

    The transparent table T100 isshown in an embedded SAPGUI window.

    Note:The fallback to use theembedded GUI is used for thetools not natively supported inthe ABAP Development Tools.

    3. Go back to the ABAPprogram and click on thevariable lv_stringin the

    coding. A local where-usedlist is triggered and allreferences are marked. Nextto the vertical scroll bar onthe right-hand side of theeditor window (not depictedin the screenshot) you seeall references in the currentcompilation unit

  • 8/10/2019 CodeJam Exercise 1 ADT

    15/18

  • 8/10/2019 CodeJam Exercise 1 ADT

    16/18

    ABAP Development Tools for SAP NetWeaver AS ABAP 16

    CodeJam: ABAP for SAP HANA

    Explanation Screenshot

    7. Enhance the WRITE

    statement to include the

    message number. Insertls_t100-and trigger the

    auto-completion via the

    shortcut CTRL+Space.

    You can select the entry

    msgnrvia the cursor keys;

    the completion is thentriggered via the return key.

    8. In addition to the completion

    of a structure element, theauto-completion can be usedto insert a full signature.

    Insert the function call of

    BAPI_TRANSACTION_and

    trigger the auto-completion viaCTRL+Space. Instead of

    inserting only the functionnameBAPI_TRANSACTION_COMMIT ,

    use the shortcutShift+Enterto insert the

    full signature.

    9. As a result, the full signatureof the function call isinserted.

    E. Conclusion

    You have now made your first steps with the ABAP Development Tools for SAP NetWeaver. But that hasjust been a very brief scratch on the surface. In the following exercises you will intensify the usage of theADT and we hope youllcontinue once youre back in your office.

    Curious? Theres even a dedicated CodeJam on the ABAP Development Tools for SAP Netweaver meetour ADT colleagues at an event near your location!

  • 8/10/2019 CodeJam Exercise 1 ADT

    17/18

  • 8/10/2019 CodeJam Exercise 1 ADT

    18/18