Sunday, February 27, 2022

3.Debugging

Debugging

Introduction:

  1. Debugging is the tool to trace the program execution line by line.
  2. Debugging is used to change the input values as run time.
  3. Debugging is used to stop the program execution as any execution statement by using break-point.

Break-point:

  1. Break point is the signal which interrupts the program execution.
  2. There are 2 types of break point
    • Static Break Point
    • Dynamic Break point

Difference btw static and dynamic break point:

  1. Static break point are achieved using break-point keyword.
  2. Static break point are not user specific. ie... program execution stops at static break point irrespective of who set the break point. but based on some condition we can set static break point as user specific.
  3. We can set static break point at any version of the program. ie.. active or inactive.
  4. SAMRTFORMS can be debugged using static break point.
------------------
  1. Dynamic break point are achieved using stop button in the application tool bar.
  2. Dynamic break point are user specific.ie... program execution stops only for the user who set that break point.
  3. We can set dynamic break point only at the active version of the program.
  4. We cannot debug the smartforms using dynamic break point.
Note:
        There are two ways to debug the program.
    1. Place the break point and execute the program.
    2. Execute the program and set in debugging mode.
Note:
        SY-UNAME is the system variable which contains the current user name.
        To achieve user specific static break point we have to use SY-UNAME in IF condition.
  1. If SY-UNAME = 'sapuser'.
  2.     break-point.
  3. Endif.

How to add/remove dynamic break point:

  1. Place the cursor on the program line where we want to add break point and click STOP button from application tool bar
  2. To remove the break point, place the cursor on the break point and press the STOP button from application tool bar.
Note:
        We can add upto 30 break point in a program.

Function keys:

  1. F5 - Line by line execution.
  2. F6 - To execute one block of code(complete subroutine or function module) at a time. 
  3. F7 - To exit from a block of code. ie.. if we are inside the block of code, F7 is used to come out of it.
  4. F8 - If there is any break point in upcoming line, It will jump to next break point or else comes out from program.

Watch Point:

    Watch point are used to stop the execution program based on particular condition.

Hot to add watch point in program:

  1. Click watch point from the application tool bar and provide name[Workarea-Fieldname]. ie.. wa-bukrs.
  2. Select rational operator(=, <, >). ie.. wa-bukrs = 
  3. Provide comparison value [pune]. ie.. wa-bukrs = pune.
  4. Press F8.
  5. program will execute, if wa-bukrs got the value pune then the execution will be stoped for examination.
Note:
        We can place upto 10 watch point in the program.

Debugger screen:

  1. Field: This is used to identify the field value and also change the values.
  2. Table: This is used to display the internal table data and also we can perform the operational operator. 
  3. Break point: This is used to find all the break points which are available in the program and line number.
  4. Watch point: This is used to identify all the watch points which are available in the program and also we can change the condition.
  5. Call stack: This is used to find the cursor position of the program.
  6. Overview: This is used to find all the blocks and events which are available in the program.
  7. Old Debugger: Debugger menu bar -> Click debugger -> Click switch to classic debugger.
Note:
  1. /H Tcode for run time debugger.
  2. Execute the program -> provide the input -> provide /H in command prompt -> press enter -> runtime debugger will be executed

















    

Friday, February 25, 2022

2.Data Dictionary

DDIC

1.Introduction

  1. Tcode for DDIC is SE11.
  2. Data dictionary is the central source of the data base management system. It is used to create and alter data base table in SAP
  3. SAP is the ready made product which contain predefined database tables and programs
  4. In real-time most of the time, we use standard database tables only. very few time we create our own database table.

    1.1.Steps to view table entries

    1. Execute TCode SE11.
    2. Select radio button database table.
    3. Enter the database table name and click the display button.
    4. Now, Click on contents from menu.
    5. Click execute to view database entries.

    1.2.SQL ( Structured Query Language )

    1. DDL - Data Definition Language. Which is used to create and alter the DB table.
    2. DML- Data Modification Language. Which is used to perform DM operations like Insert, Update, Modify, Delete
    3. DCL- Data Control Language. Which is used to perform commit and roll back operations.

    1.3.SQL vs Open SQL

    1. SQL is database dependent, Where as SAP is database independent. So SQL does not support SAP.
    2. Open SQL support the SAP because Open SQL is database independent.
    3. Open SQL does not support DDL, So we cannot create DB tables like we create tables in other database systems like oracle, etc
    4. Open SQL supports DDIC( Data dictionary ), Which is used to create and alter DB tables in SAP.

2.Data Dictionary(DDIC)

  1. Data dictionary is the central source of the database management system.
  2. Main functionality of the data dictionary is to create and alter the database tables.
There are two ways of creating the tables by using DDIC
    1. Direct Method
    2. Data Element Method
      • Bottom-Up Approach
      • Top-Down Approach

    2.1.Technical requirement to create the table:

  1. Name of the table.
    • In ABAP, Name of the table must be start with 'y' or 'z', because 'a' to 'x' are reserved for SAP.
  2. List of fields, data types, length.
  3. Delivery Class.
    • Delivery class defines the owner of the tables as well as it controls the transport of the data from one table to another table.
    • Types of delivery class:
      • A - Application table.
      • C - Customising table.
      • L - Table for storing temporary data.
      • G - Customising table.
      • E - Control table.
      • S & W - System table.
  4. Data class.
    • Data class defines the physical area of the database, where our tables are logically stored.
    • Some of the important data classes are:
      • APPL0 - Master data class
        • Master data are the data, That are accessed and updated rarely. 
        • Ex: Vendor master data, Customer master data, Material master data.
      • APPL1 - Transactional data class
        • Transactional data are the data, that are accessed and updated frequently.
        • Ex: Sales order data, Purchase order data.
      • APPL2 - Organisational data class
        • Organisational data are the data, that are accessed frequently but updated rarely.
        • Organisational data are created at the time of configuring system.
        • Ex: Company data, Branches data. 
  5. Size category.
    • Size category determines the space required for the table.
  6. Domain.
    • Domain is the collection of data type and its length.
    • Domain = (Char, 10).
  7. Data element.
    • Data element is the collection of domain with short description.
    • Date element = (Domain, Desc).
Note:
  1. Every table must have at-least one field as primary key field, that should be first field and the date type for that field should be char.
  2. SE11 is the Tcode for DDIC.

Thursday, February 24, 2022

1.Introduction

Topics Covered

  1. ERP
  2. SAP
  3. Role of ABAPer
  4. Types of project
  5. Source code
  6. Datatypes
  7. Technical requirement to create program

 SAP ABAP Introduction

  1. SAP    - System Application and Product in data processing
  2. ERP    - Enterprise Resource Planning
  3. ECC    - Enterprise Central Component
  4. ABAP - Advance Bussiness Application Programming

    1.ERP

        ERP contains predefine database tables and programs
        Some of the ERP products available in the markets are 
    • BAAN - Small and Medium scale industries [Vendors and Customers]
    • RAMCO - Small and Medium scale industries [Finance]
    • Peoplesoft - Large scale industries [Human Resource]
    • Oracle Apps - Large scale industries [Finance]
    • SAP - Large scale industries
        Note:
            Enterprise means big companies
            Resource means money, material, man power, machineries, marketing, etc
            Planning means how to properly utilise these resources for companies betterment 

    2.SAP

    1. SAP has tightly integrated across all the modules and departments [HR,MM, SD, FICO, etc]
    2. SAP is developed in multi-language and supports multi currencies
    3. SAP is developed by 5 former IBM employees
    4. SAP is ready made product with customisation facility 
    5. SAP is platform independent
    6. SAP supports cross application. ie, [SAP to SAP, SAP to non-SAP, non-SAP to SAP]
    7. SAP has its own programming language called ABAP
    8. SAP ABAP is not case sensitive language
    9. SAP ABAP is used to customise standard functionality of SAP

    3.Role of ABAPer

    ABAPer are responsible to create RICEFW

    R - Reports
    I  - Interface
    C - Conversion
    E - Enhancement
    F - Forms
    W - Workbench 

     1. Reports: 

                    Based on the given input fetching the data from database table and displaying it in a predefined formate is called reports. There are 3 types of reports
    • Classical reports - Display the entire information in a single list.
    • Interactive reports - Display the summarised information in the basic list and detailed information in the next list.
    • ALV reports - Display the output with predefined functionalities such as borders, sorting, etc
    2. Interface:
                    Interface are used to establish the connection between SAP to SAP and SAP to non-SAP
                    Example: ALE/IDOC and BAPI
    3. Conversion:
                    Conversion program are used to upload the data from the legacy system(file) to SAP system
                    Example: BDC, LSMW and BAPI
    4. Enhancement:
                    Enhancement are used to add some additional functionalities to standard SAP functionalities without disturbing the existing functionalities 
                    Example: User exit, Customer exit, Enhancement point, BADI            
    5. Forms:
                    Forms are used to prepare the business documents such as offer letters, invoice etc
                    Example: SMARTFORMS, SAP Script
    6. Workflow:
                    Workflow used to automate the existing business process
                    ie.. Workflow is used to identify the workload of an employee as well as performance of an employee

    4.Types of project

    • Implementation project
    • Upgradation project
    • Maintenance/Support project
    • Rollout project
    1.Implementation project:
                    If we want to implement SAP from scratch, then it means implementation project.
                    Phases:
        1. Project preparation phase
        2. Business blue print phase
        3. Realisation phase
        4. Post preparation phase
        5. Go-live and support phase
    2.Upgradation project:
                   Whenever there is change in SAP version, we have to implement the new features into our existing implementation is called upgradation project.
    3.Maintenance/Support project:
                  After project in live, it needs 24/7 support is called support project.
    4.Rollout project:
                   Whenever company purchase a new company or to implement a new module, it means rollout project.

    5.Source code

        The source code of an ABAP program consists of either a statement or comment.

        Statement:

             Statement is the collection of operators, operands, variable and keyword.

             Operators and  Operands:

                   In ABAP we have 3 types of operators mathematical operator, comparative operator, relational or logical operator.

                    1.Mathematical Operator
                                    
                         Operators   |    Description        |    Example

                         +                 |    Addition            |    3+2 = 5
                         -                  |    Subtraction        |    3-2 = 1
                         *                 |    Multiplication    |    3*2 = 6
                         **               |    Exponential       |    3**2 = 9
                         /                  |    Division            |    4/2 = 2
                         mod           |    Modulo division   5mod2 = 1

                    2.Comparative Operator

                        Description    `               |    Operator

                        Less Than                       |  <      or    LT
                        Less Than or EquaL       |  <=    or    LE
                        Greater Than                  |   >      or    GT
                        Greater Than or Equal   |   >=    or    GE
                        Equal                              |   =      or    EQ
                        Not Equal                       |   <>    or    NE 

                    3.Relational Operator

                        Operator       |     Example

                        AND             |   a<b and a<c
                        OR                |  a<b or a<c
                        NOT             |  a<b not a<c

            Variables

                Variable is the name given to the memory location.
                ie.. int a = 10, where value 10 is stored in memory location 'a'

            Keywords

                Keywords are used to identify the type of the statement.There are many keywords like
                    1.Calling Keywords
                    2.Controlling Keywords
                    3.Declarative Keywords (Data, Parameter, Types, Tables, etc)
                    4.Definition Keywords
                    5.Database Keywords
                    6.Event Keywords
                    7.Operational Keywords

        Comments:

            Comments are non executable statements, they are used to improve the readability of the code.

                Single line comment                     - use *
                Multiline comment.                      -  use
                To comment part of the line          - use "

    6.Datatypes

        There are two type of data types
            Numeric datatypes - Integer(I), Float(F), Packed decimal(P)
            Character datatype - Char(C), Date(D), Time(T), Numeric(N) 
            
            Note: 
                N is alphanumeric, it accepts both integer as well as character.
                I, F, D, T are Fixed length data type.
                P, C, N are variable length data type.

        Integer(I):    
            Syntax: Data <variable name> Type I.
                         Data roll_number Type I.
            Note: 
               Initial value of I is 0, 

        Float(F):    
            Syntax: Data <variable_name> Type F.
                         Data mark_1 Type F.    //    10.00 
            Note: 
               Initial value of F is .00, 

        Packed Decimal(P): 
            Syntax: Data <variable_name>(<length>) Type P decimal <no>.
                         Data item_price(10) Type P decimal 2.  
           Note: 
              Initial value of P is .00. // Based on 'no'  

        Char(C): 
            Syntax: Data <Variable_name>(<length>) Type C.
                         Data name(40) Type C.    
            Note: 
               Initial value of C is 'space'. 

        Numeric Char(N): 
            Syntax: Data <Variable_name>(<length>) Type N.
                         Data roll_number(5) Type N.
             Note: 
                Initial value of N is 00000. 

        Date: 
            Syntax: Data <variable_name> Type D.
                         Data creation_date Type D.    //yyyymmdd
            Note: 
                Initial value of D is 00000000. 

        Time(T): 
            Syntax: Data <variable_name> Type T.
                         Data delivery_time Type T.    //hh:mm:ss
            Note: 
               Initial value of integer is 000000. 

    Example:

    //Declaration
    Data: A Type I,
              B Type I,
              C Type I.
    //Assignment
    A = 10.
    B = 20.
    //Logic
    C = A + B.
    //Display
    write C.

    Output:
    30

        Note:
    1. In ABAP each statement ends with period(.)
    2. 'write' is operational statement to display the output.
    3. Chain operator(:) is used to declare more than one variable separated by Comma(,) and ends with Period(.)
    4. Data: A Type I,
                B Type I,
                C Type I.
      A = 10.
      B = 20.
      C = A + B.
      write C.

    7.Technical requirement to create program

    1. In ABAP, All the custom program must start with either z or y. 
    2. In ABAP, All the program must be stored in either local package/default package ($tmp) or custom package (zpackage)
    3. Latest version of ECC is 7.4

        Steps to create the program

    1. Open sap log on
    2. Goto SE38(ABAP Editor)
    3. Provide the program name and click create button
    4. Provide title/description
    5. Select the type of the program as executable
    6. Click save button
    7. Enter package name or save on local package($tmp)

        Steps to execute the program

    1. Save the program - ctrl+s
    2. Check the program - ctrl+F2
    3. Activate the program - ctrl+F3
    4. Execute the program - F8

            Note:

      1. Parameter is the keyword which accepts the inputs at runtime.
      2. Name of the parameter should not exceeds the length of 8 character.
      3. Parameter cannot accept the Float data type, only accepts packed decimal. 
      4. Default is the keyword used to provide default value to thr input variable.
      5. Obligatory is the keyword used to make input field mandatory.
    Example:

    //Declaration
    Parameter: input_1 Type I default 10,
                      input_2 Type I obligatory.
    Data: output Type I.
    //Logic
    output = input_1 + input_2.
    //Display output
    write output.

    Errors:

    // name more than 8 char
    Parameter: Name_of_the_country Type C(5).
     
    // only P is allowed
    Parameter: Item_price Type F.                             


                



















        


    15.Modern Syntax ( 7.4/7.5 Syntax )