Category: SAP

  • SAP FI – Chart of Accounts

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

    Introduction

    The SAP FI chart of accounts represents the list of the company’s GL accounts used to meet the daily needs and legal requirements of a company in the country in which it operates. Master charts of accounts are assigned to each company code.

    Types of Chart of Accounts (COA):

    Chart of accounts are classified into three categories:

    • Operating Chart of Accounts: It contains all General Ledger accounts that a business needs to operate on a daily basis.
    • Country Chart of Accounts: This document lists all General Ledger accounts that have to comply with the legal requirements of the operating country.
    • Chart of Accounts Group: The COA group contains a list of all the G/L accounts that are used throughout the organization.

    How to create a new Chart of Accounts?

    First Approach: T-code: OB13

    1. Go to T-code OB13 or Finance Accounting -> G/L Accounts.

    List of all Chart of Accounts

    2. Click on New Entries and create a new Chart of Accounts.

    Second Approach: T-code: SPRO

    Path to create a new Chart of Accounts: SPRO → SAP Reference IMG → Financial Accounting → General Ledger Accounting → G/L accounts → master data → Preparations → Edit Chart of Account Lists → Execute → New Entries to create a new chart of accounts.

     

    NOTE: Controlling integration is used for manual creation of cost elements or automatic creation of cost elements. Group Charts of Accounts are used to consolidate reports.

    How to define a Chart of Accounts Group?

    In order to manage and control a large number of G/L accounts effectively, you should use COA groups.

    First Approach: T-code: OBD4

    Second Approach: T-code: SPRO

    Path: SPRO → SAP Reference IMG → Financial Accounting → General Ledger Accounting → G/L Accounts → Preparations → Define Account Group → Execute → New window will open → New Entries.

    1. Go to Define Account Group

    2. Click on New Entries

    3. Provide details

    4. Click on Save Configuration

     

  • Difference Between SAP FICO and S4 HANA Finance

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

    What is SAP FICO?

    SAP FICO stands for SAP Financial Accounting and Controlling. It covers the entire business process of finance accounting and management accounting. SAP FICO is one of the prime module in SAP ERP and it can be integrated with other SAP modules like SAP MM, SAP SD, SAP PP etc.

    Sub-components of SAP FI

    • SAP FI General Ledger accounting
    • Asset Accounting
    • Funds Management
    • Accounts Receivables
    • Accounts Payable
    • Special Purpose Ledger
    • Consolidation
    • Travel Management
    • Bank Accounting

    Sub Components of SAP CO

    • Cost Element Accounting
    • Profit Center Accounting
    • Cost Center Accounting
    • Internal Orders
    • Profitability Analysis
    • Product Cost Controlling

    What is SAP S4 HANA Finance?

    Previously known as Simple Finance, S/4 HANA Finance was the first component of SAP’s Business suite to be rewritten to run on in-memory HANA database. SAP S/4 HANA Finance is the combination of New GL with different category Extension Ledgers and complete Management Accounting solutions. It is used for real-time business intelligence.

    Difference Between SAP FICO and S4 HANA Finance

    SAP FICO SAP S/4 HANA Finance
    SAP FICO works on ECC model. SAP S/4 HANA Finance model is based on in-memory HANA database and works on cloud platform.
    SAP FICO is the Finance and Cost controlling module in SAP ERP where FI stands for Financial Accounting and CO stands for Controlling. SAP FICO module is very robust and covers almost all business process encountered in various industries. It is one of the essential and widely implemented modules in SAP. SAP Simple Finance was the former name of SAP S/4 HANA Finance.
    SAP S/4 HANA Finance is the area of the S/4 HANA suit dealing specifically with Finance Management solutions.
    SAP FI submodules:
    General Ledger
    Account payableAccount receivable
    Banking etc.
    It enables:

    • A consistent view of financial data across the company reduces reconciliation efforts.
    • Universal Journal for financial/controlling data.
    • Central Finance to consolidate multiple back end data sources.
    No option to create CDS Views Data is calculated on the fly with cds views.

     

  • SAP FI Integration

    SAP FI Integration

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

    Introduction

    SAP FI can be integrated with other SAP modules such as SAP CO, SAP SD and SAP MM. Integration with other modules plays a vital role in the strength of the SAP system.

    In simple terms, it means data is entered in one part of the system and through integration, it flows to other parts ensuring accuracy and saving time and effort.

    The three most common integration modules are SAP CO, SAP SD and SAP MM.

    SAP FI Integration

    NOTE: SAP CO – SAP Controlling, SAP SD – SAP Sales Distribution, SAP MM – SAP Material Management

    Case in point

    We can understand MM, SD and FI in simple terms as, MM means procure to pay, SD means sales to customer process and FI means payment and financial statement.

    Manufacturing business logic is made up of three things: BUY-MAKE-SALE. It means we buy the raw material from the vendor, make a finished product out of it, and sell this to the customer. Buy-Make-Sale

    Figure 1: Buy-Make-Sale

    • The organization buys the raw material, it goes to warehouse stock and is tracked under the MM module. And as an organization bought something it has to pay the capital to the vendor and which is tracked under the FI module.
    • To make a finished product from raw material, we need a contractor to process it. The process from raw material to finished product is tracked in the MM module and as an organization has to pay the contractor for his effort, payment will be made. This payment is tracked in the FI module.
    • We have the finished product now. So, to sell it to the customers we have to proceed with the sales process (sales order, delivery, billing etc). This is tracked under the SD module. So when we deliver the product to our customer, the customer will make payment for it, this will be tracked under the FI module. At that time, if the stock in the warehouse is decreased, this will be tracked in the MM module.

    Integration SAP FI-MM

    When material movement is processed and if it involves payment, an account entry is posted in FI. Let’s dig deep into how to post an account entry and do related configurations.

    Material master: It holds all the information for materials like material type, material group, purchasing information etc.

    Valuation class: Used to group materials based on same attributes (plant, material ..), so that we can carry same account determination for various materials. It is most important for automatic account posting. We can see the valuation class for particular material from t-code MM03.

    Valuation class

    Each material has a valuation class.

    Movement type: It is used for all types of material movements. For example, we transfer material from one location to another, a movement happens and a movement type is created for the same.

    Material movement is done with respect to movement type.

    Activity Movement Type
    Goods receipt 101
    Goods issue to production order 261
    Scrapping of goods 551
    Goods delivered to the customer 601
    Initial upload of stock 561

    Both valuation class and movement type are used to determine the G/L account.

    Integration Flow

    Automatic account posting

    T-code OBYC.

    T-code OBYC.

    For different movement types, account entry is done via different transaction event keys.

    NOTE: Movement type locates the valuation class for the material and posts the account to the G/L account associated with this valuation class.

    Integration SAP FI-SD

    When we sell the finished product, a bill is generated and the customer has to pay the amount, which is then posted to the FI module.

    The account entry of billing has two sides: Customer account (A/c Debit) and revenue account (A/c Credit). The customer data is fetched from customer mater data which is maintained from the SD module and the revenue account needs to be configured.

    For configuring the revenue account, we need to get the G/L account. There are five ways to determine G/L account in the SD module:

    • Cust.Grp/MaterialGrp/AcctKey
    • Cust.Grp/Account Key
    • Material Grp/Acct Key
    • General
    • Acct Key

    Assigned G/L accounts are used to post revenue, discount or surcharges if any.

    Configuration

    T-code: VKOA

    T-code: VKOA

    Figure : Default table and description for G/L account

    • The system firsts checks the table entry for Cust.Grp/MaterialGrp/AcctKey and goes to the transaction and the particular billing document. If checks for the customer group and material group combination and determines the G/L account.
    • If the G/L account is not present, it will go to the next table and performs step 1. This continues until the G/L account is not determined.
    • When the G/L account is determined for the combination, the amount is debited from the customer account and credited to the revenue account.

    Example

    Let’s take the G/L account 180033 is maintained for material group AAG.

    Example of SAP FI MM Integration

    When the system finds the combinations in the table, the amount is debited from the customer’s account and credited to G/L account 180033. The account key is used to determine whether it is revenue, discount or surcharges.

  • SAP FI Subcomponents

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

    SAP FI Subcomponents

    SAP’s financial accounting is divided into submodules that reconcile with one another. SAP FI Subcomponents

    This article will focus on the SAP FI Subcomponents.

    General Ledger

    In SAP FI, everything is linked to General Ledger or G/L. G/L acts as the primary record to maintain all the financial transactions of the company. Example: customer transactions, internal company transactions, etc.

    Tcodes used for maintaining General Ledger
    F-06
    F-07
    FBCJ
    FB50
    FB02

    Account Receivable

    SAP’s Accounts Receivable module ensures that businesses receive money efficiently from their customers. It manages customer accounts and transactions.

    Tcodes used for maintaining Account Receivable Tables used for Account Receivable
    FD11 KNA1
    FD10 KNVV
    FRCA BSIW
    VD01

    Account Payable

    An account payable is a debit or credit to an external business partner, such as a supplier, or to an internal stakeholder. Accounts payable submodules are primarily used to manage our supplier accounts and pay for our suppliers’ goods and services.

    Tcodes used for maintaining Account Payable Tables used for Account Payable
    XK01 LFA1
    MK01 LFM2
    MK02 LFBK
    FCHU

    Asset Accounting

    Asset Accounting deals with all aspects of the company’s fixed assets, including all transactions related to fixed assets. It works closely with other SAP modules, such as SAP MM, SAP Plant Management, and EWM. Example: When a company purchases a product that can be considered an asset, details about the purchase are sent from SAP MM to Asset accounting.

    Tcodes used for maintaining Account Receivable
    AT01
    AT03
    AUN0
    ASEM

    Banking

    Bank accounting deals with all the transactions through the bank. It manages all the incoming/outgoing transactions, balance and bank-related master data.

    Tcodes used for maintaining Bank Accounting Tables used for Bank Accounting
    FIBLAROP LFBK
    OBEBGEN BNKA
    FI13 KNBK
    FF_6
    RVND

    Travel Management

    The travel management module tracks all the travel expenses of a company. The project includes all travel requests, travel planning, and expenses associated with all requested trips. Due to its integration with all the other SAP modules, it helps organizations manage travel expenses efficiently.

    Tcodes used for maintaining Travel Management. Tables used for Travel Management.
    PR05 TA22B
    PRTS PTRV_HEAD
    TRIP FTPT_PLAN
    PR00 FTPT_ITEM

    Fund Management

    Fund management manages funds in a company. Various modules like General Ledger (G/L) and SAP AR/AP, as well as SAP Material Management, etc., interact with Fund Management to provide fund details. This covers all transactions relating to the receipt of funds, the expenditure of funds, and the future expenditure of funds. The company can use the funds in a proper manner and create a budget forecast.

    Tcodes used for maintaining Fund Management. Tables used for Fund Management.
    FM5I FMFCTR
    FMWA FMIFIIT
    FMEQ FMIT

    Legal Consolidation

    By treating multiple units of an organization as a single entity, legal consolidation allows one to view details of all the companies under that umbrella as one financial statement.

    Tables used for Legal Consolidation
    FILCP
    MCDX
    GLT3
    T000K

    NOTE: Legal Consolidation (earlier supported in an older version of SAP ERP) module is now performed by SAP Business Process Consolidation BPC and SEM-BCS.

     

  • What is SAP FICO?

    What is SAP FICO?

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

    Introduction

    The SAP FICO acronym stands for SAP Financial Accounting and Controlling and is one of the most important SAP modules. It can be integrated with SAP MM, SAP SD, SAP PP, SAP SCM, etc.

    SAP FI is a financial management system that analyzes the financial data of an organization. SAP CO is responsible for monitoring, coordinating, and optimizing all the processes of an organization.

    Subcomponents of SAP FI

    The SAP FI system is divided into several subcomponents for specific account processing. The following are the SAP FI subcomponents:

    • Finance Accounting General Ledger: It contains all the transactions of companies.
    • Finance Accounting Accounts Receivable: Records customers’ transactions and manages their accounts.
    • Finance Accounting Accounts Payable: Records all vendor and manpower transactions.
    • Finance Accounting Asset Accounting: Captures all the transactions related to the company’s fixed assets such as land etc.
    • Finance Accounting Bank Accounting: Keeps track of the company’s financial account transactions and data.
    • Finance Accounting Travel Management: It manages all aspects of the travel process, including booking trips and handling travel expenditures.
    • Finance Accounting Fund Management: Manages the company’s revenue and expense budgets.
    • Finance Accounting Legal Consolidation: It provides an overview of the company’s financial position as a whole by combining financial statements for multiple entities.
    • Finance Accounting Special Purpose Ledger: The ledgers are defined in SAP FI for reporting purposes.

    SAP FI Subcomponents

    Figure 1: SAP FI Subcomponents

    Why use SAP FI?

    SAP FI manages financial accounting data across multiple companies, currencies, and languages. The objective is to record all financial transactions posted by an entity and prepare an accurate financial statement at the end of the trading period.

    There are several financial components involved.

    • Fixed asset
    • Accrual
    • Cash journal
    • Accounts receivable and payable
    • Inventory
    • Tax accounting
    • General ledger
    • Fast close functions
    • Financial statements
    • Parallel valuations
    • Master data governance
  • Steps to Create SAP Business Application Studio (BAS) Account

    Introduction

    SAP BAS or SAP Business Application Studio is a new SAP IDE built on the layout similar to Microsoft VS Code, is a next version development environment of SAP Cloud and SAP UI applications. In this article we will show how to create a SAP BAS trial account. This article can be even used to access your actual BAS (non-trial), jump to step 11 for that.

    Steps to create SAP BAS Account

    1. Visit https://www.sap.com/ and click on Account Button as shown below:
    2. Enter your details in the form shown below:
    3. You will get a mail after filling the form:
    4. On click of activate account, enter your password and click submit:
    5. You will be redirected to a link or visit it: https://account.hanatrial.ondemand.com/. Here, you will be required to approve your phone number:
    6. Accept the legal disclaimer as shown below:
    7. Now you will be logged into SAP BTP, here you need to choose a region near to you, it will create a global account and subaccount for you, click continue once done:
    8. Now go to your trial account, by clicking the below button:
    9. Click on your subaccount:
    10. Inside subaccount, click Service Marketplace, there search “SAP B”, and then click the three dots next to “SAP Business Application Studio” and thereafter click on “Go to Application”
    11. Press “OK” and proceed:
    12. You will land on homepage of “Business Application Studio” as shown below:
    13. Save or bookmark the link of the BAS for future use. Now, you can start here by clicking a new Dev Space.

     

  • Delete an Entity using SAP OData

    Preface – This post is part of the SAP ABAP OData Tutorial series.

    Delete operation is used when you want to remove a record from the database. For example, you have created one quotation and now you no longer want it. So you will delete the quotation using the DELETE request.

    This article describes the step-by-step procedure to implement and test delete operation in SAP OData.

    Context

    Delete entity can be implemented by redefining the DELETE_ENTITY method.

    Procedure

    1. Open *DPC_EXT class artifact of OData and redefine *DELETE_ENTITY method.
    2. Reimplement the delete method.
      Delete an Entity using SAP OData
      IT_KEY_TAB holds the values from the frontend.
    3. Activate the class and register the service.
    4. Execute and test the OData.
      1. Select Entity set
      2. Select DELETE option
      3. Add the key value to be deleted in the request URL
      4. Execute the request
        Delete an Entity using SAP OData Testing
      5. Status 204 represents success.
      6. Verify in the table the record is successfully deleted.

    Tutorial Video

    You can watch the below video to learn implementation:

    [embedyt] https://www.youtube.com/watch?v=2rEZrFj2haE[/embedyt]
  • Update an Entity using SAP OData

    Preface – This post is part of the SAP ABAP OData Tutorial series.

    Many times, we come across a scenario where we want to update the data records, for example, we want to update the phone number or address.

    This article describes the step-by-step procedure to implement and test update operations in SAP OData.

    Context

    Update entity can be implemented by the redefining UPDATE_ENTITY method.

    1. Using PUT HTTP method.
    2. Using PATCH HTTP method.

    Difference between PUT and PATCH HTTP method

    • PUT: The request body is considered as the updated version of the original data stored in the database. When using PUT, we need to send the full payload in our request.
    • PATCH: It is used for the partial modification of the resource. When using PATCH, we only send the data to be modified in the request body.

    Procedure

    1. Open *DPC_EXT class artifact of OData and redefine *UPDATE_ENTITY method.
    2. Reimplement the method for the update.
      UPDATE_ENTITY method
    3. Activate the class and register the service.
    4. Execute and test the OData.
      1. Select Entity set
      2. Get the data to be updated using the GET request
      3. Click on Use as Request to copy the HTTP response to HTTP request which works as input.
        Execute and test the OData
      4. Change the field value Carname and URL in HTTP Request
      5. Select PUT option
      6. Add the key value to be updated in the request URL
      7. Execute the request
        Execute and test the OData PUT Request
      8. Status code 204 represents success
        PUT Request response
      9. Verify-in the table data is successfully updated.
        verify the updated data

    Tutorial Video

    You can watch the below video to learn implementation:

    [embedyt] https://www.youtube.com/watch?v=2rEZrFj2haE[/embedyt]
  • Create an Entity using SAP OData

    Preface – This post is part of the SAP ABAP OData Tutorial series.

    Context

    Create entity can be implemented in two ways:

    1. Using CREATE_ENTITY method for single entity creation.
    2. Using CREATE_DEEP_ENTITY method to create a single entity as well as parent and child entity together.

    Procedure

    1. Open *DPC_EXT class artifact of OData and redefine *CREATE_ENTITY method.

    2. Reimplement the method.

    method PARTNERS_CREATE_ENTITY.
    
      data: lv_id                type          snwd_partner_id,
            ls_id                type          bapi_epm_bp_id,
            ls_header            type          bapi_epm_bp_header,
            lt_return            type 	      table of bapiret2,
            error_msg            type          string,
            ls_message           type          scx_t100key,
            lt_keys              type          /iwbep/t_mgw_tech_pairs,
            ls_snwd_bpa          type          snwd_bpa,
            lv_timestamp         type          timestamp.
    
      io_data_provider->read_entry_data( importing es_data = ls_header ).
    
      CALL FUNCTION 'BAPI_EPM_BP_CREATE'
        EXPORTING
          HEADERDATA        = ls_header " EPM: BP header data
        IMPORTING
          BUSINESSPARTNERID = ls_id
        TABLES
          RETURN     = lt_return.     
    
      if lt_return is not initial.
        loop at lt_return reference into data(lr_return).
          err_msg = lr_return->message .
        endloop.
    
        ls_message-msgid = 'SY'.
        ls_message-msgno = '002'.
        ls_message-attr1 = error_msg.
    
        raise exception type /iwbep/cx_mgw_busi_exception
          EXPORTING
            textid = ls_message.
      endif.
    
      CALL FUNCTION 'BAPI_EPM_BP_GET_DETAIL'
        EXPORTING
          BP_ID             = ls_id
        IMPORTING
          HEADERDATA        = er_entity
    endmethod. 
    

    The input data is passed in es_data structure and captured in ls_header. The structure ls_header is then used as the input parameter of BAPI ‘BAPI_EPM_BP_CREATE’ to create data in the database. Then BAPI ‘BAPI_EPM_BP_GET_DETAIL’ will retrieve the created data and capture it in er_entity which will be passed to the response body.

    3. Activate the class.

    4. Create Deep Entity (To create Header with Item): Redefine method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_DEEP_ENTITY

    5. Reimplement the method.

    method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_DEEP_ENTITY.
    
     types: ty_t_soitem type standard table of  zcl_z_epm_rkt_mpc=>ts_salesorderitem with default key.
     types: begin of ty_s_so.
              include type zcl_z_epm_rkt_mpc=>ts_salesorder.
               types: items type ty_t_soitem,
             end of ty_s_so.
    
      data: ls_sales_order     type ty_s_so,
            lv_compare_result  type /iwbep/if_mgw_odata_expand=>ty_e_compare_result.
    
      data: lv_so_id    type BAPI_EPM_SO_ID,
            ls_so_hdr    type BAPI_EPM_SO_HEADER,
            ls_so_hdr2   type BAPI_EPM_SO_HEADER,
            ls_so_item   type BAPI_EPM_SO_ITEM,
            lt_so_item   type standard table of BAPI_EPM_SO_ITEM,
            lt_so_item2  type standard table of BAPI_EPM_SO_ITEM,
            lt_return   type bapirettab,
            ls_return   TYPE bapiret2,
            ls_message  type scx_t100key,
            error_msg     type string.
    
      constants: lc_so_itm TYPE string VALUE 'Items'.
    
    * Validate whether data matches
      lv_compare_result = io_expand->compare_to( lc_so_itm ).
    
    * Access data from IO_DATA_PROVIDER
      if lv_compare_result EQ /iwbep/if_mgw_odata_expand=>gcs_compare_result-match_equals.
    io_data_provider->read_entry_data( IMPORTING es_data = ls_sales_order ).
    
    *   Move header Sales order data into BAPI structure
        move-corresponding ls_sales_order to ls_so_hdr.
    
    *   Move Sales Order items into BAPI table structure
        loop at ls_sales_order-items into ls_so_item.
           append ls_so_item to lt_so_item.
        endloop.
    
        CALL FUNCTION 'BAPI_EPM_SO_CREATE'
          EXPORTING
            HEADERDATA          = ls_so_hdr
          IMPORTING
            SALESORDERID        = lv_so_id
          TABLES
            ITEMDATA            = lt_so_item
            RETURN              = lt_return.
    
        if lt_return is not initial.
          loop at lt_return into ls_return.
            err_msg = ls_return-message .
          endloop.
    
          ls_message-msgid = 'SY'.
          ls_message-msgno = '002'.
          ls_message-attr1 = error_msg.
    
          raise exception type /iwbep/cx_mgw_busi_exception
            exporting
              textid = ls_message.
        else.
    
          CALL FUNCTION 'BAPI_EPM_SO_GET_DETAIL'
            EXPORTING
              SO_ID            = lv_so_id
            IMPORTING
              HEADERDATA       = ls_so_hdr2
            TABLES
              ITEMDATA         = lt_so_item2.
          move-corresponding ls_so_hdr2 to ls_sales_order.
          ls_sales_order-items = lt_so_item2.
    
          copy_data_to_ref(
          EXPORTING
            is_data = ls_sales_order
          CHANGING
            cr_data = er_deep_entity ).
        endif.
      endif.
    endmethod. 
    

    The structure of incoming data contains parent and child entity nested structure. This is defined with type ty_s_so.

    6. Activate the class

    7. Execute the Create request.

    • Select Entity Set
    • Select HTTP method as POST
    • Add the data in the request body
    • Click Execute

    Tutorial Video

    You can watch the below video to learn implementation:

    [embedyt] https://www.youtube.com/watch?v=2rEZrFj2haE[/embedyt]
  • Testing SAP OData CRUD operations using Postman

    Preface – This post is part of the SAP ABAP OData Tutorial series.

    Introduction

    Postman is an API development tool that helps developers to create, test, share and document the APIs. It has various HTTP requests like GET, POST, PUT, PATCH and the ability to save the environment.

    In this article, we will learn how to set up the POSTMAN and then we will test OData CRUD operations using POSTMAN.

     

    Installing POSTMAN

    To install POSTMAN on your device you can use the link go.postman.co/home and download the latest version for your platform.

    For more details on installing and updating POSTMAN, you can refer to the link https://learning.postman.com/docs/getting-started/installation-and-updates/

     

    Components of POSTMAN

    Postman UI is made up of various components.
    Components of POSTMAN

    • Left sidebar provides the navigation to Collections, APIs, Environments, Mock Servers, Monitors and History.
    • Header provides the access to Workspace, Reports, and Search option.
    • Center area is where we work with requests.
    • Right sidebar provides the link to Comments, Request Info’s, Code and Documentations.

     

    Variables

    We will use the variables to store our data which will be reused multiple times.

    You can create variables by clicking ENVIRONMENT in the left panel and selecting GLOBAL.

    Variables in Postman

    Here you create variables and provide initial and current value. In case you need to change the value of the variable you only need to update the CURRENT VALUE field. This is the field from where the data is picked up.

    Scope of variables:

    Scope of variables

    • Global scope: Enable you to use data between the Collection, requests, test scripts and environment.
    • Collection: Enable you to use data in different requests under the same collection.
    • Environment: Enables to tailor the processing to different environments.
    • Data: Comes from external files like CSV, JSON.
    • Local: The scope is temporary and can only be used in the defined requests.

    Create variable

    1. Select data and click on Set as Variable.
      Create variable
    2. Select Set as new Variable.
      Set as new Variable
    3. Provide name, value and scope.
      Save Variable

     

    Format to use variables in request: {{variable_name}}

    Example:  .Example of variable in postman

     

    HTTP requests

    There are various HTTP methods available that are used to make a request to APIs. Some of the frequently used HTTP methods are:

    • GET: Used to retrieve data from APIs (Read scenario)
    • POST: Used to send new data to API (Create scenario)
    • PUT or PATCH: Used to update existing data (Update scenario). PUT request modifies the entire resource in the database whereas PATCH request modifies only the supplied resource. So, while using PUT we need to send the entire data in request URI and by using PATCH we need to send only the updatable field.
    • DELETE: Used to remove existing record (Delete scenario)

    It supports various addition methods. Refer to the below snip.
    HTTP requests in Postman

    Creating requests

    You can create a request by clicking on the NEW tab and selecting HTTP Request. Also, you can create a request by clicking + button.

    Creating requests

    After selecting HTTP Request, a screen will open. Provide relevant name, description to your HTTP request.

    Specify the relevant details for your requests (like HTTP method, URL, parameters, body data).

    Get request in Postman

    Click on SEND button to save your call. You can create a collection to save all your related requests under one folder.

     

    Collection

    A collection is a folder that groups the number of API requests. There can be n number of collections in Postman. Generally, an API request belonging to the same business object is saved under  the same Collection. You can even share your API requests with your team via collection.

    Authentication

    Authentication is verifying the client’s identity who is accessing the request whereas authorization is verifying the client’s action of permission. Some APIs require authorization details act.

    To provide authorization details, click on the Authorization tab and select auth Type. Provide the relevant details and SAVE.

    There are various auth types, for more details check out Authorizing requests.

    Authentication in Postman

    Instead of adding an authorization in each request individually, you can add your authorization details directly to your Collection.

    Steps:

    1. Select TYPE as Inherit auth from parent.
      Type of Authorization
    2. Click Collection and add authorization details there.
      Basic Authentication in Postman

    Sending requests

    GET request

    Steps to follow:

    1. Click on the NEW button and select HTTP request
      New GET request

     

    1. Select HTTP request GET and enter OData service URL in URL field
      Enter URL

     

    1. Click on the Send button
      Send Request

     

    At the bottom, you can see the output and status code.

     

    Fetch x-csrf-token

    An x-csrf-token is used to prevent cross-site request forgery attacks. While making a call for Create/Update/Delete we must need to send x-csrf-token value via Header.

    Steps to fetch the x-csrf-token value.

    1. Create a GET
    2. Add in HEADERS: key = x-csrf-token and value = fetch.
      Fetch x-csrf-token
    3. Execute the request by clicking on SEND
    4. Below you will get the result. In the Header section of the result you can find fetched x-csrf-token value. Get that value and paste it in HEADERS section of CUD requests.

     

    POST request

    1. Select HTTP request POST and enter OData service URL for create in URL field. (Do not provide the key field and its value in URI)
      POST request in Postman
    2. Provide x-csrf-token parameter in HEADERS (To fetch x-csrf-token refer How to fetch x-csrf-token?).
      Provide x-csrf-token
    3. Provide the data to be created in the BODY tab and select the relevant data type. Here, we have selected raw.
      Provide the data to be created in the BODY
    4. Save and click on Send to execute the request.

     

    PUT/PATCH request

    To know which request URI to use please read HTTP requests.

    1. Select HTTP request PUT/PATCH and enter OData service URL for create in URL field. ( Add key field and its value which is to be updated)
      Select HTTP request PUT
    2. Provide x-csrf-token parameter in HEADERS (To fetch x-csrf-token refer How to fetch x-csrf-token?).
      Provide x-csrf-token parameter in HEADERS tab
    3. Provide the data to be created in the BODY tab and select the relevant data type. Here, we have selected raw.
      For Put Provide the data to be created in the BODY tab
    4. Save and click on Send to execute the request.

     

    DELETE request

    1. Select HTTP request DELETE and enter OData service URL for create in URL field. ( Add key field and its value which is to be deleted)
      Select HTTP request DELETE
    2. Provide x-csrf-token parameter in HEADERS (To fetch x-csrf-token refer How to fetch x-csrf-token?).
      Provide x-csrf-token for Delete
    3. For DELETE requests we don’t have to provide any input in BODY.
      No body required for Delete
    4. Save and click on Send to execute the request.

    Sharing API requests

    To share your API requests with your team or other people follow the below steps.

    1. Save your requests in Collection.
    2. Click on Collection that you want to share.
    3. Click on the Share button
      Sharing API requests
    4. There are three ways you can share.
      Share Quota

    Best practices

    1. If a parameter or value is used at multiple places. Always try to create its variable in the Environment section and use the variable in your requests.
      Example: If api.getpostman.com is used in all your requests URL.
      Postmand Best practices 1
      Create a variable with value api.getpostman.com and use the variable everywhere.
      The positive aspect is in case your domain is changed, you only need to change the value in one place and all your requests will adapt it.
      Postmand Best practices 2
      Postmand Best practices 3

     

    1. If you are adding Authorization, never provide your password directly in your Request or Collection level.

    The mishappening is, if you provide your password directly at a collection level or in request and you share the collection with your team or other people, the password will also get shared with them. So, everyone with that collection will get to know your password.

    Postmand Best practices 4

    The best approach is to create a variable for your password in the environment section and use that variable in the password field. This way only the variable name will be shared and your password will be safe.

    Postmand Best practices 5

    1. Instead of fetching x-csrf-token value and adding it to request every time manually, you can create a variable for x-csrf-token in the environment and add a script code to automatically update the x-csrf-token value in the environment.