Author: Rudramani Pandey

  • Collective Search Help in SAP ABAP

    Preface – This post is part of the ABAP Beginner series.

    Introduction

    As discussed in the earlier article i.e. Search Help in SAP ABAP, a search Help in SAP ABAP are reusable objects that are used to assign input helps (F4 helps) to screen fields. If the data for the search help is bought from combination of many elementary search help, then it will be termed as Collective Search Help.

    Definition

    As the name suggest a collective search help is a collection of multiple elementary search helps. It can even be a combination of elementary search help and another collective search help.

    Below is the example of how it works (data exchange works):

    Collective Search Help in SAP ABAP
    It has an import and export parameter, the data is exchanged between the input screen template and the parameters of the assigned elementary search helps using this interface.

    Steps to Create a Collective Search

    1. Go to SE11
    2. Search help name -> Create -> Choose a type (here, collective)
    3. Maintenance screen of collective search help will open -> Give a short description to find your collective search help
    4. In the definition tab -> Enter a search help parameter (can be elementary help or collective help) -> if it is an import parameter then check it and if it is an export parameter then check it.
    5. Describe the data element to denote the types of elementary search help.
    6. Now go to included Search help tab -> select an elementary search help
    7. Parameter assignment-> Now system automatically maps elementary search help reference parameter to collective search help parameter -> now click on copy -> Activate.
    8. The search help is ready to use.

    Search Help Exit

    1. When you want to use search help beyond normal hits, then we need something called Search Help Exit.
      For example: For current run time data, I want to know the availability of flight seats with the prices enlisted in it. This might not be possible with the normal flow as the data would be fetched in tables containing either no of seats or costs separately.
      In this case we will use Search Help Exit.
    2. It is a well-designed function module with interface same as F4IF_SHLP_EXIT_EXAMPLE. It is called several times by the help processor.
  • Elementary Search Help in SAP ABAP

    Preface – This post is part of the ABAP Beginner series.

    Introduction

    As discussed in the last article i.e. Search Help in SAP ABAP, a search Help in SAP ABAP are reusable objects that are used to assign input helps (F4 helps) to screen fields. If the data for the search help is bought from a single table, structure or view and is displayed based on a condition, then it will be termed as Elementary Search Help.

    Definition

    As the name suggest an elementary search help reads records from a single element and that can be a table, structure or a view and based on a condition it returns records which are displayed by a dialog box.

    Steps to Create an Elementary Search Help:

    1. Go to SE11-> Choose Search Help-> Give a Name-> Click Create-> Choose types of search help-> Elementary-> (u will be directed to the maintenance screen of search help).
    Elementary Search Help in SAP ABAP
    Elementary Search Help in SAP ABAP
    1. Under the definition, tab give a description (It will help to get your Search Help identified).
    2.  Selection Method
      1. One can choose a SE11 Table,
      2. A View (Database, Projection or Help View)
      3. If you enter a table that has a text table (language specific tables) it will automatically mention its name.
    3. Dialog behavior
      1. Display values immediately -> hit list displayed immediately, best suited for small entries.
      2. Dialog with value restriction -> if the list of possible entries is large, user can limit the data to be processed to prevent system load.
      3. Dialog depends on set of values -> If the hit list contains less than 100 entries, if the hit list contains more than 100 entries the system displays the dialog box for restricted values.
        Dialog behavior
        Dialog behavior
    4. Selection parameters
      Choose and select the fields through drop- down list from the selection method (tables, views) that is to be displayed in the selection screen.

      1. IMP (Importing Parameters)
        The input value/field is passed to the search help.
      2. EXP (Exporting Parameters)
        Export values back to the input help when the user selects an option or a row.
      3. LPOS (List position)
        Position on the output list (hit list) the user selects from.
      4. SPOS (Screen position)
        Position of parameters for value selection in the dialog box.
      5. Default
        To display default values (date, system-fields (values of structure SYST)).
    5. Save -> Activate -> Test.

    Use of an Elementary Search Help

    1. Defines the standard flow of an input help.
    2. Following components can be defined in search help.
      1. Selection Method
        Through this you can choose the data in the hit list where it can come from.
      2. Dialog behavior
        Choose the information displayed in the hit list and in the dialog box.
      3. Selection parameters
        Fields you can choose for hit lists and values to be displayed in the hit list that can be returned in screen fields.

     

  • Purchase Requisition in SAP MM

    Preface – This post is part of the SAP MM series.

    Introduction

    Procurement starts with requirement gathering and ends with procuring goods/services from vendors. This involves an internal document that contains a list of requirements, be it goods or services, which need to be procured from the vendors, known as Purchase requisition. It is a request made to the purchasing department to procure a certain list of materials. It contains information about the materials such as the date of delivery, and quantity.

    A purchase requisition is defined for the following procurement types:

    • Standard: Requisition created for getting finished material from the vendor.
    • Subcontracting: Requisition created for providing raw material to the vendor and getting finished material.
    • Consignment: Requisition created for procuring material that is kept in the company’s premises and paying to the vendor for that.
    • Stock transfer: Requisition created for transferring stocks from one plant to another.
    • External service: Requisition created for procuring services like maintenance from third-party vendor.

    Creation of Purchase requisition

    A purchase requisition can be created manually (with or without master data) or automatically. Let’s explore them one by one.

    Manual creation of Purchase requisition

    A purchase requisition can be created manually means when the purchasing document is created by the requesting department manually.

    A purchase requisition can be created manually in multiple ways:

    Purchase requisition with master data:

    Step 1: Enter T-code ME51N in common field. A “Create purchase Requisition” screen will appear.

    Purchase requisition with master data 1

    Step 2: It will ask to enter the following information:

    • The material number of item or service (e.g. B-R123)
    • Quantity to be procured (e.g. 20)
    • Delivery date of the material (e.g. today’s date + 3)
    • Plant location (e.g. 1203)

    Purchase requisition with master data 2

    Step 3: On hitting enter, the data of the material is fetched from the material master data and the requisition process will fill up the default information in some of the blank fields.

    After clicking on “Save”, a new purchase requisition will be created.

    Purchase requisition without master data:

    Step 1: In order to do that, enter T-code ME51N in common field. A “Create purchase Requisition” screen will appear.

    Purchase requisition without master data 1

    Step 2: As there is no material master record for the material the following information will have to be entered:

    • Account assignment category (e.g. U)
    • Short text for description (e.g. Laptop Dell with an i5 processor)
    • Quantity to be Supplied (e.g., 4)
    • Unit of measure (e.g. PC)
    • Delivery date of the material (e.g. today’s date + 4)
    • Material group (e.g. Testing)
    • Plant location (e.g. SAP SE)
    • Purchasing group (e.g. 011)

    In this scenario, the account assignment category is required to direct the cost to a specific account. Use ‘U’ to direct the purchase requisition to an unknown account. Other options available are:

    • A for Asset and sub number
    • F for production order number
    • K for cost center and general ledger account number
    • C for sales order and general ledger account number
    • P for project number and general ledger account number

     

     

    Purchase requisition without master data 2
    Step 3: Press Enter, an error message will appear in the form of a red mark on the item line (in the column Status). Provide Valuation Price and hit enter again. The error message will disappear now.

    After clicking on “Save”, a new purchase requisition will be created.

    Automatic creation of Purchase requisition:

    A purchase requisition can be created automatically means when the purchasing document is created by other SAP processes that include:

    • Production Order: A production order defines what materials need to be produced, the quantity of goods to be required, where it needs to be produced and at what time.

    On creation of Purchase order in PP, BoM (Bill of Materials) is determined and a purchase requisition is created for materials required through MM.

    • Plan Maintenance Order: A maintenance order consists of a list of operations that specifies what needs to be done and the material needed for each step. There may be a need for non-stock material. So, a purchase requisition is created automatically.
    • Project System: In the Project system of Sap, a network is an object that creates a purchase requisition for non-stock materials.
    • Material Planning: The consumption-based planning module can create a purchase requisition for materials based on calculation.
  • Inventory Management in SAP

    Preface – This post is part of the SAP MM series.

    Introduction

    Under Inventory Management in SAP MM, Procurement starts with requirement gathering and ends with procuring goods/services from vendors.

    Once the goods/services are procured from the vendor, it is required to place them at the company’s premises. Inventory management deals with the management of the stock and goods movement, either on value or quantity basis. It includes planning and keeping records of all the goods movement.

    There are several transactions and functions in inventory management. The most important of them are:

    1. Movement Types
    2. Goods Receipt
    3. Reservation
    4. Goods Issue

    Let’s explore them one by one.

    Movement Types

    When goods movement is entered into the system, a movement type is defined to differentiate between the various goods movement. It is a 3-digit identification number for goods movement.

    When a goods movement is entered into the system, following chain of events starts in the system:

    • A material document is generated, that updates all the stock quantity and value in the inventory.
    • Accounting documents are generated if the movement is relevant to Financial accounting.
    • The stock quantities are updated.
    • The stock values in the master record are updated.

    All the updates are based on the information contained in the material document and the financial account document.

    The important movement types are:

    • 101: Goods receipt(GR) for purchase order(PO) into warehouse/stores
    • 102: Goods receipt(GR) for purchase order(PO) into warehouse – reversal
    • 201: Consumption for cost center from warehouse

    To know more movement types, enter T-code MIGO in common field. A new screen will appear.

    Select “Goods receipt” from the drop-down. On pressing F4 on the goods receipt input box, a list of movement types will appear. Depending upon the requirement, select the appropriate movement types for different goods movement.

    Movement Types: Inventory Management in SAP
    Movement Types: Inventory Management in SAP

    Goods Receipt

    After receiving the material from the vendor, the purchasing department prepares a goods receipt that can be used later for any discrepancy. A goods receipt is a goods movement that is used to post goods received from the external vendors or from in-plant production which results in an increase in stock in the warehouse.

    Goods receipt has 2 scenarios:

    • Creation Goods receipt
    • Cancellation of Goods receipt

    To create a Goods receipt

    Step 1: Enter T-code MIGO in common field. A new screen will appear.

    A Goods receipt can be posted against various documents. Select the required document from the drop-down list. Select the movement type as per the requirement.

    MIGO Goods Receipt: Inventory Management in SAP
    MIGO Goods Receipt: Inventory Management in SAP

    Step 2: Enter reference document. Based on the reference document, it will fetch all the details such as material, quantity, storage location, plant, etc.

    Enter Details Goods Receipt: Inventory Management in SAP
    Enter Details Goods Receipt: Inventory Management in SAP

    Step 3: Select the check tab and click on Save.

    After click on “Save”, goods receipt is posted against the selected document and a material document number is generated.

    To cancel a Goods receipt

    Step 1: Enter T-code MIGO in common field. A new screen will appear.

    Select “Cancellation” against the material document from the drop-down list. Enter the material document number.

    MIGO Cancel a Goods receipt: Inventory Management in SAP
    MIGO Cancel a Goods receipt: Inventory Management in SAP

    Step 2: The system will fetch all the details from the material document number.

    Cancel a Goods Receipt: Inventory Management in SAP
    Cancel a Goods Receipt: Inventory Management in SAP

    Step 3: Select the check tab and click on “Save”.

    After clicking on “Save”, the goods receipt is cancelled, and a material document number is generated.

    Reservation

    Reservations are made to block the materials in advance so that that they can be available at some particular time. It ensures the availability of the stock at a particular point of time.

    T-code to view the reserved quantity is MMBE.

    To make a reservation

    Step 1: Enter T-code MB21 in common field. A “Create Reservation” screen will appear.

    Enter the date, the movement type and the plant for which the reservation has to be made.  Click on the “New Items” button.

    MB21 Make A Reservation: Inventory Management in SAP
    MB21 Make A Reservation: Inventory Management in SAP

    Step 2: Enter the order number against the reservation has to be made. Provide details of the materials and the quantity that has to be reserved.

    Create Reservation: Inventory Management in SAP
    Create Reservation: Inventory Management in SAP

    After clicking on “Save”, a reservation has been made for the order.

    Goods Issue

    To post Goods Issue

     Step 1: Enter T-code MIGO in common field. A new screen will appear.

    Select Goods Issue from the drop-down list. A Goods Issue can be posted against various documents. Select the required document from the drop-down list. Select the movement type as per the requirement.

    MIGO Goods Issue: Inventory Management in SAP
    MIGO Goods Issue: Inventory Management in SAP

    Step 2: Enter reference document. Based on the reference document, it will fetch all the details such as     material, quantity, storage location, plant, etc.

    Enter Reference Document Goods Issue: Inventory Management in SAP
    Enter Reference Document Goods Issue: Inventory Management in SAP

    Step 3: Select the check tab and click on Save.

    After click on “Save”, Goods Issue is posted against the selected document and a material document number is generated.

  • Master Data in SAP

    Preface – This post is part of the SAP MM series.

    Introduction

    Before we discuss about Master Data in SAP MM, let us discuss about type of Data in SAP.

    SAP R/3 works on real-time data i.e. it makes sure that there is no time lag between data availability and data storage.

    Data stored in SAP R/3 is categorized as:

    • Master data: Data that is created centrally and is the core used as base data for any transaction is called Master Data in SAP. For example, Material and Vendor are types of master data.
    • Transactional data: Data that is related to business transactional processes.

    Types of Master Data

    1. Material Master data
    2. Vendor Master data

    Material Master Data

    Materials in SAP are a logistic representation of certain goods/services that is an object of production, sales, inventory management, etc. Material master data is the central source of information of the material that an enterprise can procure, produce or sell.

    Characteristics of material master data are:

    • Material types: Materials having some basic common attributes are grouped together and are assigned a material type. Most common material types are:

     

    M Type Material type description
    FERT Finished Product
    HALB Semi-finished Product
    ROH Raw material

     

    • Material group: A material group is a wider term for a material type. Materials with some common attributes are grouped together and are assigned a material group. Let’s take an example of a finished product (material type), TV. Then the material group can be used to categorize them as Plasma TV, color TV etc.
    • Number Range: When a material master record is created, a unique number is assigned to the material, known as material number.
      The following are the two ways to assign material number.
    • External number assignment: When material number is assigned manually while creating a material.
    • Internal number assignment: The system automatically assigns the material number while creating a material.

    Internal number assignment is known as Number range.

    Steps to create Material Master Data

    Step 1: Enter T-code MM01 in common field. A “Create Material” screen will appear.

    Enter all the information such as Material number, Material type, Industry sector, etc.

    MM01: Master Data in SAP
    MM01: Master Data in SAP

    Step 2: Select the views to maintain the material.

    Maintain the Material: MM01: Master Data in SAP
    Maintain the Material: MM01: Master Data in SAP

    Step 3: Enter plant name and storage location for the material.

    Enter Plant Name: Master Data in SAP
    Enter Plant Name: Master Data in SAP

    Step 4: Provide the necessary details such as moving price, standard price, unit of measure, etc.

    Click on “Save” and new material is created.

    New Material Creation: Master Data in SAP
    New Material Creation: Master Data in SAP

    To change or display material master data, use T-code MM02 and MM03 respectively.

    Vendor Master Data

    A vendor is the one who provides goods/ services to a company. Vendor master data is the central source of information of the vendors from an enterprise can procure. It contains information such as name, address, the currency for the transaction, payment terms, Tax details, etc.

    Data in a vendor master record is categorized into:

    • General Data − It is maintained at the client level and is valid at all organizational levels.
    • Accounting Data − It is maintained at the company level and is valid for all plants belonging to that company.
    • Purchasing Data − It is maintained at the purchasing organization level.

    Characteristics of vendor master data are:

    • Account group: Vendors having some common attributes are grouped together and are assigned an account group.
    • Number range: When a vendor master record is created, a unique number is assigned to the vendor, known as vendor number. A vendor number is assigned to a vendor as in the case of the material number i.e. external number assignment and internal number assignment.

    Steps to create Vendor Master Data

    Step 1: Enter T-code XK01 in common field. A “Create Vendor” screen will appear.

    Enter all the information such as Vendor number, Company Code, Purchase Organization, Account Group, etc.

    XK01: Master Data in SAP
    XK01: Master Data in SAP

    Step 2: Provide address details of the vendor.

    Create Vendor: Master Data in SAP
    Create Vendor: Master Data in SAP

    Step 3: provide bank details, accounting information, terms of payment between the company and the vendor. Click on “Save” and a new vendor is created.

    New Vendor Creation: Master Data in SAP
    New Vendor Creation: Master Data in SAP

    To change or display vendor master data, use T-code XK02 and XK03 respectively.

  • Transport Request in SAP

    Preface – This post is part of the ABAP Beginner series.

    Introduction

    Before we start with Transport Request in SAP, let us discuss basic concepts of coding environements/landscapes in SAP. In SAP ERP, we have three landscapes: Development, Quality and Production.

    • Development landscape is where a developer develops his/her codes/programs.
    • Quality landscape is where a developer/tester tests his/her codes/programs.
    • The production is where users actually use the programs made by developer.

    These landscapes give us flexibility to develop, test and run our under-development code before actually giving to the end user. In this way we can find and fix bugs that can actually cause crashes and dumps.

    Now, to make a connection between these landscapes and to transfer our code, SAP provides us something known as Transport Request.

    What is a Transport Request in SAP?

    A transport request is a package where a user can register changes done. It is used in order to transfer data from one installation to the other.

    Whenever we do a small or major change that can be an update an SAP user has to create TR.

    TR holds change tasks that can be understood by a folder that holds files.

    Syntax

    <SID>K<NUMBER>

    SID: System ID

    K: After releasing  TR creates a data file and co-file where data file holds database details and co file contains controlling data.

    NUMBER : Starting with 900001(randomly generated).

    Category of Transport Request

    A TR can hold n number of sub request tasks categorized as:

    Modifiable

    • A task is not released yet.
    • One can add more tasks and complete them before TR is finally released.

    Released

    • Tasks are completed and then it is released by the owner.
    • One cannot do changes and send it to the target system.

    Types of Transport Request

    TR is preferably created in two types, but we will discuss others too.

    Workbench

    • TR created as workbench request is cross-client i.e. changes done for one client reflects in the other client.
    • It is synonymously said that this type of request is created by technical

    Customizing

    • TR created as Customizing request is client specific i.e. changes done for one client won’t reflect the other client.
    • A client copy has to be created using T-CODE SCC1.
    • Client number can be seen next to this type of request
    • It is said that this type of request is created by a functional person

    Process of TR

    ·         Create A Request

    ·         Adding Objects in your Request

    ·         Releasing a Request

  • Debugging in SAP ABAP

    Preface – This post is part of the ABAP Beginner series.

    Introduction

    Whenever a SAP coder writes a program. At the time of execution, if it gives a dump or runtime error then SAP debugger is a tool to check your lines of codes and examine error during runtime. Debugging in SAP ABAP helps a programmer to check his program flow at runtime.

    We use ABAP debugger by default after the release of SAP 7.0.

    Definition

    In short, we can define as:

    • A tool to analyze ABAP programs.
    • A tool to examine errors in codes during runtime.
    • A tool to display data objects.
    • A tool to understand the flow logic of codes in a program while executing.

    Stepping through a program with the debugger helps you to detect and correct errors in the source code of an ABAP program.

    What is a Breakpoint?

    A signal which tells the runtime processor to interrupt processing and start debugging.

    It gets activated when the program reaches that point.

    How can we debug

    By setting a breakpoint

    Start the debugger by setting and managing the breakpoints and executing the code.

    By running the program debugging mode

    We can enter the debugging mode by using \h from any screen.

    This can be done when we want to check the program from the beginning and are not familiar with the program.

    Types of Breakpoints

    There are two types of breakpoints:

    A. Static Breakpoint

    1. This breakpoint is not specific to a user.
    2. To use a static breakpoint use ABAP Keyword BREAK-POINT.
    3. Place it in the line where you want to use the breakpoint.

    EXAMPLE:

    PROGRAMM Z_USERDATA.

    …..if sy-subrc<>0 .

    BREAK-POINT.

    endif.

    ….

    1. If you want to set a static break-point specific to a user.

    BREAK-POINT username.

    NOTE:

    Kindly delete the static breakpoints manually in development system itself, else it might affect the program in the production system.

    B. DYNAMIC BREAKPOINT

    1. These are breakpoints that are triggered when the program that you are running reaches a particular ABAP statement or exception class.
    2. When debugging session is finished it gets deleted automatically.
    3. U can set a dynamic breakpoint, either in an ABAP editor or directly in the debugger.

    c.1. For setting dynamic breakpoints in ABAP editor.

    c.1.1  Position the cursor on the line of source code where you want to set the break-point.

    c.1.2.  Go to utilities->breakpoint->Set/Stop. The system confirms that breakpoint is set.

    c.2. For setting a dynamic break point in debugging mode:

    c.2.1- Position the cursor on the line where you want to set the breakpoint.

    c.2.2- Select the line by double -clicking it or by choosing Breakpoint-> set/delete.

    NOTE:  A user can set 30 dynamic breakpoints without changing the program code.

    1. Session breakpoint
      Specific to a particular ABAP user session. If the user session is ended (log off sap system) all session breakpoints get deleted.
    2. External breakpoint
      They are applied to the current user session as well as future user sessions.

    e.1. Works in sessions initiated with RFC or HTTP requests or any other external interface.

    e.2. An external breakpoint can apply to:

    e.2.1.A user in the current SAP system

    e.2.2. A user in the current application server of the current SAP system

    e.2.3. User sessions started by a request that has a specific terminal ID.

    NOTE:  Session, External breakpoints can be created at runtime and can be activated/deactivated.

    Special KEYS in Debugging

    Debugging in SAP ABAP - Image Illustration
    Debugging in SAP ABAP – Image Illustration

    F5- Executes a program line by line.

    F6- Executes a function module or a subroutine without entering into it.

    F7- Executes a module or a program in a single step.

    F8 – Executes a program directly. If there is more than one break-point, then can move to one break-point to the other.

  • Exception Class in SAP ABAP

    Preface – This post is part of the Object Oriented ABAP series.

    Introduction

    To understand an exception class, we need to understand what is an exception and when it is raised.

    When we execute any program, some discrepancies can occur due to which a normal flow of execution gets interrupted and the behavior will not be the same as it was expected. That discrepancy is like an event which is occurring due to some reason, which is known as an ‘Exception’.

    It is required to handle such discrepancies in order to prevent the execution flow of any program. In order to achieve that, SAP ABAP has a special class known as an ‘Exception Class’.

    Exception Classes can be defined in a global class as well as in a local class. There are three exception classes exists, which are the subclasses of one root class ‘CX_ROOT’. Those three exception classes are:

    1. CX_STATIC_CHECK – which is being checked by both compiler and runtime system.
    2. CX_DYNAMIC_CHECK – Checked only at runtime system. All System exceptions will come under this exception.
    3. CX_NO_CHECK – This type will be chosen if exceptions are frequent.

    Definition

    An Exception class is used to handle the discrepancies(exception) occurs during the execution a of program.

    Whenever an exception occurs, an object is created (known as an exception object). The attributes of this object would contain information about the error. This exception can be caught by using TRY….CATCH…..ENDTRY block.

    TRY….ENDTRY block contains a protected area, where an exception can be caught using the CATCH statement. One TRY….ENDTRY block can catch more than one exception, but it should get caught in a sequence in which it occurs.

    There are two types of exception handling cases:

    1. One where the exception was raised, deleted before or after handling it.
    2. The other, where an exception which was raised is retained and the program is resumed after the statement that raised an exception.

    Program

    Let’s take an example of a simple arithmetic operation of two numbers. An exception should be raised if one of the two operands is missing.

    NOTE: A local class is used in below sample program.

    REPORT ztest_exception.

    CLASS lcx_missing_operand DEFINITION

    INHERITING FROM CX_STATIC_CHECK.

    ENDCLASS.                                                 “lcx_missing_operand  DEFINITION

     

    CLASS lcl_test_exception DEFINITION.

    PUBLIC SECTION.

    METHODS: add_numbers IMPORTING iv_num1 TYPE i OPTIONAL

    iv_num2 TYPE i OPTIONAL

    RETURNING VALUE(rv_calc) TYPE i

    RAISING   lcx_missing_operand

    PRIVATE SECTION.

    METHODS: do_check RAISING  lcx_missing_operand.

    DATA: lv_num1 TYPE i,

    lv_num2 TYPE i,

    lv_result TYPE i.

    ENDCLASS.                                                      “lcl_test_exception DEFINITION

     

    CLASS lcl_test_exception IMPLEMENTATION.

    METHOD add_numbers.

    v_num1 = iv_num1.

    v_num2 = iv_num2.

    me->do_check( ).

    rv_calc = v_result.

    ENDMETHOD.

     

    METHOD do_check.

    IF v_num1 IS INITIAL.

    RAISE EXCEPTION TYPE lcx_missing_operand.

    ENDIF.

    ENDMETHOD.

     

    ENDCLASS.                                                      “lcl_test_exception IMPLEMENTATION

     

    START-OF-SELECTION.

    DATA: lo_obj TYPE REF TO lcl_test_exception.

    DATA: lo_exc_root TYPE REF TO CX_ROOT.

    DATA: lv_msg TYPE STRING.

    CREATE OBJECT lo_obj.

    TRY .

    lo_obj->add_numbers( iv_num1 = 10 ).

    CATCH lcx_missing_operand.

    WRITE: /  ‘Operand is missing’.

    CATCH CX_ROOT INTO lo_exc_root.

    lv_msg = lo_exc_root->get_text( ).

    WRITE: / lv_msg.

    ENDTRY.

    Advantages

    1. With exception classes, you can track the sequence of called methods. Since in exception class, we have try-end-try block, so we can put the called methods in it, to know if one of them get failed.
    2. An exception class has an advantage that non-OO programmers won’t understand your code, increasing your job security a little.
  • Local Classes in SAP ABAP

    Preface – This post is part of the Object Oriented ABAP series.

    Introduction

    One of the flavors of ABAP classes (Global Classes) we have already discussed in the last article. Another flavor of ABAP class are Local Classes. The only difference between a local class & global class is visibility & accessibility. A local class can be accessed within that program only in which it is being defined & implemented, whereas a global class can be accessed in any other program.

    NOTE: In some of the previous articles, where different types of classes have been described, there the sample programs were the examples of local class only.

    Definition

    A class which is defined and implemented in a program is known as Local Class. Local classes in SAP ABAP can be created through Transaction code SE-38(tool to create a report).

    Program

    Let’s take an example of this class ‘ZCL_MARA’. This class is having one method ‘GET_MATERIAL_TYPE’  to get the material type of a given material.

    NOTE: ‘MARA’ is a table in SAP ABAP for general material data. So, in this sample program, material (iv_matnr – importing parameter of a method) is given by the user, and this method will fetch the material type ( like finished, semi-finished, raw, etc. )

    TYPES: BEGIN OF ty_mara,                                       “USER-DEFINED TYPES

    Matnr TYPE mara-matnr,

    Mtart TYPE mara-mtart,

    END OF ty_mara.

    CLASS zcl_mara DEFINITION.

    PUBLIC SECTION.

    METHODS: get_material_type

    IMPORTING iv_matnr TYPE mara-matnr

    EXPORTING ls_mara type ty_mara.

    ENDCLASS.                                                                    “CLASS DEFINITION

     

    CLASS zcl_mara IMPLEMENTATION.

    METHOD get_material_type.

    SELECT SINGLE matnr, mtart FROM mara INTO ls_mara

    WHERE matnr = iv_matnr

    ENDMETHOD.

    ENDCLASS.                                                                   “CLASS IMPLEMENTATION

     

    Advantages

    1. To restrict the usage of any functionality, we can use it in a local class of any program.
    2. A Local class is very useful while creating an ABAP Unit Test Class, as a local test class has been generated within a global class.
    3. These classes are useful for the enhancements of class methods.
  • What is SAP MM

    Preface – This post is part of the SAP MM series.

    Introduction :

    SAP MM is one of the modules of the SAP ERP system which deals with the logistics (Material management and inventory management) of the materials. It includes modules such as Sales and Distribution, Production Planning, Plant Maintenance, Project Systems and Warehouse Management. This module contains master data, system configuration and transactions to complete the procure to pay process.

    This process ensures that there is never a shortage of materials in the supply chain process of an organization It deals with the management of materials (products and/or services) and resources of an organization to make the business run smoothly on time and in a cost-effective manner.

    Material Management process :

    What is SAP MM
    What is SAP MM – Image Illustration

    Requirement Determination:

    Planning of what materials are required, when they are required, budget of the enterprise for the material.

    Source Determination :

    Determining potential suppliers of the requested material.

    Vendor Selection :

    On identification of potential vendor, request for quotation(RFQ) is sent by the requester. The contract is awarded to the vendor based on selection criteria.

    Order Processing :

    A formal purchase order is created and sent to the vendor.

    Order Monitoring: 

    Order monitoring is tracking of dates and the goods from the time of ordering to the time the goods are delivered. It is done to ensure that there are no discrepancies and if any, they can be handled beforehand.

     

    Goods Receipt :

    On receiving the material from the supplier, the purchase department prepares the good receipt which can be used later for reconciling if there is any discrepancy .

     

    Invoice Verification :

    The good receipt is compared to purchase order to avoid any mismatch. Materials are checked whether they meet the ordered specification, and then priced according to the terms of the purchase order. For any damaged goods, the buyer contacts the supplier either for replacement or for a refund.

    Payment Processing :

    Once the verification is done, the payment invoice is created and vendor is paid.

    SAP MM integration with other modules

    Integration of MM and FI :

    • On posting of goods receipt, a debit is posted to inventory account and a credit is posted to GR/IR clearing account.
    • On posting of invoice receipt, a debit is posted to GR/IR clearing account and a credit is posted to vendor account.
    • On payment of vendor, a debit is posted to vendor account and a credit is posted to bank clearing account.

    Integration of MM and SD:

    • When sales order is created in SD, the details of the materials are copied from Material Master of MM.
    • Data like availability and MRP is also copied from MM.
    • On creation of inbound or outbound delivery with reference to a sales order, determination of shipping point with the help of plant, loading group etc. which refers to Material Master.

    Integration of MM and PP :

    • On creation of Production order in PP, BOM (Bill of materials) is determined and PR is raised for materials through MM.
    • Stock determination helps to implement various strategies to withdraw materials for goods issue and stock transfer based on material requirement.

    Advantages of MM :

    • Integration with other modules helps to reduce data entry and human error.
    • Ensures there is never a shortage of material.
    • Avoids stocking of unnecessary or obsolete materials.
    • Least inventory loss.
    • Controlled manufacturing cycle time.
    • Reduces expenditure on unnecessary material storage.
    • Different release strategies for different purchasing document based on various criteria like vendors, payment terms etc.
    • Automatically creates Purchase order for specific vendors based on stock.

    Challenges in implementation :

    • Information such as material requirement, planning activities and order input should be managed and reflected carefully.
    • Material planning and demand forecast should be in line with the manufacturing requirement.
    • Standard product quality should be maintained.
    • Vendor must be selected carefully to meet quality management principles to safeguard quality of end-product.

    SAP MM sub-modules:

    • Master Data
    • Purchasing
    • Inventory management
    • Pricing Procedure