原文地址:http://scn.sap.com/people/andre.fischer/blog/2007/02/07/how-to-debug-abap-web-services-from-microsoft-visual-studio
How to debug ABAP Web services from Microsoft Visual Studio
发贴人 Andre Fischer 在 andre.fischer 打开 2007-2-7 9:19:54
inShare
style="BORDER-BOTTOM: 0px; POSITION: static; BORDER-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; OUTLINE-STYLE: none; OUTLINE-COLOR: invert; PADDING-LEFT: 0px; OUTLINE-WIDTH: 0px; WIDTH: 90px; PADDING-RIGHT: 0px; FONT-FAMILY: inherit; BACKGROUND: none transparent scroll repeat 0% 0%; HEIGHT: 20px; VISIBILITY: visible; FONT-SIZE: 12px; VERTICAL-ALIGN: baseline; BORDER-TOP: 0px; TOP: 0px; BORDER-RIGHT: 0px; PADDING-TOP: 0px; LEFT: 0px" id="I0_1467084450853" title="+1" tabindex="0" marginheight="0" src="https://apis.google.com/se/0/_/+1/fastbutton?usegapi=1&size=medium&origin=http%3A%2F%2Fscn.sap.com&url=http%3A%2F%2Fscn.sap.com%2Fpeople%2Fandre.fischer%2Fblog%2F2007%2F02%2F07%2Fhow-to-debug-abap-web-services-from-microsoft-visual-studio&gsrc=3p&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.zh_CN.fzEAtKWFU5o.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCO6hINZs56QZ5HNj8W6NXOfPccKXA#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled%2Cdrefresh%2Cerefresh&id=I0_1467084450853&parent=http%3A%2F%2Fscn.sap.com&pfname=&rpctoken=36083165" frameborder="0" width="100%" name="I0_1467084450853" marginwidth="0" scrolling="no" data-gapiattached="true">
style="BORDER-BOTTOM: 0px; POSITION: static; BORDER-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; OUTLINE-STYLE: none; OUTLINE-COLOR: invert; PADDING-LEFT: 0px; OUTLINE-WIDTH: 0px; WIDTH: 64px; PADDING-RIGHT: 0px; FONT-FAMILY: inherit; BACKGROUND: none transparent scroll repeat 0% 0%; HEIGHT: 20px; VISIBILITY: visible; FONT-SIZE: 12px; VERTICAL-ALIGN: baseline; BORDER-TOP: 0px; BORDER-RIGHT: 0px; PADDING-TOP: 0px" id="twitter-widget-0" class="twitter-share-button twitter-share-button-rendered twitter-tweet-button" title="Twitter Tweet Button" src="http://platform.twitter.com/widgets/tweet_button.57ff0b891fe1c9c735cbb440e7fd97ef.en.html#dnt=false&hashtags=scn&id=twitter-widget-0&lang=en&original_referer=http%3A%2F%2Fscn.sap.com%2Fpeople%2Fandre.fischer%2Fblog%2F2007%2F02%2F07%2Fhow-to-debug-abap-web-services-from-microsoft-visual-studio&size=m&text=How%20to%20debug%20ABAP%20Web%20services%20from%20Microsoft%20Visual%20Studio&time=1467084464682&type=share&url=http%3A%2F%2Fscn.sap.com%2Fpeople%2Fandre.fischer%2Fblog%2F2007%2F02%2F07%2Fhow-to-debug-abap-web-services-from-microsoft-visual-studio&via=SAPCommNet" frameborder="0" allowtransparency="" scrolling="no" _xhe_src="http://platform.twitter.com/widgets/tweet_button.57ff0b891fe1c9c735cbb440e7fd97ef.en.html#dnt=false&hashtags=scn&id=twitter-widget-0&lang=en&original_referer=http%3A%2F%2Fscn.sap.com%2Fpeople%2Fandre.fischer%2Fblog%2F2007%2F02%2F07%2Fhow-to-debug-abap-web-services-from-microsoft-visual-studio&size=m&text=How%20to%20debug%20ABAP%20Web%20services%20from%20Microsoft%20Visual%20Studio&time=1467084464682&type=share&url=http%3A%2F%2Fscn.sap.com%2Fpeople%2Fandre.fischer%2Fblog%2F2007%2F02%2F07%2Fhow-to-debug-abap-web-services-from-microsoft-visual-studio&via=SAPCommNet">
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
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.
In the following screen Activate Debugging for Users under User, enter the user with which you perform your Web service request.
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.
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
In the following window you have to press the button HTTP Breakpoint to set an external breakpoint.
!!! 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.
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.