Development Information Document Version: 1.0 2015-11-30
Typographic Conventions Type Style Example Description Words or characters quoted from the screen. These include field names, screen titles, pushbuttons labels, menu names, menu paths, and menu options. Textual cross-references to other documents. Example EXAMPLE Example Example <Example> EXAMPLE Emphasized words or expressions. Technical names of system objects. These include report names, program names, transaction codes, table names, and key concepts of a programming language when they are surrounded by body text, for example, SELECT and INCLUDE. Output on the screen. This includes file and directory names and their paths, messages, names of variables and parameters, source text, and names of installation, upgrade and database tools. Exact user entry. These are words or characters that you enter in the system exactly as they appear in the documentation. Variable user entry. Angle brackets indicate that you replace these words and characters with appropriate entries to make entries in the system. Keys on the keyboard, for example, F2 or ENTER. 2 2015 SAP SE or an SAP affiliate company. All rights reserved. Typographic Conventions
Document History Version Date Change 1.0 2015-11-30 First publication Document History 2015 SAP SE or an SAP affiliate company. All rights reserved. 3
Contents 1 Introduction... 5 2 IF, ELSEIF, ELSE, ENDIF... 6 3 References... 8 Important Disclaimers and Legal Information... 9 4 2015 SAP SE or an SAP affiliate company. All rights reserved. Contents
1 Introduction This document gives you an overview and explanations of basic ABAP statements that are available for key users in the web-based editor that is included in the Custom Fields and Logic app. Note This document is being updated regularly. The purpose of this document is to provide key users with additional information on ABAP development. Changes to the document are documented in section Document History. Target Group Business experts working with the SAP Fiori app Custom Fields and Logic Implementation consultants working with the SAP Fiori app Custom Fields and Logic Prerequisites You can use the web-based ABAP Editor for key users in the Custom Fields and Logic application with the following releases: SAP S/4HANA, cloud edition 1506 and higher SAP S/4HANA, on-premise edition 1511 Authorizations Cloud environment Your user is assigned to the SAP Fiori business catalog SAP_BCR_CORE_EXT. On-premise environment Your user is assigned to a role that contains the authorizations taken from the following template roles: o SAP_NW_APS_EXT_CFD o SAP_NW_APS_EXT_CFL_APP Knowledge Basic knowledge of ABAP statements Introduction 2015 SAP SE or an SAP affiliate company. All rights reserved. 5
2 Basics The sections of this chapter make you familiar with the basic ABAP statements that you can use in the web-based editor of the SAP Fiori app Custom Fields and Logic. 2.1 IF, ELSEIF, ELSE, ENDIF Syntax Syntax IF log_exp1. [statement_block1] [ELSEIF log_exp2. [statement_block2]]... [ELSE. [statement_blockn]] ENDIF. These statements define a control structure which can contain multiple statement blocks statement_block of which a maximum of one is executed in conjunction with logical expressions log_exp. After IF and ELSEIF, any logical expression log_exp can be executed while the expressions statement_block represent any statement block. The logical expressions, beginning with the IF statement, are checked from top to bottom and the statement block is executed after the first true logical expression. If none of the logical expressions are true, the statement block after the ELSE statement is executed. Example Sample Code " Example: Retrieving and formatting the current time " " We need to resort to GET TIME STAMP FIELD var and " extract the time from the timestamp. DATA current_time TYPE timestamp. DATA timezone TYPE timezone. DATA time TYPE t. DATA result TYPE string. " Get the current date and time as a timestamp (with seconds accuracy) 6 2015 SAP SE or an SAP affiliate company. All rights reserved. Basics
GET TIME STAMP FIELD current_time. " Extract the time part from the timestamp. " timezone is initial (empty), which means the time will be returned in the default timezone, UTC. CONVERT TIME STAMP current_time TIME ZONE timezone INTO TIME time. " Convert time to the 12-hour format IF time < '120000'. result = { time TIME = ISO } AM. ELSEIF time > '120000' AND time < '240000'. result = { CONV t( time - 12 * 3600 ) TIME = ISO } PM. ELSE. result = High Noon. ENDIF. " result => 10:35:08 AM Basics 2015 SAP SE or an SAP affiliate company. All rights reserved. 7
3 References Information about extensibility for key users S/4HANA, on-premise edition 1511: http://help.sap.com/s4hana_op_1511 SAP NetWeaver for SAP S/4HANA, on-premise edition General Functions for Key Users SAP Fiori Applications Extensibility. S/4HANA, cloud edition 1511: Extensibility for Key Users 8 2015 SAP SE or an SAP affiliate company. All rights reserved. References
Important Disclaimers and Legal Information Coding Samples Any software coding and/or code lines / strings ("Code") included in this documentation are only examples and are not intended to be used in a productive system environment. The Code is only intended to better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, unless damages were caused by SAP intentionally or by SAP's gross negligence. Accessibility The information contained in the SAP documentation represents SAP's current view of accessibility criteria as of the date of publication; it is in no way intended to be a binding guideline on how to ensure accessibility of software products. SAP in particular disclaims any liability in relation to this document. This disclaimer, however, does not apply in cases of wilful misconduct or gross negligence of SAP. Furthermore, this document does not result in any direct or indirect contractual obligations of SAP. Gender-Neutral Language As far as possible, SAP documentation is gender neutral. Depending on the context, the reader is addressed directly with "you", or a gender-neutral noun (such as "sales person" or "working days") is used. If when referring to members of both sexes, however, the third-person singular cannot be avoided or a gender-neutral noun does not exist, SAP reserves the right to use the masculine form of the noun and pronoun. This is to ensure that the documentation remains comprehensible. Internet Hyperlinks The SAP documentation may contain hyperlinks to the Internet. These hyperlinks are intended to serve as a hint about where to find related information. SAP does not warrant the availability and correctness of this related information or the ability of this information to serve a particular purpose. SAP shall not be liable for any damages caused by the use of related information unless damages have been caused by SAP's gross negligence or willful misconduct. All links are categorized for transparency (see: http://help.sap.com/disclaimer). Important Disclaimers and Legal Information 2015 SAP SE or an SAP affiliate company. All rights reserved. 9
www.sap.com/contactsap 2015 SAP SE or an SAP affiliate company. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company. SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. All other product and service names mentioned are the trademarks of their respective companies. Please see http://www. sap.com/corporate-en/legal/copyright/index.epx#trademark for additional trademark information and notices. Material Number: