Full width home advertisement

IT Sharing

Travel the world

Climb the mountains

Post Page Advertisement [Top]

Introduction

When developing .NET based Web services clients using Visual Studio that call Web services in SAP NetWeaver .NET developers would like to be able to debug inside SAP. In my blog I would like to point .NET developers to the fact that SAP NetWeaver offers the option of external debugging to perform this task. Though the steps that have to be performed are described in the SAP Online Help I am sure that this option is not well known amongst the .NET developer community.

Prerequisites

  • You have to have SAPGUI installed on your desktop where your Visual Studio is running. When debugging a SAPGUI session must be active since SAPGUI is not started automatically as part of the debug process.
  • NetWeaver 2004 and later

How To section

Let us have a look at the following simple scenario:
You have published the function module BAPI_FLIGHT_CHECKAVAILIBILITY  as a Web service using the Web Service Creation Wizard and you want to write and debug a C# console application that is calling this Web services.

Step 0: Publish BAPI_FLIGHT_CHECKAVAILIBILITY as a Web service.

The scenario describes assumes that you have published the function module BAPI_FLIGHT_CHECKAVAILIBILITY as a Web service. How to publish an existing BAPI as a Web service using the Web Service Creation Wizard has been described in detail in the document Providing and Consuming Web Services in ABAP

Step 1: Activate external debugging in SICF

Start transcation SICF. Select the required service that has been published in step 0 in the service hierarchy. In our example the service Z_FLIGHT_CHECKAVAILIBILITY that is located in the following directory /default_host/sap/bc/srt/rfc/sap/. Choose Edit -> Debugging -> Activate Debugging.


  image

In the following screen Activate Debugging for Users under User, enter the user with which you perform your Web service request.

 image

 

Step 2: Set external breaktpoints in the ABAP code of BAPI_FLIGHT_CHECKAVAILIBILITY

Start transaction SE37. Select the BAPI BAPI_FLIGHT_CHECKAVAILIBILITY and press the Display button. From the menue choose Utilities – > Settings. In the following window User-Specific Settings select the Tab Debugging. Activate the check box  in the frame External Debugging.

 image

Now we can select the position in the ABAP code where we want to place our external breakpoint. From the menue choose: Utiliies -> Breakpoint -> Set/Delete

 image

In the following window you have to press the button HTTP Breakpoint to set an external breakpoint.

 image

!!! IMPORTANT !!!
Don’t close your SAPGUI session.

Step 3: Start debugging from Visual Studio

In Visual Studio start your project using F5,
A new SAPGUI window ABAP Debugger opens. However the stop at this point is usually NOT the position where we want to stop for debugging.

 image

Therefore we you would like to choose Debugging -> Control -> Run (to cursor) to proceed to the external break point that you have set in step 2.
Here you can start to debug as usual in ABAP.
Source: SAP  Blogs

Không có nhận xét nào:

Đăng nhận xét

Bottom Ad [Post Page]