Skip to content

Update README.md markdown #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions rap6xx/rap620/exercises/ex2/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# TOC
[Home](../../readme.md#exercises)
# Adapt the generated code

# Exercise 2: Adapt the generated code
## Introduction
In this exercise we will perform changes to the generated code so that our application becomes usable.

- _Projection view_:
- [_Projection view_](#projection-view):
Here we will add value help definitions for the currency code and quantity units.

- _Metadata extension file_:
- [_Metadata extension file_](#metadata-extension-file):
Since we use built-in ABAP data types rather than data elements we have to add UI annotations to provide a label for the columns in the list view and the fields in the object page.

- _Behavior Definition_ and _Behavior Implementation_:
- [_Behavior Definition_](#behavior-definition) and [_Behavior Implementation_](#behavior-implementation):
Here we will make the semantic key field **InventoryID** _read_only_ and we will add a determination to the behavior definition and implement the same in the behavior implementation clas so that the semantic key field **InventoryID** will be filled automatically.

## Projection view
[^Top of page](#toc)

In the source code of the projection view ````ZRAP620_C_INVENTORYTP_### ```` we will add two value help definitions for the fields ````QuantityUnit```` and ````CurrencyCode````.

Expand Down Expand Up @@ -58,6 +59,7 @@ define root view entity ZRAP620_C_INVENTORYTP_###
</details>

## Metadata extension file
[^Top of page](#toc)

Open the metadata extension file ````ZRAP620_C_INVENTORYTP_### ````. Replace the complete source code with the following code snippet and use search and replace to change the placeholder ````###````.

Expand Down Expand Up @@ -207,6 +209,7 @@ annotate view ZRAP620_C_INVENTORYTP_### with
</details>

## Behavior definition
[^Top of page](#toc)

Open the behavior defintion ````ZRAP620_R_INVENTORYTP_### ```` and add the field **InventoryID** to the list of fields that are marked as readonly and add a determination **CalculateInventoryID** for the field **InventoryID**.

Expand Down Expand Up @@ -262,6 +265,7 @@ determination CalculateInventoryID on save { create; }
</details>

## Behavior implementation
[^Top of page](#toc)

The behavior implementation class ````ZRAP620_BP_INVENTORYTP_###```` is automatically opened with the tab **Local Types** for the local handler class ````lcl_handler```` .
The quick fix has added a method ````CalculateInventoryID```` with an (empty) implementation for the determination that shall calculate the semantic key InventoryID.
Expand Down Expand Up @@ -323,7 +327,8 @@ ENDMETHOD.
</details>

# Test your changes

[^Top of page](#toc)

After having performed all the changes mentioned above we can use the SAP Fiori Elements preview in ADT to test our updated implementation.

<details>
Expand Down
34 changes: 17 additions & 17 deletions rap6xx/rap620/exercises/ex3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ In this exercise, you will ...

- [Create a custom entity and implement the query implementation class](#create-a-custom-entity-and-implement-the-query-implementation-class)
- [Create a custom entity](#create-a-custom-entity)
- [Implement the query implemenation class](#implement-the-query-implemenation-class-zrap260ceproducts)
- [Implement the query implementation class](#implement-the-query-implemenation-class-zrap620_ce_products)

- [Add the custom entity as a value help](#add-the-custom-entity-as-a-value-help)
- [Test the service](#test-the-service)
Expand All @@ -39,7 +39,7 @@ In our demo we will thus use an OData Service that is available in the SAP Gatew


## Create the Service Consumption Model
[^Top of page](#)
[^Top of page](#toc)

In this step we will generate a so called **Service Consumption Model**. This type of object takes an external interface description as its input. Currently *OData*, *SOAP* and *RFC* are supported.
Based on the information found in the *$metadata* file or the *wsdl* file appropriate repository objects are generated (OData Client proxy or SOAP proxy objects). For RFC function modules the metadata file is created in the backend using the transaction *ACO_PROXY*.
Expand Down Expand Up @@ -138,7 +138,7 @@ Click **Next**.
</details>

## Create a console application to test the OData service
[^Top of page](#)
[^Top of page](#toc)

We can now test the service consumption model by creating a small console application ````ZRAP620_CL_CE_PRODUCTS_###```` that implements the interface ````if_oo_adt_classrun````.
This is a useful additional step since this way it is easier to check whether the OData consumption works and debugging a console application is much easier than trying out your coding in the full fledged RAP business object.
Expand Down Expand Up @@ -185,7 +185,7 @@ This is a useful additional step since this way it is easier to check whether th
![Selection of transport request](images/console_app_0040.png)

## CLASS ZRAP620_CL_CE_PRODUCTS_### - Implementation
[^Top of page](#)
[^Top of page](#toc)

1. Let's start with the implementation of our test class.

Expand Down Expand Up @@ -340,7 +340,7 @@ ENDCLASS.
</details>

## Create a custom entity and implement the query implementation class
[^Top of page](#)
[^Top of page](#toc)

Since we want to use the results of the remote OData service in our managed inventory app we will create a custom entity.
The syntax of a custom entity differs from the one used in normal CDS views but is very similar to the syntax of an abstract entity and we can thus reuse most of the DDL source code of the abstract entity that has been generated when the service consumption model was created.
Expand All @@ -350,12 +350,12 @@ In order to leverage the remote OData service in our application we have to perf
1. We have to create a custom entity.
2. We have to create a class that implements the query for the custom entity. (Here we will reuse the class that we have created earlier and that we have used to test the remote OData service).

### Create a custom entity
[^Top of page](#toc)

<details>
<summary>Click to expand</summary>

### Create a custom entity
[^Top of page](#)

In contrast to "normal" CDS views that read data from the database from tables or other CDS views _custom entities_ act as a wrapper for a code based implementation that provides the data instead of a database table or a CDS view.

The custom entity has to be created manually and it uses a similar syntax as the abstract entity that has been created when we have created our service consumption model.
Expand All @@ -371,7 +371,7 @@ Let’s start with creating a new data definition ````ZRAP620_CE_PRODUCTS_###```
![New data definition 1](images/custom_entity_0000.png)

2. The **New Data Defintion** dialogue opens. Here you have to enter the following values:
- Name: **`ZRAP260_CE_PRODUCTS_###`**
- Name: **`ZRAP620_CE_PRODUCTS_###`**
- Description: **`Custom entity for products from ES5`**

Press **Next**
Expand Down Expand Up @@ -423,16 +423,16 @@ define custom entity ZRAP620_CE_PRODUCTS_###

</pre>

[Source code ZRAP260_CE_PRODUCTS_###](sources/ex2_DDLS_ZCE_RAP_PRODUCTS_%23%23%23%23.txt)
[Source code ZRAP620_CE_PRODUCTS_###](sources/ex2_DDLS_ZCE_RAP_PRODUCTS_%23%23%23%23.txt)

7. Activate your changes ![Activate](images/activate.png)

> You might get the warning that the class ` ZRAP260_CE_PRODUCTS_###` is not found. This is because our class does not yet implement the interface `IF_RAP_QUERY_PROVIDER`.
> You might get the warning that the class ` ZRAP620_CE_PRODUCTS_###` is not found. This is because our class does not yet implement the interface `IF_RAP_QUERY_PROVIDER`.

</details>

### Implement the query implemenation class ZRAP260_CE_PRODUCTS_###
[^Top of page](#)
### Implement the query implemenation class ZRAP620_CE_PRODUCTS
[^Top of page](#toc)

After having created the custom entity `ZRAP620_CE_PRODUCTS_###` we now have to enhance the query implementation class `ZRAP620_CL_CE_PRODUCTS_###` that we have created earlier in this exercise.

Expand Down Expand Up @@ -519,7 +519,7 @@ We now have to add the custom entity to the service definition of our inventory
</details>

## Add the custom entity as a value help
[^Top of page](#)
[^Top of page](#toc)

The custom entity can now be added as a value help.

Expand All @@ -541,7 +541,7 @@ This will add the custom entity `ZRAP620_CE_PRODUCTS_###` as a value help for th
</details>

## Test the service
[^Top of page](#)
[^Top of page](#toc)

We can now test our service implementation.

Expand Down Expand Up @@ -579,7 +579,7 @@ We can now test our service implementation.
![Product selected in object page](images/preview_service_0020.png)

## Test input Validation on the front end
[^Top of page](#)
[^Top of page](#toc)

1. Edit the newly created inventory entry

Expand All @@ -601,7 +601,7 @@ We can now test our service implementation.
</details>

## Summary
[^Top of page](#)
[^Top of page](#toc)

You are now able to:

Expand Down
7 changes: 2 additions & 5 deletions rap6xx/rap620/exercises/ex4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ We will use the SOAP web service to retrieve the price of a product.

> **Do not forget to search and replace the placeholder `###` with the unique number that you have chosen beforehand.**

<pre>

```abap
METHOD GetPrice.
DATA destination TYPE REF TO if_soap_destination.
DATA proxy TYPE REF TO zrap620###co_epm_product_soap.
Expand Down Expand Up @@ -218,9 +217,7 @@ We will use the SOAP web service to retrieve the price of a product.
ENDLOOP.

ENDMETHOD.


</pre>
```

3. Activate your changes.

Expand Down