|
Overview
Step-by-step guide to get started rapidly with S10 development. The goal is a simple S10 application to display information about an entered material number: ![]() As a starting point, we generate an application with the S10 utilities, which is then extended: ![]() The Quickstart Guide is divided into the following steps:
|
Requirements
|
|
Step 1: Generating an S10 application based on table MARA
First start the transaction /S10/UTIL and select the tab "Generate transaction". Since we want to display material master data, we specify the MARA table, select the "Display" transaction type and in this example only select the material number in the fields. Since we want to automatically display the description in addition to the material number, we select the entry in the "Text" column. ![]() The "Save and generate" button now saves all application parts into the previously specified directory and generates the ABAP program. To test the application, it must first be transferred to the SAP MIME Repository. Local development and testing is also possible and is described in more detail in the chapter "Local development". You can transfer entire directory structures with the SAP program "BSP_UPDATE_MIMEREPOS" (transaction SE38): ![]() You can now test the application once by entering the related address in the browser. If everything is configured correctly, the initial screen of the generated application should appear: ![]() |
|
Step 2: Customize the configuration of the application and the login screen
The S10 framework takes care of the logon to the SAP system, but needs some information to do so. In this example the user specifies his user name as well as password, the remaining parameters are specified directly in the coding of the HTML page, e.g. the client. The HTML page for the login is always located in the following place in the MIME Repository and must be adapted there: Name of S10 application/classes/user/views.xy (where xy stands for the language key of the login language, e.g. views.de for German): ![]() Right-click the file in the MIME Repository to modify or download the file. In principle, you can change and design the page as you like. The S10 generation tool adds an entry in the dropdown list for each generated table, the value is then also the called ABAP program name. You can later combine the individual parts into a single application and specify a fixed program name. Customize the parameters in the JavaScript method "dologon", for details see the documentation for "S10Logon()": JavaScript
|
|
Step 3: Extending the HTML views of the generated application
The generation tool has generated a ready-to-run application that provides a material selection as well as associated detail view. Usually, however, you want to display additional fields that are not necessarily contained directly in the specified table. Although the generation tool also supports views or CDS views, we can also add the necessary fields ourselves and get the data ourselves in an ABAP method. In this example we want to display the price of the material. In addition, we want to show the current client in the title bar. We first expand the header area, this is located in the generated view "mara_manger.start.html": ![]() HTML
So we have inserted two S10 fields that are linked to an ABAP class via name=: mandt and mtext. We do the same with the material detail view (mara_manager.displayhead.html) and add three more fields here: HTML
We use a custom object "mymara", which is defined in the ABAP class. So the fields belong to this class, not to the active application class. We can let the S10 Framework determine the label of the field "price" automatically by the suffix @label. |
|
Step 4: Extending the ABAP classes of the generated application
In order to populate the fields specified in the HTML view with data, these must be defined in the associated ABAP class and the data must be read if this is not done automatically by the S10 framework (e.g. for @label or @text statements). We therefore first extend the class "mara_manager" by the fields mandt and mtext, which are to display the current client as well as description in the title line: ABAP
We can now read the data in a method that is called when the application is started: ABAP
However, this ensures that a database query is performed every time the start screen is called. It is therefore better to use a build method so that data is not read unnecessarily often or only if it is actually to be displayed by the front end. The corresponding S10 mechanism is described in more detail in the documentation under "build-methods". However, we will do this for the additionally inserted fields of the material. First we declare the new fields, additionally defining a link between the price and the associated unit by the field "unit_price". This enables the S10 framework to format the field according to the unit, details are described in the documentation under "s10getuservalue()": ABAP
The method "build_price" has the material number (MATNR) as importing parameter, which means that it is called as soon as the material number changes and is implemented as follows: ABAP
|
|
Component S10 Framework |