basic abap overview

Upload: kumar-krishna-kumar

Post on 03-Jun-2018

239 views

Category:

Documents


2 download

TRANSCRIPT

  • 8/12/2019 Basic ABAP Overview

    1/45

    India SAP CoE, Slide 1

    ABAPGeneral Concepts

  • 8/12/2019 Basic ABAP Overview

    2/45

    India SAP CoE, Slide 2

    Topics Covered

    SAP Architecture R/3

    Reports

    Function Modules

    Interfaces BDCs, LSMW

    Cross Applications BAPIs, RFCs, IDOCs

  • 8/12/2019 Basic ABAP Overview

    3/45

    India SAP CoE, Slide 3

    SAP R/3 Architecture

  • 8/12/2019 Basic ABAP Overview

    4/45

    India SAP CoE, Slide 4

    R/3 Architecture

  • 8/12/2019 Basic ABAP Overview

    5/45

    India SAP CoE, Slide 5

    R/3 Architecture

  • 8/12/2019 Basic ABAP Overview

    6/45

    India SAP CoE, Slide 6

    R/3 Architecture

  • 8/12/2019 Basic ABAP Overview

    7/45

    India SAP CoE, Slide 7

    Some Common Transactions

    SE38ABAP Editor

    SE37ABAP Function Modules

    SE11ABAP Dictionary SE93Transactions

    SE80Object Navigator

    LSMWLegacy System Migration Workbench

    SHDBTransaction Recorder

    SM35Session Overview

  • 8/12/2019 Basic ABAP Overview

    8/45India SAP CoE, Slide 8

    Reports

  • 8/12/2019 Basic ABAP Overview

    9/45India SAP CoE, Slide 9

    Reports

    Reports are Programs that read data from the database, processes

    the data and displays the data to the required format.

    Reports are uses in day to day business environment. For eg

    Displaying the purchase orders vendor wise

    Displaying the balance of vendors to be paid till a particular date

    Enhance the efficiency & transparency of Business Processes

    Sound Decision making with the control of master data and

    accurate reporting

    Relevant Documents immediately available for in case of drill down

    reports

    Multiple angles of Data representing and Forecasting Values

  • 8/12/2019 Basic ABAP Overview

    10/45India SAP CoE, Slide 10

    Reports: Classification

    Classical

    Interactive

  • 8/12/2019 Basic ABAP Overview

    11/45India SAP CoE, Slide 11

    Process Flow: Classical Report

  • 8/12/2019 Basic ABAP Overview

    12/45India SAP CoE, Slide 12

    Process Flow: Interactive Report

    event keyword

    processing block

    internal control

    eventkeyword

    processing blockinternal control

    ...

    external control

    external control

    event begin

    event end

  • 8/12/2019 Basic ABAP Overview

    13/45India SAP CoE, Slide 13

    Events

    ABAP/4 repor t p rograms are event dr iven prog rams

    The dif ferent events in a report Prog ram are:

    Init ial ization.

    Initialization of all the values. You can fill your selection screen with some

    values at runtime.At Selection -Screen.

    Validation & Checks of inputted values happen here

    Start-of-Selection.

    Here the program starts selecting values from tables.

    End-of-selection.

    After all the data has been selected this event writes the data to the screen.Interactiv e Events .

    Used for interactive reporting. It is used to create a detailed list from a basic

    list.

  • 8/12/2019 Basic ABAP Overview

    14/45India SAP CoE, Slide 14

    Data Declaration

    Data statement

    Like and Type Keywords

  • 8/12/2019 Basic ABAP Overview

    15/45India SAP CoE, Slide 15

    Internal Tables

    Standard Sorted Hashed

    Key Access

    Ac cess Time

    For n Entr ies

    Access Using

    Table Scan Binary Srch Hash Funct ion

    Increases Linearly

    (O(n))

    Increases Lo gar i thmical ly

    (O(log(n))

    Remains Co nstant

    (O(1))

    Predominant ly

    Index

    Predominant ly

    Key Key Only

    NON-UNIQUE UNIQUE| NON-UNIQUE UNIQUEUniqueness

  • 8/12/2019 Basic ABAP Overview

    16/45

  • 8/12/2019 Basic ABAP Overview

    17/45India SAP CoE, Slide 17

    Common Statements

    Write

    Loop.. Endloop

    If Else Endif

    Case When Endcase

    Select

  • 8/12/2019 Basic ABAP Overview

    18/45India SAP CoE, Slide 18

    Interactive Reporting

    The following are the different events associated with Interactive

    Reporting

    Event Keyword Event

    At Line-Selection Event is triggered by either the user doubleclicking a particular line or using F2 to select it

    At User-Command Event triggered by user pressing a function key

    At PFn

    Where n is between 0 to 99

    Event triggered on press of a function key.

    Top-of-Page during Line

    Selection

    Event called during list processing when a detailed

    list is called

  • 8/12/2019 Basic ABAP Overview

    19/45India SAP CoE, Slide 19

    Interactive Reporting Cont..Hotspot

    If one drags the mouse over the data displayed in the report using the FORMAT

    statement then the cursor changes to a Hand with an Outstretched Index finger

    Syntax: Format Hotspot On (Off).

    HideThis command helps you to store the field names based on which one will be doing

    further processing to get a detailed list. It is written directly after the WRITE

    statement for a field. When a row is selected the values get automatically filled inthe variables for further use.

    Syntax: Hide .

    Get Cursor CommandLike Hide this is also used for getting the values after selection of a row.

    Syntax: Get Cursor field cur_name value cur_value.

    cur_name and cur_value are variables.CALL TRANSACTION '' AND SKIP FIRST SCREEN.

    Call a SAP transaction from ABAP Code.

  • 8/12/2019 Basic ABAP Overview

    20/45India SAP CoE, Slide 20

    Modularization

    SubroutinesSubroutines are procedures that you can define in any ABAP

    program and also call from any program.

    Function modulesFunction modules are procedures that are defined in function

    groups and can be called from any ABAP program.

    IncludeIf you want to use the same sequence of statements in several

    programs, you can code them once in an include program.

  • 8/12/2019 Basic ABAP Overview

    21/45India SAP CoE, Slide 21

    Subroutines

    Defining SubroutinesFORM [USING ... [VALUE(][)] [TYPE |LIKE ]... ]

    [CHANGING... [VALUE(][)] [TYPE |LIKE ]... ].

    ...

    ENDFORM.

    The Parameter InterfaceParameters Passed by Reference

    list these parameters after USING without the VALUE addition

    Parameters Passed by Value

    list these parameters after USING with the VALUE addition

    Passing by Value and ResultIf you want to return a changed output parameter from a

    subroutine to the calling program only after the subroutine has run

    successfully, use CHANGING for the option of the FORM

    and PERFORM

  • 8/12/2019 Basic ABAP Overview

    22/45India SAP CoE, Slide 22

    Subroutines Cont..

    Calling SubroutinesPERFORM... [USING ... ... ]

    [CHANGING... ... ].

    Static Variable

    If you want to keep the value of a local data object after exiting the subroutine, youmust use the STATICS statement to declare it instead of the DATA statement. With

    STATICS you declare a data object that is globally defined, but only locally visible

    from the subroutine in which it is defined.

    STATICS f_text TYPE f_word VALUE 'INIT'.

  • 8/12/2019 Basic ABAP Overview

    23/45India SAP CoE, Slide 23

    Function modules

    Calling Function ModulesCALL FUNCTION

    [EXPORTING f1 = a 1.... f n = a n]

    [IMPORTING f1 = a 1.... f n = a n]

    [CHANGING f1 = a 1.... f n = a n]

    [TABLES f1 = a 1.... f n = a n][EXCEPTIONS e1 = r 1....en = rn [ERROR_MESSAGE = r E]

    [OTHERS = ro]].

    Creating Function Modules (SE37)Attributes

    Parameter InterfaceTables

    Exceptions

    Source Code

  • 8/12/2019 Basic ABAP Overview

    24/45India SAP CoE, Slide 24

    Debugger Cont..

    FieldsThe scrollable field display contains the contents of up to eight fields. The contents of thethree most important system fields are always displayed. This is the default display mode in

    the Debugger. See also Processing Fields

    Table Displays the contents of an internal table. This mode allows you to display and edit the

    entries in an internal table. See also Processing Internal Tables

    Breakpoints A scrollable display containing up to 30 breakpoints. Next to each breakpoint is a counter.

    You can also delete breakpoints in this display. See also Managing Dynamic Breakpoints

    Watchpoints You can set a watchpoint for a field so that the program is interrupted whenever the value of

    that field changes. This display mode contains a list of Watchpoints, the fields and programs

    to which they are assigned, the current values of the fields, and the conditions upon which

    the watchpoint is activated. See also Setting Watchpoints

    Calls This mode displays the current sequence of events, and the sequence of calls up to the

    current breakpoint. The last active call is displayed at the top of the list; previous calls are

    listed in reverse chronological order. When an event (for example, START-OF-SELECTION)concludes, it is deleted from the display.

    Overview This mode displays the structure of the program. It lists its events, subroutines, and

    modules, and shows which sections belong to which events. It also displays the section

    currently being processed.

    Settings This mode displays the current Debugger settings. You can change the settings by selecting

    or deselecting various options. For further information, refer to Settings and Warnings

  • 8/12/2019 Basic ABAP Overview

    25/45India SAP CoE, Slide 25

    HandsOn

    An output report is required which

    takes sales document no (VBAP-

    VBELN) as input, selects the fieldsVBELN POSNR & NTGEW and

    displays a report as shown :

  • 8/12/2019 Basic ABAP Overview

    26/45India SAP CoE, Slide 26

    HandsOn: Steps

    Declare Internal table

    Create Selection Screen

    Select data from VBAP and store inInternal table

    Loop at the internal table and display

    the data.

  • 8/12/2019 Basic ABAP Overview

    27/45

    India SAP CoE, Slide 27

    Additional Info

    Use the below link for complete details on ABAP.

    http://help.sap.com/saphelp_47x200/helpdata/en/d3/2e974d35c511d

    1829f0000e829fbfe/frameset.htm

    http://help.sap.com/saphelp_47x200/helpdata/en/d3/2e974d35c511d1829f0000e829fbfe/frameset.htmhttp://help.sap.com/saphelp_47x200/helpdata/en/d3/2e974d35c511d1829f0000e829fbfe/frameset.htmhttp://help.sap.com/saphelp_47x200/helpdata/en/d3/2e974d35c511d1829f0000e829fbfe/frameset.htmhttp://help.sap.com/saphelp_47x200/helpdata/en/d3/2e974d35c511d1829f0000e829fbfe/frameset.htm
  • 8/12/2019 Basic ABAP Overview

    28/45

    India SAP CoE, Slide 28

    Data Upload

    BDCLSMW

  • 8/12/2019 Basic ABAP Overview

    29/45

    India SAP CoE, Slide 29

    Purpose

    BDC stand for BATCH DATA COMMUNICATION

    Through this concept we transfer the data into SAP R/3 System

    Legacy System R/3 System

    BATCH INPUTData

  • 8/12/2019 Basic ABAP Overview

    30/45

    India SAP CoE, Slide 30

    Presentation

    server

    Application

    server

    Internal

    table

    WS_UPLOAD

    Read Dataset

    ABAP/4

    PROGRAM

    Reading data from application

    server or presentation server

  • 8/12/2019 Basic ABAP Overview

    31/45

    India SAP CoE, Slide 31

    Presentation

    server

    Application

    server

    Internal

    table

    WS_UPLOAD

    Read Dataset

    ABAP/4

    PROGRAM

    Reading data from application

    server or presentation server

  • 8/12/2019 Basic ABAP Overview

    32/45

    India SAP CoE, Slide 32

    Batch Input Methods

    METHOD #1

    METHOD #2

    METHOD #3

    CALL TRANSACTION USING

    STATEMENT

    BATCH INPUT SESSION

    DIRECT INPUT

  • 8/12/2019 Basic ABAP Overview

    33/45

    India SAP CoE, Slide 33

    Process flow of Batch Input Session

    Opens the Session

    Process BDC table for each record

    Close the Session

    Function Modules

  • 8/12/2019 Basic ABAP Overview

    34/45

    India SAP CoE, Slide 34

    When you create a batch input session, it remains in the batch inputqueue until it is explicitly started. Session processing can be started in

    two ways:

    An on-line user can start the session using the batch input menu

    options. (To access the batch input options, choose System

    Services Batch Inpu t.) SM35

    You c an subm it the backgro und job RSBDCSUB to s tar t a session

    in backg round processing. If several sessions have the same

    name, RSBDCSUB s tarts them al l .

    Processing Batch Input sessions

  • 8/12/2019 Basic ABAP Overview

    35/45

    India SAP CoE, Slide 35

    Direct Input

    To enhance the batch input procedure, the system offers the direct input technique,especially for transferring large amounts of data. In contrast to batch input, thistechnique does not create sessions, but stores the data directly. It does not processscreens. To enter the data into the corresponding database tables directly, thesystem calls a number of function modules that execute any necessary checks. Incase of errors, the direct input technique provides a restart mechanism. However, tobe able to activate the restart mechanism, direct input programs must be executedin the background only. To maintain and start these programs, use programRBMVSHOW or Transaction BMV0. It is better to use BDC method unless datavolume is very high, as validations are very critical to data upload in SAP. Examplesfor direct input programs are:

  • 8/12/2019 Basic ABAP Overview

    36/45

    India SAP CoE, Slide 36

    Before you work with the Batch Input methods, you should know the purpose of

    the tool

    Transaction Recorder.

    Use:

    You can use the transaction recorder to record a series of transactions and theirscreens.

    Features:

    You can use the recording to create

    Data transfer programs that use batch input or CALL TRANSACTIONBatch input sessions

    Test data

    Function modules.

    Note: It doesntrecord F1, F4 and Scrollbar movements

    Transaction Recorder (SHDB)

  • 8/12/2019 Basic ABAP Overview

    37/45

    India SAP CoE, Slide 37

    Scheduling a Background Job

    Job

    Scheduling

    General data

    Job name

    Job class

    Status

    Target host

    A

    Scheduled

    Start date Steps

    Transaction

    SM36

  • 8/12/2019 Basic ABAP Overview

    38/45

    India SAP CoE, Slide 38

    LSMWHow LSMW works ?

    Convert data

    Batch Input

    processing

    Legacy data

    on PC

    Read data

    Converte

    d data

    Read

    data Legacy dataon

    application

    server

    IDoc inbound

    processing

    Direct Input

    processing

    Structure

    relations

    Field

    mapping

    Conversion

    rules

  • 8/12/2019 Basic ABAP Overview

    39/45

    India SAP CoE, Slide 39

    IDoc Record Types

    Status Record IDoc-ID

    Status information

    Data Record IDoc-IDSequence/Hierarchy

    Segment Format definition forheader data

    item data

    Control Record IDoc-ID

    Sender-IDReceiver-ID

    IDoc type and logical message

    External structure

  • 8/12/2019 Basic ABAP Overview

    40/45

    India SAP CoE, Slide 40

    What is EDI & ALE ?

    ALE

    Application Link Enabling

    Used mostly for SAP to SAPcommunication. Used in

    Distributed servers system. E.g.Say a Company has a centralserver at its head office and localservers at its branches. ALE isused to keep all the serverssynchronized.

    Does not need EDI subsystem forcommunication.

    ALE is an SAP terminology. ALE isintegrated with SAP product.

    EDI

    Electronic Data Interchange

    Used Mostly for communicationbetween any 2 systems ondifferent networks. E.g.

    Communication by a companywith its Suppliers and Customers.

    Needs a EDI subsystem forcommunication

    EDI is a technology in itself. It has itsown set of standards. SAPsupports EDI through IDOCs.

  • 8/12/2019 Basic ABAP Overview

    41/45

    India SAP CoE, Slide 41

    Example of Document Exchange interface:

    Customer Vendor

    RFQ

    Quotation

    Purchase Order

    Purchase Order Change

    Order Acknowledgement

    PurchasingSales

    Receiving ShippingShipping Notice

    AccountsAccounts

    Invoice

    Payment

    DetailsCustomer

    Bank

    Vendor

    Bank

  • 8/12/2019 Basic ABAP Overview

    42/45

    India SAP CoE, Slide 42

    Intermediate Documents (IDOCs)

    What is an IDoc ?

    An IDoc is simply a data container

    that is used to exchange information

    between any two processes that canunderstand the syntax and

    semantics of the data.

  • 8/12/2019 Basic ABAP Overview

    43/45

    India SAP CoE, Slide 43

    IDoc Record Types

    Status Record IDoc-IDStatus information

    Data Record IDoc-IDSequence/Hierarchy

    Segment Format definition forheader data

    item data

    Control Record IDoc-IDSender-ID

    Receiver-ID

    IDoc type and logical message

    External structure

  • 8/12/2019 Basic ABAP Overview

    44/45

    India SAP CoE, Slide 44

    AgendaHands On

    Create A Database table.

    Create a report to upload data to the table.

    Attach a transaction to the report. Create a recording for the above

    transaction.

    Generate program for the recording.

    Write BDC program.

    Write LSMW.

  • 8/12/2019 Basic ABAP Overview

    45/45

    Thank You!