DATA(lv_matnr) = VALUE matnr( 0000000001 ).
DATA(character_string) = VALUE string( ).
character_string = |Your Material Number is { lv_matnr ALPHA = IN }|. "Adds leading zeros
character_string = |Your Material Number is { lv_matnr ALPHA = OUT }|. "Removes leading zeros
These are my notes on the steps needed to create the data model and publish it as oData service.
#
Layer
Nomenclature
Description
1
Database Table
ZTABLE
Place your raw data first
2
Data Definition (Interface View)
ZI_
Relation between different tables (e.g. currency or text table)
3
Projection View (Consumption View)
ZC_
Configure the UI depending on your scenario. Use different projection views for different usages of the same interface view and the same physical table.
4
Service Definition
ZSD_
Expose the projection view (and underlying associations like currency, country…) as service
5
Service Binding
ZSB_
How to we want to make the service available? Defines the binding type (OData V2 / OData V4) Activate it with the “Activate” Button within the editor window. Select the Entity and hit “Preview…” to see whtat we defined in our projection view.
If you’ve done this, you are able to view the data in a generated Fiori Elements app. But if you also want to create, edit, delete data, you’ll have to add some behavior functionality.
6
Behavior Definition on Data Definition
ZI_
Created on top of the Data Definition. Will get the same name es the Data Definition. Implementation Type: Managed Defines the operations create, delete, edit.
7
Behavior Implementation on Definition View
ZBP_I_
The code for the behavior… For the travel app tutorial, some logic for a generated unique key and field validation. The class inherits from cl_abap_behavior_handler.
8
Behavior Definition on Projection View
ZC_
Created on top of the Projection View. Will get the same name es the Projection View. Defines the operations create, delete, edit.
DATA: BEGIN OF i0008,
lgart LIKE p0008-lga01,
betrg LIKE p0008-bet01,
anzhl LIKE p0008-anz01,
eitxt LIKE p0008-ein01,
opken LIKE p0008-opk01,
indbw LIKE p0008-ind01,
END OF i0008.
rp-provide-from-last p0008 space pn-begda pn-endda.
DO 40 TIMES
VARYING i0008-lgart FROM p0008-lga01 NEXT p0008-lga02
VARYING i0008-betrg FROM p0008-bet01 NEXT p0008-bet02
VARYING i0008-anzhl FROM p0008-anz01 NEXT p0008-anz02
VARYING i0008-eitxt FROM p0008-ein01 NEXT p0008-ein02
VARYING i0008-opken FROM p0008-opk01 NEXT p0008-opk02
VARYING i0008-indbw FROM p0008-ind01 NEXT p0008-ind02.
IF i0008-lgart = '2001'.
EXIT.
ENDIF.
ENDDO.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-b01.
* Schnittstelle
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: p_server RADIOBUTTON GROUP rad1.
SELECTION-SCREEN COMMENT 6(26) text-t01 FOR FIELD p_server.
PARAMETERS: p_sname(8) TYPE c DEFAULT ''.
SELECTION-SCREEN END OF LINE.
* Filename (optional)
PARAMETERS: p_fname TYPE j_3sdsn.
* Lokale Datei
PARAMETERS: p_local RADIOBUTTON GROUP rad1 DEFAULT 'X'.
* Dateiauswahl
PARAMETERS: p_up TYPE dxfile-filename DEFAULT ''.
SELECTION-SCREEN END OF BLOCK b1.