Author: Rudramani Pandey

  • Picking, Packing and PGI

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

    Introduction

    We have learnt that pre-sales, sales and anything after sales is logistics. So logistics is where depending on the availability of goods you create the delivery.

    Delivery has three pieces to it or there are three sections to delivery.

    • Picking
    • Packing
    • PGI

    The first one is picking, the second is packing (this is optional), sometimes you do pack, sometimes you don’t need to do it for some materials. But picking is typically a process that’s followed for all physical deliverables, meaning physical goods, all tangible goods. And the last step is PGI, which is posting the issue of goods or post goods issue. The corresponding accounts are updated and the inventory is updated. This is the delivery.

     

    What is picking?

    Depending on what the customer needs, these products will be brought to a place called a staging area, where you can do all the packing and the processing. So you get all these goods in the staging area and the next step is to get these goods ready for packing.

     

    What is packing?

    Packing is just pulling those desktops, laptops, whatever the products are, into the proper packaging format requested by the customer, weighing them on your FedEx machine or EPS machine and keeping the box ready for the truck to come in. This is packing.

    After packing, when the truck comes in, the packed goods are loaded and the truck leaves. This is called picking.

     

    What is a post goods issue (PGI)?

    The goods that you have picked, packed and loaded are really no longer yours. They need to be accounted for in your inventory. All the details will be accounted for in your inventory.

    Meaning what is your inventory, in our case its desktop, what’s the total as of before the packing sets,  quantities, let’s say 2000. Now as part of this delivery, 500 has been reduced. So now it’s 1500. So, this process of reducing the inventory and making sure that the accounts are up to date is called the post goods issue.

     

    So, these are the three main steps that happen in the delivery.

    In the next article, we are going to actually create a delivery for the order that we have created previously and do the picking. And we’re not going to do the packing yet and we are just going to do the PGI and technically close that delivery.

  • Delivery

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

    Introduction

    We have finished our pre-sales documents, inquiry, quotations and then Wal-Mart has placed an order, this is a sales document. So now we need to deliver the physical goods. This part is called logistics and this behaves differently than an order.

     

    What is the delivery?

    Most of the things in the delivery, again, are copied down from an order because we are trying to deliver the goods corresponding to the order that the customer has given us.

    Example

    In this case, the customer said he needs a desktop, quantity 100 and then there could be more line items. And each line item over here will have what is called a confirmed date.

    When creating the order, SAP has already done the availability check. An availability check confirms that these goods will be available or can be confirmed by this date, say, 14th of March or whatever. When you try to create this delivery, you should create it for that date, because if you try to create it before the system knows that the goods are not going to be it will not allow you to create a delivery. So make sure that the date you are trying to create the delivery, is the date the goods are confirmed. That’s called the delivery date.

    Once you get that, then you can create a delivery. Only the items that have that are to be delivered in the designed timeframe will be going to be delivered. Whenever the goods are available you can create a delivery document and all the goods that are confirmed by that date, the date when you’re creating the delivery will flow down from the order into the delivery.

     

    Pieces of Delivery

    Delivery essentially comprises three pieces.

    • Picking
    • Packing
    • PGI or post goods.

    There are other areas as well, but these are the main three key pieces or three key subprocesses in our delivery.

    We will understand picking, packing and PGI in our next article.

  • Sales Order

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

    Introduction

    In the previous articles, we have learnt about an inquiry with an example. So we have Wal-Mart as our customer. We have a company, say, HP. Wal-Mart has inquired for some goods and an inquiry has been created in the system and sent out to Wal-Mart. Wal-Mart liked the inquiry and requested a formal call. This is a quote or an RFQ. A quotation was created in the system with reference to the inquiry.

    Up until this point, things are casual, meaning the customer is not promising to buy. The customer is just fooling around. Basically, it’s like you want to buy a car. You go to one dealer, another dealer, you go to five different dealers. You might just inquire for how long you want or you might get quotations from one, two, three, four different car sales guys or dealers. And you ultimately will end up buying from one. Typically, the quote that you like, you just confirm the quote and that’s when you go in and place an order for the car. But up until that point, it’s just called pre-sales term, because up until this point, there’s no sale.

    But after this, if the customer chooses to buy, then the customer will place what is called a purchase order.

    Steps to sales:

    • Inquiry
    • Quotation
    • Purchase order

     

    So from this point on, it becomes a sale. It’s almost exactly similar in terms of the data that it contains between an inquiry and a quotation. The customer does not change, nor does the quantities or the products that are desktops, laptops. So you can as well create it with reference and copy all the products and customers over to your subsequent document. In this case, the document is a sales order. And save it and generate a number for you, say 13409, and that is what you’re going to send as a purchase order, confirmation to the customer, Wal-Mart.

    Sales Order

    A sales order is a document generated in the system by the seller containing all the details related to the products or services requested by the customer. The details include prices, quantities, terms and conditions and much more information.

    Purchase order

    A purchase order is a fancy word for an order number generator in the system that confirms to the buyer that they have received the order. It is a document that a customer sends to the supplier that includes details like quantities, prices.

    It’s just like if you place an order at Amazon, you’ll get order confirmation. So here are the products you brought to get to know the prices, the total taxes and of course, you get additional details like when it’s going to ship by, and on what carrier, what tracking number and other information. That’s your purchase order number.

    Difference between purchase order and sales order

    When the customer is buying things, he’s actually purchasing things. Wal-Mart, the customer, calls it a purchase order. HP, on the other hand, is selling things. So it’s called the sales order, but both are the same in this case.

    And another point, just like the way quotation number and an inquiry number is generated, a purchase number is generated and sent to the customer, and that is called an order confirmation or a purchase order confirmation or sometimes it’s called sales order confirmation.

     

     

  • Quotation

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

    Introduction

    Now that we have talked about the inquiry in the previous section, let’s start with the next step. We will continue with the example of Wal-Mart. Wal-Mart makes a decision that they like the inquiry, meaning that they like the prices or the product delivery date that HP has proposed. Or they don’t like it. If they like it, they like to continue their discussion further with HP in terms of how they would like to proceed further. The next step to an inquiry from a customer perspective needs to ask for a formal quote.

     

    What is a quote?

    The quotation process is going to look something like this: Wal-Mart is going to call or get in touch with HP and say, all right, with respect to our inquiry number 110120, we would like to continue further and want to ask you for a formal quote.

     

    A quote is very similar to an inquiry. But almost has the same set of details. From HP’s perspective, the quote is almost similar. So, we have the customer, Wal-Mart, and of course products, Desktop, laptop and the quantities, prices. That’s a quote.

    So why are they doing it again? If everything is similar between a quote and an inquiry, what’s the point in trying to do it again?  There are a couple of differences between the two.

     

    Inquiry and quotation

    An inquiry is very informal. Meaning, you go shopping at home for cars, you would go visit ten different dealerships. You’re not really sure which car you want. Maybe through the course of doing all these inquiries with different vendors, you find out that you might need a particular model of a car, say a Honda CRV. Now, you start to focus more on getting quotes from Honda CRV from different dealers that you’ve visited.

     

    Difference between Inquiry and Quotation

    The difference is, an inquiry is more informal. So HP does not need to stick to its stores or prizes, or variables. An inquiry has been made, we promised $500 per piece here, and if Walmart comes back 10 days from now and says I need the product, HP is not legally bound to deliver them at that price. But, a quotation on the other hand is more formal, which means the terms and conditions including prices, quantities, and deliverables need to be adhered to. Legally means, it’s more or less a formal legal quote, whereas inquiry is more informal, no terms, no promises.

     

    The clear difference is inquiry is more informal. So, it doesn’t have a set of days with which it’s valid. It’s informal anyway.

    The quotation, on the other hand, has a set of days within which it’s valid.

    Example of Inquiry and Quotation

    We can take an example, let’s continue the same car search.

    We’re searching for cars and you found a car, you’d like to get a quote on it. Let’s say the dealer has quoted $25,000. It’s not going to be valid forever, right? It’s going to be valid for, say, two weeks or a week at most. So this set of dates within which that quotation is valid is called validity dates. All quotations typically have a validity date. So the from date, and the to date is called the validity dates.

     

    You can grab some more differences between the inquiry and the quotation.

     

  • Order to Cash cycle- Inquiry

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

    Introduction

    In this article, we will understand the sales order cycle. Every business will have a cycle. Let’s take an example of the finance business or the finance department. So, the finance department is responsible for looking at what the customer needs to pay and receiving the cash or receiving payments. That’s their business, they call it a report to record.

    Another example can be the procurement department. So, the procurement department is responsible for interacting with the vendors, getting the goods on time, so on. He is responsible for placing the purchase order with a vendor. For example, if Amul procurement department were to be taken as an example, they are responsible for dealing with the vendors that supply the goods. The procurement department will talk to all the different milk vendors. They’ll raise purchase orders, they’ll get the goods into the stock and they’ll pay the invoices, meaning pay the money to their vendors. This cycle is called procure to pay. So similarly, there are different business cycles followed by the different departments.

    Here, we will look into the sales department and different terms used in it. The sales department also follows a cycle, called the sales order cycle.

     

    What is Sales Order Cycle?

    The sales order cycle is a sequence of actions that a business follows to fulfil customer requirements.

     

    What is an RFI or an Inquiry?

    RFI is abbreviated as Request for Inquiry. It is a document requested by the company to gather information about the products and services from suppliers.

     

    What information’s are included in RFI?

    Every business can decide their own format for an RFI that they want to collect from the supplier. There is no particular way to write an RFI.

    Below are some details that can be included in an RFI.

    • Basic information about your company.
    • Request supplier to provide basic information about their organization
    • Confidentiality agreement to prevent the disclosure of information with a third party.
    • Statement for the reason of RFI.
    • Queries related to supplier experience in the relevant projects.

     

    Example

    The sales order cycle is best understood with an example. We will consider a B2B (business-to-business) scenario because SAP is built for more B2B scenarios.

    Let’s take two companies, one company say, a computer manufacturing company, HP or Dell. This is the company which is selling. So, we are looking at things from HP’s perspective. And there will be a buyer company.

    Let’s take the scenario of HP selling computers to the customer, Walmart. Wal-Mart is our customer. So, HP sells computers to Wal-Mart.

    How does the cycle start?

    Wal-Mart is looking for computers. It is inquiring about the different rates of HP, Dell and all the different computer manufacturers. Wal-Mart sends an RFI or Inquiry to HP. So, as soon as HP receive the request from Wal-Mart, they will capture the information in a document based on the customer’s RFI. This document is called an Inquiry.

    And as soon as this inquiry is saved in the system, you get an inquiry number. This inquiry number will be sent over to Walmart as a response to that inquiry.

     

  • Master Data

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

    Introduction

    In this article, we are going to talk about master data. Master Data is everywhere. We see master data all around us. For example, if you go to Safeway, you go buy a bunch of products where you buy some soap and other stuff, and then you go to the billing counter, all your items are scanned and you’ll be asked if you have a reward card. So, this is a card that you’ll be given whereby your discounts will be cumulatively added and if you don’t have one, they’ll give one right away. What does the reward card have? A rewards card has your name, address and some of the personal details about you that they think are relevant for your purchase. This right here is Master Data. You can also call it customer master because you’re a customer in this case and Safeway is the company of the vendor which is selling you these products.

     

    What is Master data?

    Master Data is at its very fundamental level a collection of properties of an object. Objects could be customers, materials, vendors, assets, any of these. Typically, this kind of data is created only once, meaning you don’t create them again and again and again. For example, in the previous case when Best Buy was created as a customer, you don’t get BestBuy again and again and again. It’s created once, but it’s used again and again and again. And because it’s created once, you rarely change it. It’s changed occasionally. It is also the main source of data in transactions. You take any transaction sales order, delivery, billing, purchase, order, transfer order, posting to accounts, any kind of transaction typically has the bulk of the data coming in from the master data.

     

    Properties of Master data

    • Created once and used again and again.
    • Rarely changed.
    • Main Source of data in transactions.

     

    Types of master data

    Master Data in SAP

     

    Examples

    Let’s dig into some examples.

    Example 1

    Let’s say you go buy a piece of bread or buy a bottle of milk and then you go to the counter and these products are scanned. When they are scanned just one little scan can reveal a whole bunch of information about the product.

    What kind of information could that be? Some examples, of that information, could be:

    • Product name. For example, a particular model of bread is bread plain bread, milk break etc.
    • Product description
    • Price for that product and
    • Discounts they are given on that product
    • Cumulative discounts that are given on

     

    Here, Product Name and Product Description are master data. This is called data related to the material. And so it’s called material master data. Whereas, Price, Discounts and Cumulative discounts can be called pricing master data.

     

    Example 2

    Take another example of Amazon. You go to Amazon and you go log in, right? So, you have your username and password as soon as you log in. You can go to your account any time you want. So, when you go to your account you will have details like names, addresses. You can have multiple addresses like one address in Delhi, India one of those in Texas, US, you can store all your different addresses and you can store your credit cards or debit cards details and also different debit cards and credit cards. All of these are master data. And in this case, you are the customer, so you can call it customer master data. All these are common examples of master data that you typically see in a B2C environment all along.

     

    Example 3

    Say, HP is a company that is implementing SAP and a company buying from HP say Best Buy. Now, Best Buy places an order for, let’s say computers or whatever products that HP sells and HP creates an order. The order contains a header and has line items. Let’s say one, two, three, however many.

     

    On the header, what kind of information does it have?

    • Customer information: It has customer information of course and that’s Best Buy in this case,
    • Tax: The next thing is a tax classification
    • Corporate/Government: What kind of a customer is he, a corporate customer or is he a government customer or any other. In this case, he is a corporate customer or retail customer.
    • Ship: Can we ship all the goods together, yes or no? In this case, being a customer it’s an option that Best Buy gives, right?
    • Address: address to which we need to ship the goods.
    • Phone number: If there are issues which phone number to call to.
    • Payer: Who will be paying for this transaction.
    • Billing address: Where should the bill be sent?

    These are all the things that are captured, at the header level.

     

    Now, similarly, at the line-item level, what do we have?

    • Material: We have details like material that say it’s a computer model one on one
    • Weight: Say, 5 lbs
    • Volume
    • Plant: Which plant is it going to send the goods out of? Let’s say it’s sent out to the Bangalore plant.
    • Tax classification: Sometimes some goods, some materials are taxable and some materials are not.

    Looking back to header data, we have data related to customers and line-item data has data related to the material. So basically, master data in this case is a bunch of properties related to a customer or a material.

  • SAP EML (Entity Manipulation Language) in RAP: Guide

    SAP EML (Entity Manipulation Language) in RAP: Guide

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

    Introduction

    SAP Entity Manipulation Language (EML) is an ABAP language that is used to control the behavior of business objects in the context of the RESTful Application Programming model (also called SAP ABAP RAP). The business objects developed with the SAP ABAP RAP model can be consumed not only by OData protocol (Web API, Fiori UI) but also in ABAP using EML statements.

    There are two flavors of EML:

    • Standard API: Uses signature of business object entities
    • Generic API: Used for dynamic consumption of the business object

    The Generic API is used for the dynamic integration of business objects into other frameworks, such as the Cloud Data Migration Cockpit. Generic API is not in our scope. We will focus on Standard API’s.

    The Standard API’s are used when target business object is statically specified. It provides READ and MODIFY statements for the access of transactional scenarios of objects and COMMIT access for triggering save sequence. Using these syntaxes we will be able to perform the transactional behavior ( Create, Update, Delete, Actions, Read ) of business objects that are defined in Behaviour Definition.

    SAP EML Scenarios

    The following table gives you an overview of different SAP EML scenarios:

    Scenario Description Relevant EML statements
    Develop(BO with IN LOCAL MODE within its own behaviour pool) In EML develop scenario, when you provide the functionality for your own BO in its own behaviour pool, you use IN LOCAL MODE. It bypasses the access control, authorization control and feature instance control.  You can use it with CRUD and Actions. ·         READ/READ by ASSOCIATION

    ·         CREATE/CREATE BY ASSOCIATION

    ·         UPDATE/UPDATE BY ASSOCIATION

    ·         DELETE/DELETE BY ASSOCIATION

    ·         EXECUTE

    ·         AUGMENTING BY ASSOCIATION

    Consume (BO from other behaviour pool/ released objects) In consume scenario, you can use EML to consume other BO in or released BO’s. Here, you are not allowed to used IN LOCAL MODE. ·         READ/READ by ASSOCIATION

    ·         CREATE/CREATE BY ASSOCIATION

    ·         UPDATE/UPDATE BY ASSOCIATION

    ·         DELETE/DELETE BY ASSOCIATION

    ·         EXECUTE

    ·         GET PERMISSION

    ·         SET LOCK

    Test To test the BO outside of ABAP behaviour pool, you can use EML statements. Here, it is mandatory to add COMMIT statement to end RAP LUW. When in case of implementation inside behaviour pool, save it is done by the framework and we need not to write explicit COMMIT there. ·         READ/READ by ASSOCIATION

    ·         CREATE/CREATE BY ASSOCIATION

    ·         UPDATE/UPDATE BY ASSOCIATION

    ·         DELETE/DELETE BY ASSOCIATION

    ·         EXECUTE

    ·         GET PERMISSION

    ·         SET LOCK

    ·         COMMIT ENTITIES

    ·         ROLLBACK ENTITIES

     

    SAP EML Syntax

    SAP EML syntax has three major sections:

    • READ
    • MODIFY
    • COMMIT

     

    READ syntax

    READ is used to retrieve the data or you can say read the data of the entity. The syntax supports:

    • Read: Read the entity
    • Read by association: Read child entity using parent key

     

    Short syntax –

    READ ENTITY
    
     EntityName [FIELDS ( field1 field2 ... ) WITH] | [FROM] it_instance
    
    RESULT et_result
    
    BY \association_name [FIELDS ( field1 field2 ... ) WITH] | [FROM] it_instance_rba
    
    RESULT et_result_rba
    
    LINK et_link_rba
    
    [FAILED ct_failed].
    
    where,
    
    EntityName: specifies the CDS view entity
    
    FIELDS: specifies the direct read for the given fields
    
    RESULT: used to store the retrieved data in variable
    
    LINK: used to store the key pair that is used for read by association operation
    
    Failed: used to store the response about failed retrieve (key-value, fail cause etc)

    Long syntax-

    READ ENTITIES OF RootEntityName
    
    ENTITY entity_1 " entity alias name [FIELDS ( field1 field2 ... ) WITH] | [FROM] it_instance_1
    
    RESULT it_result
    
    BY \association1_name [FIELDS ( field1 field2 ... ) WITH] | [FROM] it_instance_rba
    
    RESULT et_result_rba
    
    LINK et_link_rba
    
    ENTITY entity_2_name " entity alias name [FIELDS ( ......
    
    ENTITY entity_3_name " entity alias name
    
           ... [FAILED ct_failed].

    The long syntax allows you to club READ operation of multiple entities of Business Object specified by RootEntity name at one go. Also, we can use alias names of entities defined in Behavior Definition.

    Example:

    READ ENTITIES OF /dmo/i_travel_m
    
    ENTITY travel
    
    FIELDS ( travel_id
    
      agency_id
    
                          customer_id
    
                          booking_fee
    
                          total_price
    
                          currency_code )
    
    WITH CORRESPONDING #( keys )
    
    RESULT DATA(ct_read_result)
    
    FAILED DATA(ct_failed)
    
    REPORTED DATA(ct_reported).

    MODIFY syntax

    MODIFY statement is used when we want to perform the change of data in entities. It includes:

    • Create
    • Create by association
    • Update
    • Delete
    • Execute (for Action)

    Short syntax-

    MODIFY ENTITY EntityName
    
    CREATE [FIELDS ( field1 field2 ... ) WITH] | [FROM] it instance_crt
    
    CREATE BY \association_name [FIELDS ( field1 field2 ... ) WITH] | [FROM] it_instance_cba
    
    UPDATE [FIELDS ( field1 field2 ... ) WITH] | [FROM] it_instance_upd
    
    DELETE FROM it_instance_del
    
    EXECUTE action_name FROM it_instance_act
    
    [RESULT et_result_a] [FAILED ct_failed] [MAPPED ct_mapped] [REPORTED ct_reported].

    Long syntax-

    MODIFY ENTITIES OF RootEntityName
    
    ENTITY entity1_name CREATE [FIELDS ( field1 field2 ... ) WITH] | [FROM] it_instance1_crt
    
    CREATE BY \association_name [FIELDS ( field1 field2 ... ) WITH] | [FROM] itinstance1_cba
    
    UPDATE [FIELDS ( field1 field2 ... ) WITH] | [FROM] itinstance1_u
    
    DELETE FROM it_instance1_del
    
    EXECUTE action FROM it_instance1_act
    
    [RESULT et_result]
    
    
    
    
    ENTITY entity2_name
    
    CREATE FROM it_instance2_crt
    
    ...
    
    
    
    
    ENTITY entity3_name
    
    ... [FAILED ct_failed] [MAPPED ct_mapped] [REPORTED ct_reported].

    The long syntax allows clubbing multiple MODIFY operations of entities specified by RootEntity of the business object. We can specify alias names for entities if they are defined in behaviour definition.

    Example

    MODIFY ENTITIES OF /dmo/i_travel_m
    
    ENTITY travel
    
    CREATE FIELDS ( travel_id
    
       agency_id
    
       customer_id
    
       begin_date
    
       end_date
    
       booking_fee
    
       total_price
    
       currency_code
    
       description
    
       overall_status )
    
    WITH lt_create
    
    MAPPED ct_mapped
    
    FAILED ct_failed
    
    REPORTED ct_reported.

     

    COMMIT syntax

    The COMMIT syntax is used along with the MODIFY statement. As MODIFY statement does not change the data at database level, it is required to call COMMIT after MODIFY to persist the database changes.

    The modify statement set the data to transaction buffer and buffer data gets cleared after the ABAP session is closed. That means we need to trigger save sequence to save the data from the transactional buffer to the database. This trigger is called by executing the COMMIT statement. For save sequence methods you can refer to our previous articles.

     

    Simple syntax-

    COMMIT ENTITIES.

     

    Long syntax-

    COMMIT ENTITIES
    
       [RESPONSE OF rootentityname1
    
    [FAILED ct_failed]
    
     [REPORTED ct_reported]]
    
    [RESPONSE OF rootentityname2
    
    [FAILED ct_failed]
    
    [REPORTED ct_reported]].

    Using long syntax we can call COMMIT for multiple entities by explicitly specifying  RootEntity names. Whereas, the simple syntax COMMIT ENTITIES will also work for multiple entities in the same LUW. Here we need to specify the RootEntity name.

  • How to create and deploy UI5 App based upon CAPM using BAS

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

    Introduction

    SAP CAPM is the new and most efficient way to develop SAP Cloud Applications. SAP Business Application Studio is the appropriate IDE that should be used for CAP Application creation. In this article we will explore SAP BAS, CAP Development and CAP Deployment over SAP BTP. Let us explore how to create and deploy UI5 App based upon CAPM using BAS.

    Steps to get started with BAS

    Step 01: The very first step is to visit Business Application Studio using SAP BTP.

    Step 02: Create a Dev Space by clicking the button as shown below:

    Create a Dev Space

    Step 03:  Give a suitable name for your space and choose Full Stack Cloud Application

    Full Stack Cloud Application

    A CAPM space will be created as shown below. Click it.

    CAPM space

    It will open the Business Application Studio Editor (BAS).

    Business Application Studio Editor

    Steps to create a CAPM Project

    1. Click “Start from template” in welcome screen
      Start from template CAP
    2. Select CAP Project and click Start
      CAP Project Start
    3. Provide a name of the project and choose the one shown below:
      CAP Project Configuration
    4. Click Finish. This will generate a project and will open up the same.
    5. In case you get a popover to install recommended extension, click install.

     

    Steps to add Approuter in your CAPM

    The very next thing after CAPM App creation is to add an approuter. You can read more about it here. Follow below steps to create an App Router. You can create both standalone app router as well as SAP Managed App Router (needs additional subscription).

    How to add Standalone Approuter using BAS?

    To add a standalone approuter using BAS, follow the given steps:

    Step 01: Create a MTA or CAPM Application such that your project has a MTA.yaml file (We did this above).

    Step 02: Right click on the MTA file and click “Create MTA Module from Template”

    Open MTA Module from Template

    Step 03: Click “Approuter configuration” from the wizard

    Approuter configuration

    Step 04: Enter the details as shown below:

    App Router Details

    That’s it, an approuter will be added in your project with configuration in MTA file.

    How to add Managed Approuter using BAS?

    The creation of SAP Managed approuter is almost similar to Standalone approuter until step 03.
    In step 04, you need to choose “Managed Approuter” from the drop down, followed by a unique name for the approuter. That’s it, an approuter will be added in your project with configuration in MTA file. Read more about it here.

    Once deployed, you can visit HTML5 Applications under your subaccount. In case you see the given screen:

    Managed Approuter

    In this case you need to subscribe any of the above, then you will be able to see your Applications as shown below:

    HTML5 Applications

    How to add a UI5 project in CAPM

    Once you have a CAPM project with basic module, you will have a folder called app. This folder is meant for UI5 applications. In this use case it is empty. Now we will add MTA modules to create UI5 App.

    Step 01: Create a MTA or CAPM Application such that your project has a MTA.yaml file (We did this above).

    Step 02: Right click on the MTA file and click “Create MTA Module from Template”

    Open MTA Module from Template

    Step 03: Click “SAP Fiori application” from the wizard

    SAP Fiori application

    Step 04: Now, click the filter to choose “SAPUI5 freestyle” (In case you want a Fiori Elements based app, you can keep the first one)

    SAPUI5 freestyle

    Then choose “SAPUI5 Application”:

    SAPUI5 Application

    Step05: Now in next section, either choose your data source if you have or select “None” as below:

    data source for UI5

    Step 06: Now enter the name of the initial view (It can be changed later too):

    View of UI5

    Step 07: This is an important step, choose the folder “app” via project folder path and mark Yes against “Add deployment configuration to MTA project”. This will add all required deployment related configurations in MTA file.
    Deployment configuration of UI5

    Root folder of UI5

    That’s it. Once clicked on Finish will add a UI5 application within app folder.

    Steps to test and deploy whole CAPM project on SAP Cloud foundry (or SAP BTP)

    1. Open Terminal from the menu bar
    2. To test the App locally, write cds watch. You will see a pop up, press “Expose and Open”. You will see a new tab:
      local test of App in CAP
    3. Click on Web Applications link. It will open a blank UI5 App as shown below:
      local run ui5 app in BAS
      This confirms that the UI5 app is working fine.
      If you click the services endpoints link, then you will see an OData as shown below:
      Service in CAP
      This confirms even our services are working fine. This is a green signal for deployment.
    4. Now open a new terminal and write mbt build. This will generate a new folder “mta_archives” with a mtar file
      The above step will also generate new folders
      MTAR generation CAP
    5. Before we deploy to SAP Cloud foundry, we have to login in our environment. In terminal write cf login
      Enter API endpoint: https://api.cf.eu10.hana.ondemand.com/ (or whatever it is for you)
      followed by your login email and password
      You will be logged into your respective environment. In case you have multiple subaccount, then you might be asked to choose one of them (using a number)
    6. Now right click on the mtar file generated and click “Deploy MTA Archive”
      SAP CAP Deployment in BAS

    This will deploy the app in cloud foundry or SAP BTP. In the terminal you will get successful message that all the services were deployed.

    1. To test the deployed UI5 App, go to SAP BTP and reach your respective subaccount -> space. Here list of applications will appear, search for your approuter.
      Run UI5 using App Router
      Open it. You will find a link. You can even find it within the terminal after deployment, e.g.:
    2. Opening only App Router will give error “Not Found”. So, append your approuter as mentioned below:
      Extend the URL with the application ID “/<app ID>”:
      https://ps-scp-<space name>-mta-<app name>-approuter.cfapps.<region>.hana.ondemand.com/<app ID>Note! If the “<app ID>” contains dots e.g. “<app ID>” is “test2.test.1.test0”, dots should be ingnored and the URL should look as:https://ps-scp-<space name>-mta-<app name>-approuter.cfapps.<region>.hana.ondemand.com/test2test1test0

    In our use case the url will be: <app router>/nscap-test/index.html

    1. After login, you will see the below link:
      UI5 deployed App test

    Congratulations, you have successfully created your CAPM UI5 App and deployed the same. You can also check other ways to create a UI5 CAPM App.

  • AppRouter in SAP BTP

    Preface – This post is part of the SAP Multi-Target Application (MTA)  series.

    Introduction

    In the era of cloud applications, a single project has multiple UI5 applications and multiple microservices. In this use case either we can have individual urls to access these or a single url that can act as an entry point. An approuter helps developers to get a single url to access all their apps and microservices. In this article we will learn more about AppRouter in SAP.

    What is App Router in SAP?

    SAP Cloud Foundry provides a nodeJs library in the form of BTP instance that acts as a single point-of-entry for an application or microservice running in the Cloud Foundry. It is known as Application Router or App Router or AppRouter.

    We can perform following operations using App Router:

    • Serve static data: The index.html file within App Router can be used to display static content or welcome page of an application
    • Authenticate users: A user can be authenticated at approuter level, even before accessing any application
    • Rewrite URLs: It can be used to integrate destination, integrate business services and even perform logout for an application
    • Request to other microservices within same project

    Types of App Router in SAP

    SAP provides two types of approuter, they are:

    1.      Standalone Approuter

    A standalone approuter is a custom approuter that is created and maintained by developer. A developer has to update the xs-app.json and MTA.yaml files according to the project needs.

    2.      SAP Managed Approuter

    A SAP Managed Approuter enables a developer to execute HTML5 applications in SAP Cloud Platform. It is completely managed by SAP, hence you are not required to update any details further, once created.
    To use managed application router, SAP provides three options:

    • SAP Work Zone
    • SAP Launchpad service
    • SAP Cloud Portal

    Once the application is deployed, the apps are available under the tab HTML5Repository within sub-account.

    How to add Standalone Approuter using BAS?

    To add a standalone approuter using BAS, follow the given steps:

    Step 01: Create a MTA or CAPM Application such that your project has a MTA.yaml file.

    Step 02: Right click on the MTA file and click “Open MTA Module from Template”

    Open MTA Module from Template

    Step 03: Click “Approuter configuration” from the wizard

    Approuter configuration

    Step 04: Enter the details as shown below:

    App Router Details

    That’s it, an approuter will be added in your project with configuration in MTA file. Read more about it here.

    How to add Managed Approuter using BAS?

    The creation of SAP Managed approuter is almost similar to Standalone approuter until step 03.
    In step 04, you need to choose “Managed Approuter” from the drop down, followed by a unique name for the approuter. That’s it, an approuter will be added in your project with configuration in MTA file. Read more about it here.

    Once deployed, you can visit HTML5 Applications under your subaccount. In case you see the given screen:

    Managed Approuter

    In this case you need to subscribe any of the above, then you will be able to see your Applications as shown below:

    HTML5 Applications

  • How to create and deploy CAPM using BAS Extensions

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

    Introduction

    SAP CAPM is the new and most efficient way to develop SAP Cloud Applications. SAP Business Application Studio is the appropriate IDE that should be used for CAP Application creation. In this article we will explore SAP BAS, CAP Development and CAP Deployment over SAP BTP. Let us explore how to create and deploy CAPM using BAS Extensions.

    Steps to get started with BAS

    Step 01: The very first step is to visit Business Application Studio using SAP BTP.

    Step 02: Create a Dev Space by clicking the button as shown below:

    Create a Dev Space

    Step 03:  Give a suitable name for your space and choose Full Stack Cloud Application

    Full Stack Cloud Application

    A CAPM space will be created as shown below. Click it.

    CAPM space

    It will open the Business Application Studio Editor (BAS).

    Business Application Studio Editor

    Extensions in BAS

    In this article we will learn how to use Extensions in BAS for application creation.

    1. Click on View -> Find command
      Find Command in BAS
    2. Search “Generators” and click on “Explore and Install Generators”
      Explore and Install Generators in CAP
    3. From the search shortcut, filter SAP UI5 and install “generator-sap-ui5-app”, “generator-easy-ui5” and “generator-ui5_to_mta” and other UI5/Fiori extensions.
      UI5 Generators in CAP

    The above will be helpful in creating UI5 projects and auto generate codes for us.

    Steps to create a CAPM Project

    1. Click “Start from template” in welcome screen
      Start from template CAP
    2. Select CAP Project and click Start
      CAP Project Start
    3. Provide a name of the project and choose the one shown below:
      CAP Project Configuration
    4. Click Finish. This will generate a project and will open up the same.
    5. In case you get a popover to install recommended extension, click install.

    How to add a UI5 project in CAPM using Extension

    The newly created CAP project will have empty app folder as shown below:

    CAP Project Structure

    1. Open View-> Find command (or ctrl+shift+P)
    2. Find “Run Generator”
      Run Generator in BAS
    3. Now find “fiori-module:app”. This will only appear if you install all the extensions that we have mentioned above.
      fiori module in BAS
    4. This will open a wizard. Choose the App folder and click Next
      UI5 wizard in BAS
    5. Enter Module name, it will be the name of your UI5 App, and click Next
      ui5 module in BAS
    6. Choose SAPUI5 Application and click Next
      UI5 template in BAS
    7. Choose the App Router
      App Router Configuration in BAS
    8. Choose Authentication option.
      Authentication for CAPM
    9. Choose View name
      View in UI5
    10. Now, you will see both UI5 and App router is generated
      UI5 app router cap

    Even in MTA you can see these added:
    cap-test-approuter
    cap-test_html_repo_runtime
    cap-test_ui_deployer
    ui5-test

    With all other important files that are mandatory for UI5 module deployment over BTP. Now we are ready to test it locally and deploy it over BTP.

    Steps to test and deploy whole CAPM project on SAP Cloud foundry (or SAP BTP)

    1. Open Terminal from the menu bar
    2. To test the App locally, write cds watch. You will see a pop up, press “Expose and Open”. You will see a new tab:
      local test of App in CAP
    3. Click on Web Applications link. It will open a blank UI5 App as shown below:
      local run ui5 app in BAS
      This confirms that the UI5 app is working fine.
      If you click the services endpoints link, then you will see an OData as shown below:
      Service in CAP
      This confirms even our services are working fine. This is a green signal for deployment.
    4. Now open a new terminal and write mbt build. This will generate a new folder “mta_archives” with a mtar file
      The above step will also generate new folders

    MTAR generation CAP

    1. Before we deploy to SAP Cloud foundry, we have to login in our environment. In terminal write cf login
      Enter API endpoint: https://api.cf.eu10.hana.ondemand.com/ (or whatever it is for you)
      followed by your login email and password
      You will be logged into your respective environment. In case you have multiple subaccount, then you might be asked to choose one of them (using a number)
    2. Now right click on the mtar file generated and click “Deploy MTA Archive”

    SAP CAP Deployment in BAS

    This will deploy the app in cloud foundry or SAP BTP. In the terminal you will get successful message that all the services were deployed.

    1. To test the deployed UI5 App, go to SAP BTP and reach your respective subaccount -> space. Here list of applications will appear, search for your approuter.Open it. You will find a link. You can even find it within the terminal after deployment, e.g.:
      Run UI5 using App Router
    2. Opening only App Router will give error “Not Found”. So, append your approuter as mentioned below:
      Extend the URL with the application ID “/<app ID>”:
      https://ps-scp-<space name>-mta-<app name>-approuter.cfapps.<region>.hana.ondemand.com/<app ID>Note! If the “<app ID>” contains dots e.g. “<app ID>” is “test2.test.1.test0”, dots should be ingnored and the URL should look as:https://ps-scp-<space name>-mta-<app name>-approuter.cfapps.<region>.hana.ondemand.com/test2test1test0

    In our use case the url will be: <app router>/nscap-test/index.html

    1. After login, you will see the below link:
      UI5 deployed App test

    Congratulations, you have successfully created your CAPM UI5 App and deployed the same. You can also check other ways to create a UI5 CAPM App.