Sunday, December 23

RFC destination from gateway to ECC is showing error

1. Introduction
2. Error
3. Resolution of Error

Introduction
You are trying to call function module from oData service. The oData service is hosted on SAP net weaver gateway system and function module which is RFC enabled is hosted on SAP ECC system. To make this call you need to have a RFC destination created in Gateway system. This activity can be done in SM59 transaction. Once RFC destination is created, test it by clicking on connection test as shown below.

Click on Connection test on below RFC Connection.


Below error is displayed


Error
Error when opening an RFC connection (LB: Hostname or service of the message server

Under such circumstances, if you try to run oData service on browser, you get below error.
Error Text as shown on the front end i.e browser
Call of service <oData service URL> terminated because of an error. The following error text was processed in system MUP : Error when opening an RFC connection (LB: Hostname or service of the message server unknown DEST =ECC_TRUSTED MSHOST =171.31.243.33 R3NAME =MUP GROUP =MUP).The error occurred on the application server mutcdcnwhwcuv. The termination type was: RABAX_STATE.If the termination type is RABAX_STATE, you will find more information on the cause of termination in system MGP in transaction ST22. If the termination type is ABORT_MESSAGE_STATE, you will find more information on the cause of termination on the application server mstddcnwgwciv in transaction SM21. If the termination type is ERROR_MESSAGE_STATE, you can search for further information in the trace file for the work process in transaction ST11 on the application server mstddcnwgwciv. You may also need to analyze the trace files of other work processes. If you do not yet have a user ID, contact your system administrator.  

Resolution of Error

If the destination system is unavailable or not accessible over HTTP, this error occurs.

Saturday, December 22

Testing oData Service using External Test Clients like ARC and Postman


1. Introduction
2. Google's ARC client
3. Concept of oData Write Operations without CSRF token
4. Google's Postman.


Introduction
SAP provides a testing environment for oData services called ‘Gateway Client’ which is an inbuilt tool in SAP NetWeaver Gateway System. It is meant for testing GET, POST, PUT, and PATCH, MERGE, DELETE http methods.
During SAP implementation projects, oData services also gets consumed in non-SAP application clients for example consuming oData service on an Android based mobile app. In such scenarios, testing oData services using an external client like ARC or Postman becomes critical. In this blog, we will see how to test oData service using ARC client and Postman.

Google’s ARC Client
First you need to Install ARC on your google chrome browser. After installation, click on Apps.
You will be able to see all the Apps installed on your Chrome browser like below.
Click on ARC icon, below page will be displayed. Where you need to enter your oData service's URL and select the type of Request like GET, POST, PUT etc...
Then Click on Send button, that it, you are done. This is equivalent to oData read operation, If you are connected to network from where your SAP Netweaver gateway system is accessible, your read request will go all the way to Gateway and fetch necessary information and display in XML format in below manner.

Concept of oData Write Operations without CSRF token
You can also add headers to your HTTP request. For example, if you are doing a POST request (i.e. write operation for your oData), you need to send X-Requested-With header and its value to be set a 'X'. When such a header is sent for a oData write operation, ICF of your netweaver gateway system will not check for X-CSRF-Token. Other wise for any oData write operation, CSRF token is a must.

In addition to sending X-Requested-with header, you also need to sent ~Check-CSRF-Token parameter's value to 0 at the ICF service level of your oData service. You can do this in SICF transaction of your gateway system as shown below.