abap integration guide

12
PUBLIC SAP Data Hub 2.7 Document Version: 2.7.7 – 2021-Apr-14 ABAP Integration Guide © 2021 SAP SE or an SAP affiliate company. All rights reserved. THE BEST RUN

Upload: others

Post on 18-Jan-2022

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ABAP Integration Guide

PUBLICSAP Data Hub 2.7Document Version: 2.7.7 – 2021-Apr-14

ABAP Integration Guide

© 2

021 S

AP S

E or

an

SAP affi

liate

com

pany

. All r

ight

s re

serv

ed.

THE BEST RUN

Page 2: ABAP Integration Guide

Content

1 User Guide for ABAP Integration in SAP Data Hub . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31.1 Use Cases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.2 Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Creating a Custom ABAP Operator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2 PUBLICABAP Integration Guide

Content

Page 3: ABAP Integration Guide

1 User Guide for ABAP Integration in SAP Data Hub

The User Guide for ABAP Integration contains information related to interaction scenarios between SAP Data Hub and an ABAP-based SAP system (directional and bi-directional).

Introduction

ABAP integration is a unified model to consolidate all interaction scenarios between SAP Data Hub and an ABAP-based SAP system (directional and bi-directional). This guide compiles information you need to work with ABAP integration and provides links to further related information.

Use Cases

The main use cases are:

● Provide ABAP metadata to the SAP Data Hub Metadata Explorer.● ABAP data provisioning to transfer data into SAP Data Hub.● ABAP functional execution that is triggerable as an operator in SAP Data Hub.

Important SAP Notes

● Security: For an up-to-date overview of security-related topics related to ABAP Integration, see SAP Note 2831756 .

● Connections: For general information about connections, see Using SAP Data Hub Connection Management. For detailed information about the specific connection type for ABAP Integration, see SAP Note 2835207 .

● Installation: What exactly you need to do to install and set up the ABAP integration features depends on the system landscape and release levels you want to work with:○ If the SAP system that you want to use is on SAP S/4HANA 1909 or higher, consider the information

provided in SAP Note 2830276 .○ For older SAP ERP systems (in combination with DMIS 2011 SP17 / DMIS 2018 SP02), consider the

information provided in SAP Note 2814951 .

ABAP Integration GuideUser Guide for ABAP Integration in SAP Data Hub PUBLIC 3

Page 4: ABAP Integration Guide

Related Information

Use Cases [page 4]Operators [page 5]

1.1 Use Cases

The primary use cases for ABAP integration in SAP Data Hub are metadata, data provisioning, and functional execution.

ABAP Metadata

SAP Data Hub comes with comprehensive features for discovering, managing, adjusting, and cleansing metadata from different sources. All metadata can be managed in the Metadata Explorer. In the past, however, this functionality did not cover data from ABAP-based SAP systems. Now all metadata from business systems (such as SAP S/4HANA) as well as older systems (such as SAP ERP) can be made available to the Metadata Explorer, enabling users to get insights into this data as well.

ABAP Data Provisioning

Getting access to and using real business data in an SAP Data Hub pipeline helps you to build new intelligent applications and data flows. For example, you may want to obtain the replication data from an SAP S/4HANA system, enrich the data in an SAP Data Hub pipeline, and then feed it to a file storage in the cloud.

The ABAP data provisioning gives you access to SAP S/4HANA and allows you to consume ABAP CDS views directly in a pipeline. ABAP CDS is the semantically rich data model in SAP S/4 HANA and allows the consistent representation of a business object (such as a business partner). It is possible to just get this data in an initial load, but also to have a stream approach established to consume every update, insert, and delete that happens in the SAP S/4HANA system. For details about what options you have with the different release levels and release combinations, see SAP Note 2830276 .

For older releases, there is a table-based replication approach available to consume the data within a pipeline. To get access even to releases lower than a NetWeaver 7.00 system, the SAP LT Replication Server can be

4 PUBLICABAP Integration Guide

User Guide for ABAP Integration in SAP Data Hub

Page 5: ABAP Integration Guide

connected and feeds data in real time into SAP Data Hub. Existing SAP LT Replication Server deployments can be reused to lower the impact and footprint of an additional system.

ABAP Functional Execution

In certain scenarios, it is required to enhance the scope of a data-driven application by accessing and writing data into an SAP S/4HANA system. For example, it may be necessary to execute a function module or BAPI within a pipeline to read data into SAP Data Hub, post information into an ABAP-based SAP system, or trigger an execution in the remote system. If you require this type, you can now create your own operator in SAP Data Hub that references the corresponding ABAP functionality. You can find a list of all available operators in the ABAP section of the Repository Object Reference for SAP Data Hub.

1.2 Operators

SAP Data Hub comes with a set of predefined ABAP operators that you can use directly in the modeler to build intelligent data pipelines, but you can also create your own custom ABAP operators.

Note that the implementations of the operators lie in their own repository (called ABAP pipeline engine) in the ABAP-based SAP system.

The modeler in SAP Data Hub contains a shell for each actual implementation of an ABAP operator in the ABAP-based SAP system. In order to retrieve the implementation from the ABAP-based SAP system, you need to provide an RFC connection.

As of SAP S/4HANA 1909 and SAP S/4HANA CE 1911, the ABAP pipeline engine is included in the standard shipment. For older releases (NetWeaver 7.0 or higher), you need to install the DMIS Add-on (DMIS 2018 SP02 and higher or DMIS 2011 SP17 and higher) to get the ABAP pipeline engine.

ABAP Integration GuideUser Guide for ABAP Integration in SAP Data Hub PUBLIC 5

Page 6: ABAP Integration Guide

Predefined Operators

You can find a list of all available predefined operators in the ABAP section of the Repository Object Reference for SAP Data Hub.

Custom Operators

You can also create your own custom ABAP operators. You can use a custom ABAP operator to execute any kind of code in your ABAP-based remote system. Custom ABAP operators can be developed in the ABAP-based SAP system as development objects and can be transported within the system landscape.

Related Information

Creating a Custom ABAP Operator [page 6]

1.2.1 Creating a Custom ABAP Operator

This text describes the steps you need to perform in your ABAP-based SAP system to implement your own custom ABAP operator.

Context

NoteThis text is about how to create a custom ABAP operator in the ABAP-based SAP system. For information about using a pre-defined operator as a basis for creating custom operators, see Creating Operators.

You create custom ABAP operators in the ABAP-based SAP system by implementing a BAdI called BADI_DHAPE_ENGINE_OPERATOR. For each BAdI implementation, a filter must be defined that matches the name of the operator (example: com.sap.abap.pass).

The BAdI implementation consists of a class with two methods that must be redefined. The BAdI implementation should extend the abstract class cl_dhape_graph_oper_abstract.

● GET_INFO: Returns metadata about the operator● NEW_PROCESS: Creates a new instance of the operator

The operator instance (process) implements the interface if_dhape_graph_process, though it is recommended that the process extends the abstract class cl_dhape_graph_proc_abstract instead.

Creating the artefacts for your ABAP operator: To reduce manual activities to a minimum, there is a framework that supports you in creating all the described artefacts in the ABAP backend. The framework

6 PUBLICABAP Integration Guide

User Guide for ABAP Integration in SAP Data Hub

Page 7: ABAP Integration Guide

consists of two reports that must be executed in sequence. They are available with SAP S/4HANA 1909 and any SAP NetWeaver-based system with SAP_BASIS 7.76 and higher or SAP_ABA 75E and higher.

Procedure

1. Execute the DHAPE_CREATE_OPERATOR_CLASS report.

The report creates the operator implementation class of your custom ABAP operator.

NoteIf your ABAP-based SAP system is not an S/4HANA System, use report R_LTAPE_CREATE_OPERATOR_CLASS to create the operator implementation class.

You must provide the following parameters:

○ Class name○ Operator name in SAP Data Hub○ Class description

2. Execute the DHAPE_CREATE_OPER_BADI_IMPL report.

NoteIf your ABAP-based SAP system is not an S/4 HANA system, use report R_LTAPE_CREATE_OPER_BADI_IMPL_CLASS to create the operator implementation class.

You must provide the following parameters:

○ Enhancement impl. name○ Class description○ BAdI Implementation○ Reference to impl. class○ Operator name (SAP Data Hub)

Now the class is created and the two methods GET_INFO and STEP can be modified according to your needs.

3. Adapt the GET_INFO method.

Adapt the GET_INFO method template sections of the new operator to meet your requirements:

○ Change the number, names, and typing of the ports according to your needs (the structure ls_port in the below template code).

○ Add any parameters, if needed (the structure ls_prop in the below template code).4. Adapt the process local class.

Inside the process method, you can implement the actual logic that you would like to execute within your custom ABAP operator. Processes use a simple event-based model and can be implemented by redefining one or more of the following methods:

○ ON_START: Called once before the graph is started.○ ON_RESUME: Called at least once before the graph is started or resumed.

ABAP Integration GuideUser Guide for ABAP Integration in SAP Data Hub PUBLIC 7

Page 8: ABAP Integration Guide

○ STEP: Called frequently.○ ON_SUSPEND: Called at least once after the graph is stopped or suspended.○ ON_STOP: Called once after the graph is stopped.

Additionally, the abstract class provides several helper methods that you can use:

○ GET_PORT: Get an input or output port.○ GET_CONF_VALUE: Get a value from the process configuration properties.

Example

To become more familiar with the event-based model, use this example implementation:

Sample Code

CLASS lcl_process DEFINITION INHERITING FROM cl_dhape_graph_proc_abstract.PUBLIC SECTION.METHODS: if_dhape_graph_process~on_resume REDEFINITION.METHODS: if_dhape_graph_process~step REDEFINITION.PRIVATE SECTION.DATA: mo_in TYPE REF TO if_dhape_graph_channel_reader.DATA: mo_out TYPE REF TO if_dhape_graph_channel_writer.DATA: mv_data TYPE string.ENDCLASS.CLASS lcl_process IMPLEMENTATION.METHOD if_dhape_graph_process~on_resume.mo_in = get_port( 'in' )->get_reader( ).mo_out = get_port( 'out' )->get_writer( ).ENDMETHOD.METHOD if_dhape_graph_process~step.CHECK mv_alive = abap_true.IF mo_in->has_data( ).CHECK mo_out->is_blocked( ) <> abap_true.mo_in->read_copy( IMPORTING ea_data = mv_data ).mo_out->write_copy( reverse( mv_data ) ).ELSEIF mo_in->is_closed( ).mo_out->close( ).mv_alive = abap_false.ENDIF.rv_progress = abap_true.ENDMETHOD. ENDCLASS.

In the ON_RESUME method, you get the input and output channels of the operator. This only needs to be done once.

NoteIf the user tries to get a port that is not defined in GET_INFO or tries to get a reader for an output port that does not exist, this results in an error.

In the STEP method, the operator first checks if the process is still alive. If this is not the case, no further action is taken.

8 PUBLICABAP Integration Guide

User Guide for ABAP Integration in SAP Data Hub

Page 9: ABAP Integration Guide

The operator then checks if there is any data available on the input channel. If this is the case, and if the output channel is not blocked, the operator reads the data from the input channel. Finally, it reverses the data and writes it to the output channel.

Until the data is consumed by a subsequent process, the output is blocked.

If the input is empty and already closed, the system closes the output channel and sets the operator to be no longer alive. Once all operator processes indicate that they are no longer alive, the graph terminates automatically.

The system may temporarily suspend graph execution, for example during a maintenance event. When this happens, you can store any necessary local state by adding it to the io_saved_state object that is passed to the ON_SUSPEND method.

When the graph is resumed later, the same io_saved_state object is again passed to the ON_RESUME method. You can restore the local state as described above.

To get the new operator definition into the repository of SAP Data Hub, use custom ABAP operator.

ABAP Integration GuideUser Guide for ABAP Integration in SAP Data Hub PUBLIC 9

Page 10: ABAP Integration Guide

Important Disclaimers and Legal Information

HyperlinksSome links are classified by an icon and/or a mouseover text. These links provide additional information.About the icons:

● Links with the icon : You are entering a Web site that is not hosted by SAP. By using such links, you agree (unless expressly stated otherwise in your agreements with SAP) to this:

● The content of the linked-to site is not SAP documentation. You may not infer any product claims against SAP based on this information.● SAP does not agree or disagree with the content on the linked-to site, nor does SAP warrant the availability and correctness. SAP shall not be liable for any

damages caused by the use of such content unless damages have been caused by SAP's gross negligence or willful misconduct.

● Links with the icon : You are leaving the documentation for that particular SAP product or service and are entering a SAP-hosted Web site. By using such links, you agree that (unless expressly stated otherwise in your agreements with SAP) you may not infer any product claims against SAP based on this information.

Videos Hosted on External PlatformsSome videos may point to third-party video hosting platforms. SAP cannot guarantee the future availability of videos stored on these platforms. Furthermore, any advertisements or other content hosted on these platforms (for example, suggested videos or by navigating to other videos hosted on the same site), are not within the control or responsibility of SAP.

Beta and Other Experimental FeaturesExperimental features are not part of the officially delivered scope that SAP guarantees for future releases. This means that experimental features may be changed by SAP at any time for any reason without notice. Experimental features are not for productive use. You may not demonstrate, test, examine, evaluate or otherwise use the experimental features in a live operating environment or with data that has not been sufficiently backed up.The purpose of experimental features is to get feedback early on, allowing customers and partners to influence the future product accordingly. By providing your feedback (e.g. in the SAP Community), you accept that intellectual property rights of the contributions or derivative works shall remain the exclusive property of SAP.

Example CodeAny software coding and/or code snippets are examples. They are not for productive use. The example code is only intended to better explain and visualize the syntax and phrasing rules. SAP does not warrant the correctness and completeness of the example code. SAP shall not be liable for errors or damages caused by the use of example code unless damages have been caused by SAP's gross negligence or willful misconduct.

Gender-Related LanguageWe try not to use gender-specific word forms and formulations. As appropriate for context and readability, SAP may use masculine word forms to refer to all genders.

10 PUBLICABAP Integration Guide

Important Disclaimers and Legal Information

Page 11: ABAP Integration Guide

ABAP Integration GuideImportant Disclaimers and Legal Information PUBLIC 11

Page 12: ABAP Integration Guide

www.sap.com/contactsap

© 2021 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. The information contained herein may be changed without prior notice.

Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors. National product specifications may vary.

These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP or its affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP or SAP affiliate company products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.

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 https://www.sap.com/about/legal/trademark.html for additional trademark information and notices.

THE BEST RUN