html5-img
1 / 132

ABAP Training

ABAP Training. Odin Lee 6/2005. Agenda. ABAP Program Flow ( 30 Mins ) ABAP Dictionary – Data type ( 90 Mins ) ABAP Program ( 300 Mins ) ABAP Editor ( 30 Mins ) Selection Screen ( 90 Mins ) Query Database ( 90 Mins ) ABAP List ( 90 Mins ). ABAP Program Flow.

Télécharger la présentation

ABAP Training

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ABAP Training Odin Lee 6/2005

  2. Agenda • ABAP Program Flow ( 30 Mins ) • ABAP Dictionary – Data type ( 90 Mins ) • ABAP Program ( 300 Mins ) • ABAP Editor ( 30 Mins ) • Selection Screen ( 90 Mins ) • Query Database ( 90 Mins ) • ABAP List ( 90 Mins )

  3. ABAP Program Flow • ABAP Program Flow ( 30 Mins ) • ABAP Dictionary – Data type ( 90 Mins ) • ABAP Program ( 300 Mins ) • ABAP Editor ( 30 Mins ) • Selection Screen ( 90 Mins ) • Query Database ( 90 Mins ) • ABAP List ( 90 Mins )

  4. Client / Server Architecture

  5. Program Repository Start Database Table Report Program Flow – 1.Program Start

  6. Program ABAP Program Repository Start Selection Screen Data Objects Database Table ABAP Processing Block ABAP Runtime System 2.System Load Program Context

  7. Program ABAP Program Start Data Objects Database Table ABAP Processing Block ABAP Runtime System 3.Runtime System Sends Selection screen

  8. Program ABAP Program Start Data objects Database Table ABAP Processing Block ABAP Runtime System 4.Selection Screen Entries Insert into Data Object

  9. Program ABAP Program Start Data objects Database Table ABAP Processing Block ABAP Runtime System 5.Program Requests Data Record from Database

  10. Program Program ABAP Program ABAP Program Start Start Data objects Data objects Database Database Table Table ABAP ABAP Processing Processing Block Block ABAP Runtime System ABAP Runtime System 6.Database Returns Data Record to Program

  11. Program ABAP Program Start Data objects Database Table ABAP Processing Block ABAP Runtime System 7.Runtime System Sends List

  12. ABAP Dictionary – Data Type • ABAP Program Flow ( 30 Mins ) • ABAP Dictionary – Data type ( 90 Mins ) • ABAP Program ( 300 Mins ) • ABAP Editor ( 30 Mins ) • Selection Screen ( 90 Mins ) • Query Database ( 90 Mins ) • ABAP List ( 90 Mins )

  13. Data Types

  14. Basic Types

  15. Packed Number Declear length Output length no decimals Output length with decimals

  16. Types can be defined locally in a program or centrally in the Dictionary Local Types in program: ABAP Dictionary Technical Attributes Only ABAP Program ABAP Global Types in ABAP Dictionary: Source Technical and Semantic Attribute Code Interface Subroutine Global and Local Data Types

  17. ABAP Dictionary

  18. DB objects Type definitions Structure Table, View DB table Table type Data elements Services Poss. values Screen F4 Help F1 Function of ABAP Dictionary

  19. View Objects are automatically created in the DB and Table 2 Table 1 adjusted to changes ABAP Dictionary Database View Table 2 Table 1 Database Object in the ABAP Dictionary

  20. Address Book Telephone Address Name Address Phone No. Last name First name Town Town name House no. Street ZIP • There are three different type categories in the ABAP Dictionary: • Data elements: Describe an elementary type by defining the data type, length and possibly decimal places. • Structures: Consist of components that can have any type. • Table types: Describe the structure of an internal table. Type Definition in the ABAP Dictionary

  21. Internal table type

  22. Internal table type – line type 輸入table name或是structure name

  23. Internal table type – table type 輸入想使用的table access 方式

  24. Internal table type - key

  25. Maintenance of flights LH Carrier F4 Flight number . . . F1 Code of the flight connection Code defining a flight connection between two cities, e.g. 0400 Frankfurt - New York. Services of the ABAP Dictionary

  26. Development environment Screen Reads structure of Painter database objects ABAP Editor ABAP Dictionary Read type definitions Database Runtime environment interface Screen Interpreter ABAP Interpreter Linking to the Development and Runtime Environment

  27. Field Label Input Field Data Element: Technical Type Field Label Field Documentation (for F1 Help) Search Help (for F4 Help) F1 Global Data Type-Using Data Element

  28. S_CARR_ID. DATA wa_carrid TYPE F1 Data element Structure Type S_CARR_ID SBC405_S_SFLIGHT Fields Field type Double-Click Double-Click CARRID S_CARR_ID CONNID ... Finding ABAP Dictionary Types

  29. Help for Local Data Type Declaration F1 <type>. TYPES Types: <user_defined_type> TYPE Double-Click Help for Local Data Object Declaration Navigates to Local F1 Data Type Declaration or ABAP Dictionary <type>. TYPE DATA DATA: <data_object> Type Declaration F1 Keyword Documentation for Built-In Types Double-Click Local Data Types in Program

  30. ABAP Editor • ABAP Program Flow ( 30 Mins ) • ABAP Dictionary – Data type ( 90 Mins ) • ABAP Program ( 300 Mins ) • ABAP Editor ( 30 Mins ) • Selection Screen ( 90 Mins ) • Query Database ( 90 Mins ) • ABAP List ( 90 Mins )

  31. ABAP Editor

  32. 1 2 3 Create a Report Program

  33. Comment and Chained Statement REPORT yrep_create_01 . DATA wa_flight TYPE sflight. " work area for SFLIGHT *read data from DB table SFLIGHT SELECT * FROM sflight INTO CORRESPONDING FIELDS OF wa_flight. NEW-LINE. WRITE : wa_flight-carrid, wa_flight-connid, wa_flight-fldate, wa_flight-seatsocc, wa_flight-seatsmax. ENDSELECT. Comment Comment Chained Statement

  34. Navigation in the Editor and Keyword Documention REPORT yrep_create_01 . DATA wa_flight LIKE sflight. SELECT * FROM sflight INTO CORRESPONDING FIELDS OF wa_flight. NEW-LINE. WRITE: wa_flight-carrid, wa_flight-connid, wa_flight-fldate, wa_flight-seatsocc, wa_flight-seatsmax. ENDSELECT. Definition of Structure In the Program Double Click Double Click F1 Definition of Database Table in the ABAP Dictionary Keyword Documentation

  35. ABAP Program <user-defined-type>. DATA: <varname> TYPE <ABAP-dictionary-type>. ABAP Dictionary DATA: <varname> LIKE <data-object>. Reference Data Object Defining Data Object

  36. Declaring Data Objects ABAP Program carrid counter Data Element Tmp_carrid S_carr_id DATA: Carrid TYPE s_carr_id, carr counter TYPE I, ABAP Basic Type Tmp_carrid LIKE carrid. Data Object

  37. Numeric literal Literals and Constants CONSTANTS <constants> TYPE <type> VALUE <literal>. CONSTANTS: C_PI TYPE P DECIMALS 4 VALUE '3.1415', C_NAME(4) TYPE C VALUE 'Hugo'. 1234, -987 Whole number (a minus sign is placed in front of negative numbers) Text literal 'abdc' , '2.17', '1.213E15', ‘HELLO', 'A''B' Character sequence set off by single quotation marks, 255 characters max.

  38. CONCATENATE f1 ... fn INTO g. J o h n DATA: ONE(10)   VALUE ' John ',       TWO(3)    VALUE 'F.',       THREE(10) VALUE ' Kennedy',       NAME(20).       FIRST     TYPE STRING. CONCATENATE ONE TWO THREE INTO NAME. NAME then contains the value ' JohnF. Kennedy'. F . K e n n e d y J o h n F . K e n n e d y Concatenate Statement

  39. Data Declarations: CONSTANTS c_id TYPE s_carr_id VALUE 'AA‘ . DATA: d_id1 TYPE s_carr_id , d_id2 TYPE s_carr_id VALUE 'LH ', counter TYPE i . d_id1 d_id2 counter Program Start c_id AA LH 0000 AA LH 0000 MOVE MOVE c_id TO d_id1 AA AA 0000 d_id2 = d_id1. AA AA 0001 ADD 1 TO counter. CLEAR CLEAR: gd _carrid1, gd _carrid2, 0000 counter. ABAP Program ABAP Runtime System Chang Variable Value – Copy and Initialization

  40. Debugger – Field Data Flow

  41. Watchpoint Debugger - Watchpoint

  42. Structure Definition wa _ spfli Sdyn_conn _ ABAP Program ABAP Source Code DATA: w_spfli TYPE spfli. TABLES: sdyn_conn. Defining Structure with Dictionary Type Reference

  43. ABAP _ WA_SPFLI Program mandt carrid CONNID CITYFROM Fields in structures are always addressed by ABAP Source Code <structure>-<field_name> DATA: w_spfli TYPE spfli. TABLES: sdyn_conn. sdyn_conn-carrid = 'AA'. SELECT * FROM spfli INTO w_spfli WHERE carrid = sdyn_conn-carrid. WRITE: / w_spfli-connid, w_spfli-cityfrom, w_spfli-cityto. ENDSELECT. Addressing Fields in Structures

  44. MOVE-CORRESPONDING <rec1> TO <rec2>. DATA: wa _ sflight TYPE sflight , wa _sbc400focc TYPE sbc400focc. ... MOVE-CORRESPONDING wa _ sflight TO wa _sbc400focc. MOVE-CORRESPONDING wa _ sflight TO wa _sbc400focc. MANDT CARRID CONNID FLDATE ... SEATSMAX SEATSOCC ... wa _ sflight 401 LH 0400 20000513 ... 280 100 ... PERCENTAGE SEATSMAX SEATSOCC CARRID CONNID FLDATE 280 100 0400 20000513 LH Moving Values Fields for Field

  45. Double-Click Debugger - Structure

  46. CARRID CONNID DISTANCE CARRID CONNID DISTANCE Line Type Line Type Key Key Fields Key Sequence AA 0017 2,572 Unique / Non-Unique Key LH 0400 6,162 LH 0400 6,162 Table Kind Table Kind QF 0005 10,000 Access with Index 5 5 SQ 0866 1,625 Data Access Type UA 0007 2,572 UA 0007 UA 0007 Access with Key You do not have to determine the number of lines in your table; the ABAP runtime system automatically determines this at runtime (dynamic table expansion). Internal Table

  47. ANY TABLE ANY TABLE INDEX TABLE HASHED TABLE INDEX TABLE HASHED TABLE STANDARD TABLE STANDARD TABLE Access with n n n n Index Access with Key Unique / NON- UNIQUE UNIQUE | NON-UNIQUE UNIQUE Non-Unique Key SORTED TABLE SORTED TABLE Access Using Mainly Index Mainly Keys Keys Only Table Types

  48. ABAP IT_flight Program DATA it_flight TYPE SBC405_T_SFLIGHT Defining Internal Table Reference to Dictionary Type

  49. Debugger – Internal Table

  50. Append APPEND APPEND wa _ itab to itab . Insert INSERT INSERT wa _ itab INTO itab <condition>. Read READ READ TABLE itab INTO wa _ itab <condition>. Change MODIFY MODIFY TABLE itab <condition>. Delete DELETE DELETE itab <condition>. Processing Single Record

More Related