This is Jerry’s 47th article in 2021 and the 324th original article on Wang Zixi’s official account in total.

In 2014, Jerry wrote an English blog On the SAP community about how to create and consume Web services On ABAP on-premises systems:

Step by step to create, consume and trace web service in ABAP system

For the Chinese version of this article, please follow this link:

The most detailed SAP ABAP Web Service creation and consumption steps

In an ABAP programming environment On SAP BTP, you can still use the Destination concept On an on-premises system to consume third-party services in the ABAP code On the cloud. The difference is that a Destination in an on-premises system is created using transaction code SM59, whereas an ABAP in the cloud creates a Destination instance in the SAP BTP console. Refer to Jerry’s previous article on how to consume third-party services in an ABAP programming environment on the SAP Cloud Platform for detailed steps.

This paper introduces how to consume SOAP-based Web Service in SAP BTP ABAP programming environment. If you have read the two articles Jerry mentioned earlier, it takes only a few minutes to understand what this article is about.

Log in SAP BTP platform ABAP programming environment. For specific steps, please refer to the video in Unit 4 of the first week of the OpenSAP Fiori Elements public course translated by Jerry, which contains detailed steps.

Create a new Service Consumption Model.

Remote Consumption Mode can be selected from Odata, RFC or Web Service. When Jerry introduced Fiori Elements and RESTful ABAP Programming model, The ODATA schema has been used before. In this article, we use the Web Service pattern.

Next we need to upload a WSDL file for the Consumption Model. Jerry’s article provides an in-depth understanding of how SAP Fiori Elements works, part two of the series: We mentioned the SAP ES5 system, which is a Demo system where SAP publishes a number of OData and Web services for educational purposes.

In this article, we use a simple Product Web Service that can query the price of a Product based on its ID. The WSDL file for the Web Service is available at this link.

After the WSDL file is uploaded, the Consumption Model is maintained with the prefix ZJERRY, which then enables the Model to be activated and generates a series of development resources whose names are prefixed with ZJERRY for easy query.



When the Consumption Model is activated, in the project resource list, you observe a series of automatically generated ABAP resources, including the data type definitions required by the runtime, and the ABAP Proxy Proxy class used to consume the Web Service.

At the same time, ADT automatically generates a template code for us that demonstrates how to consume the automatically generated ABAP proxy class to invoke the Web Service. Click Copy to Clipboard and paste this code into the Clipboard for later use.

Let’s create an ABAP class, copy the previous step to the ABAP code in the clipboard, and paste it into the new class.

The core code of calling the Web Service is shown in the figure below. The product ID of the price to be queried is hardcoded as JerryProduct.

In line 22, cl_soap_destination_provider=>create_by_url, input parameter i_url, from the location property value of the SOAP: Address node in the WSDL file.

Run the ABAP class directly and see the error output on the Console. This error message comes from the exception thrown in the get_price method of the ABAP Proxy class: ZjerryCX_fault_Msg_type:

Product not found. Try e.g. HT-1000

The error message indicates that this is an application-level error because my hard-coded product, JerryProduct, does not exist in the background of the ES5 system.

A standard Odata service published by SAP on ES5 system is used to query the background data of products that have been created. A Product data with ID AR-FB-1000 and price of 3.25 is randomly selected:

https://sapes5.sapdevcenter.c…

Call the Web Service again, and this time you see the desired output in the console:

Thus, the steps to consume SOAP Web Services On the SAP BTP cloud platform ABAP programming environment are simpler than those On ABAP on-premises systems.

Jerry’s ABAP feature

  • Jerry’s ABAP, Java and JavaScript stew
  • What should ABAP developers learn in the future
  • Jerry’s May Day Holiday 2017:ABAP implementation of 8 kinds of classical sorting algorithms
  • Jerry’s collection of original ABAP technical articles
  • 300 lines of ABAP code implement one of the simplest blockchain prototypes
  • Use Java+SAP Cloud Platform +SAP Cloud Connector to call functions from ABAP on-premise system
  • ABAP on-premise OData service is consumed in the CloudFoundry environment On the SAP cloud platform
  • ABAP vs Java, breaststroke vs freestyle
  • Talk about C and ABAP
  • Use ABAP Channel to develop some small tools to improve your daily work efficiency
  • All the boring things I did with ABAP
  • Don’t like SAP GUI?Try using Eclipse for ABAP development
  • Write and activate ABAP Code using Visual Studio Code
  • Did your ABAP program ever light the Buddha?Try Jerry’s little trick
  • Write the first ABAP program on SAP Cloud Platform ABAP programming environment
  • ABAP programming specification issued by SAP
  • What do you know about ABAP Code Inspector’s hidden features?
  • Still using ABAP for secondary development of SAP products? Take a look at this new concept of secondary development
  • The parasitic programming languages in ABAP NetWeaver
  • Start with a blog post from the SAP community and talk about the feelings behind the naming of SAP products
  • ABAP RESTful service development in the cloud
  • How to expose CDS View as OData Service in SAP Cloud Platform ABAP programming environment
  • Use ABAPGit to transfer code between an ABAP on-premises system and an ABAP environment On the SAP cloud platform
  • Develop a Fiori application using a RESTful ABAP Programming model in 30 minutes that supports adding, deleting, modifying and searching
  • Jerry takes you through the implementation of the RESTful ABAP Programming model series, Part 2: Actions and Validation
  • Jerry takes you through the third of our RESTful ABAP Programming Models series:Cloud ABAP application debugging
  • How to consume third party services in ABAP programming environment on SAP cloud platform
  • It’s time for ABAP developers to go to the cloud – you can now use a free trial version of the SAP Cloud Platform ABAP environment
  • Learning without thinking is useless – the origin and application scenarios of SAP Cloud Platform ABAP programming environment
  • Trident application in SAP cloud platform
  • How to develop and deploy a Fiori application based on a RESTful ABAP Programming model that supports additions, deletions, changes and searches
  • SAP 2019 Teched Key Note: How to do secondary development in the cloud age
  • What ABAP keywords and syntax are not available in an ABAP cloud environment?
  • The ABAP development environment finally supports automatic formatting of ABAP variable names with hump naming
  • Use ABAP 740’s new keyword REDUCE to complete a real work task
  • A shivering ABAP code
  • Yesterday Halloween ABAP monster code puzzle, announced the answer
  • This paper introduces an efficient method to copy inner table in ABAP kernel mode
  • A practical example of developing OData using the SAP Cloud Application Programming model
  • When ABAP meets Prometheus
  • Use ABAP to draw scalable vector diagrams
  • Things that ABAP development environment syntax highlights
  • Seven weapons for debugging SAP error messages:Make all error messages locatable
  • Several ways to use ABAP to manipulate Excel
  • SAP GUI in the collection of transaction code management tools
  • SAP GUI and Windows registry
  • Do you have the Debug permission to do bad things? Be careful. Your every move is being monitored
  • What the hell is ABAP CCDEF, CCIMP, CCMAC, CCAU, CMXXX
  • Three ways to implement ABAP conditional breakpoints
  • Use SAT tracking to monitor the performance and call stack of SAP applications opened from the browser
  • Advice from a 13-year ABAP veteran: Knowing the basics will help ABAP development
  • SAP ABAP NetWeaver Containerized, Impossible Task?
  • SAP product enhancement technology review
  • SAP API development methods
  • A brief discussion on static and dynamic proxy of Java and SAP ABAP, and the attempt of facet oriented programming of ABAP
  • HTTP response Status Code for SAP ABAP application server
  • Does Java List exist as a collection utility class in SAP ABAP? CL_OBJECT_COLLECTION Take a look
  • ABAP Interview Questions: Write a set of ABAP programs that cause deadlocks
  • Description of SAP ABAP NetWeaver server login standard
  • SAP ABAP keyword syntax diagrams and ABAP Code automatic generation tool Code Composer
  • Alternative use of SAP ABAP SM50 – ABAP worker process to detect database table read operations
  • SAP ABAP character variables and string variables on the number of a knowledge point, and a blood case
  • A group of keywords IS BOUND, IS NOT INITIAL and IS ASSIGNED in SAP ABAP
  • WeakReference and SoftReference in SAP ABAP and Java
  • SAP AMDP Introduction – ABAP Hosted HANA Database Process
  • Tag your ABAP objects
  • On this date in history: Billion dollar error with null references in programming languages
  • ABAP Development Tool code templates and some other practical tips
  • SAP ABAP Development Tool: 10 Tips to Improve Your Development Efficiency

More of Jerry’s original articles can be found on “Wang Zixi “: