Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write the first ABAP program on the ABAP programming environment of SAP cloud platform

2025-01-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to write the first ABAP program on the SAP cloud platform ABAP programming environment, many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.

Jerry will recently do a series of sharing on how to develop in the ABAP programming environment on SAP Cloud Platform.

In fact, for a traditional developer who is already proficient in using ABAP Development Tools to connect to the On-Premises ABAP Netweaver server for development, it is not difficult to migrate from On-Premises to the SAP cloud platform, but we just need to pay attention to some changes in development philosophy, which we will mention in the subsequent specific development.

This relatively smooth migration and learning curve is undoubtedly good news for enterprises and developers in SAP's vast global ecosystem-it means that these enterprises and individuals can join SAP in its ongoing transition to digital in the cloud, and the valuable technology and business domain knowledge they have accumulated in the On-Premises era can continue to shine in the cloud era.

I have learned on the Internet that the first hurdle that many self-taught SAP ABAP friends face is to set up a Netweaver server locally. As a veteran developer who wrote the 12's code, Jerry has also been in a variety of local development environments and knows very well how deep the water is. My former boss also shared with us his experience that when he came to SAP Chengdu Research Institute for an interview, he also took a local Netweaver and finished reading hundreds of pages of Netweaver English documents in just a few days.

I believe that every ABAP learner who sets up Netweaver locally will have a great sense of achievement when he successfully sees the output of Hello World.

However, when Jerry first saw Hello World on SAP Cloud Platform's ABAP programming environment, he did not have much sense of achievement, because he could just follow the project creation wizard in ABAP Development Tool step by step, and the process was relatively simple and easy to understand-- which also reflected the impact on the way traditional application developers worked after the arrival of the cloud era: there was no need to worry about the underlying hardware or operating system and other resources. You can focus on writing application logic. In other words, SAP is responsible for managing and maintaining the underlying HANA database and the middle-level ABAP runtime, and users only need to manage the top-level ABAP application code.

Use the project creation wizard for ABAP Development Tools:

New- > ABAP Cloud Project:

Service Instance Connection, select SAP Cloud Platform CloudFoundry environment:

Select Region and enter the user name and password, as long as you have a global Account under this region.

The following picture shows my Global Account in the CloudFoundry environment of SAP Cloud Platform:

I created an ABAP system instance under the space to which the Global Account belongs. The ID is ME1:

This ABAP running instance has 16GB running memory and 64GB HANA memory.

Going back to ABAP Development Tools, use the above properties maintained in Cockpit in the project creation wizard:

Click Next and you will see an embedded login window in ABAP Development Tools. Because Jerry uses the account of the SAP community Mentor, the login window displays the title: Welcome to Mentors!

Click the Finish button in the wizard:

After clicking, you can see the created ABAP Cloud project in the list of projects on the left side of ABAP Development Tools, and then write ABAP code for development in this project in basically the same way as we use ADT to connect to the On-Premises system. You can see that the highlighted ABAP Cloud project created in the following figure (system ID is ME1) is no different from other ABAP projects on On-Premises in appearance.

The difference between the two ABAP projects is that the ABAP language features that can be used in ABAP Cloud projects are only a subset of the traditional ABAP language, such as the keywords related to Dynpro in the traditional ABAP language, that is, those keywords that can only work in SAPGUI. Because it is no longer applicable in the Cloud environment, it is prohibited in ABAP Development Tools's ABAP Cloud project.

Now you can write the first line of the ABAP program.

As in the On-Premises environment, first create a local package ZJERRY (local package):

Then pop up a prompt to create a Transport Request (transfer request):

Once you have both Package and Transport Request, you can start coding.

In the age of On-Premises, we wanted to print Hello World with ABAP, create a report directly by SE38 (Program, as shown in the following figure), and then WRITE: 'Hello World' is fine.

On SAP Cloud Platform, ABAP Program is no longer in the option to create a new list.

So we can only choose to create a new ABAP Class:

Specify that this class be stored in the newly created Transport Request:

The next operation is like printing Hello World with System.out.println in Java class's static public void main (String [] args) method.

The newly created ABAP class implements the IF_OO_ADT_CLASSRUN interface to print Hello World:

In the activation code, you can see that, like On-Premises, the various components of this class need to be activated together.

As to why Jerry writes a plain ABAP source code in IDE, but there are so many objects in the task list when activated, please refer to Jerry's blog: General properties of ABAP Classes / Interfaces

Https://blogs.sap.com/2014/03/14/general-properties-of-abap-classes-interfaces/

After activation, Run As- > ABAP Application (console):

You can see the output in Console:

Looking at the interaction log executed by this class, we find that when we trigger the execution action in ABAP Development Tools, IDE sends a POST request with endpoint / sap/bc/adt/oo/classrun on SAP Cloud Platform.

This program is executed on the ABAP instance of the SAP cloud platform, and the result is returned to IDE as a HTTP response.

The specific Java code that IDE sends the request to SAP Cloud Platform can be decompiled and checked according to Jerry's article: the method described in SAP IDE that I used in those years.

Compared with traditional On-Premises system programming, there is a significant difference between ABAP programming on SAP cloud platform and traditional Netweaver system programming. For the sake of keeping simple and reducing operational risk, as well as tradeoffs in providing operational flexibility and cloud platform security, developers in SAP Cloud Platform's ABAP programming environment cannot access resources on Netweaver arbitrarily like the latter.

Taking the operation of reading tables in ABAP OPEN SQL, which is most commonly used in secondary development by traditional ABAP developers on Netweaver, as an example, this behavior of directly accessing database tables will cause syntax errors on SAP Cloud Platform.

Even if the database table of Netweaver is referenced directly in the ABAP code as shown below, it is not allowed on the SAP cloud platform.

All access to the underlying resources must be done through the API in the whitelist defined by SAP, that is, the API contained in the Released Objects below.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 239

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report