none
Calling SAP RFC using BizTalk 2013 R2 RRS feed

  • Question

  • Dear All,

    This is my first project , pls advise how to call SAP RFC and develop project on BizTalk server.


    -- Regards Sandeep

    Monday, August 29, 2016 6:35 PM

Answers

  • Dear Rachit,

    It means I need to change Operation_1 to some logical in Visual Studio Orchestration and same need to be kept in Physical port BTsActionMapping.

    Please advise for SAP physical port I import binding file so i see

    <BtsActionMapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <Operation Name="RFCName" Action="http://Microsoft.LobServices.Sap/2007/03/Rfc/RFCName" />
    < /BtsActionMapping>

    So do i need to overwrite....also i asked SAP team to enable RFC to be executed remotely.


    -- Regards Sandeep

    Hi Sandeep,

    Yes, change the operation name in the logical port in BizTalk orchestration from Operation_1 to the operation for which you generate metadata, in your case which is RFCName.

    and keep the physical port BtsActionmapping as below:

    <BtsActionMapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <Operation Name="RFCName" Action="http://Microsoft.LobServices.Sap/2007/03/Rfc/RFCName" />
    < /BtsActionMapping>


    Rachit Sikroria (Microsoft Azure MVP)

    • Marked as answer by Sandeep.Handa Wednesday, August 31, 2016 1:42 PM
    Wednesday, August 31, 2016 8:22 AM
    Moderator

All replies

  • You can refer MSDN : https://msdn.microsoft.com/en-us/library/cc185247(v=bts.10).aspx and https://msdn.microsoft.com/en-us/library/cc185318(v=bts.10).aspx

    Rachit Sikroria (Microsoft Azure MVP)


    Monday, August 29, 2016 6:43 PM
    Moderator
  • Hi Rachit,

    I developed small orchestration and deployed the solution and when I am trying to run SAP adapter giving me error for wrong credentials, but I checked in SAP logon with same credentials and its working.


    -- Regards Sandeep

    Monday, August 29, 2016 6:55 PM
  • Hi Sandeep, Your original question has not been answered if you are still getting wrong credentials error while connecting to SAP from BizTalk. You should raise it on that thread. https://social.msdn.microsoft.com/Forums/en-US/abc5b7c1-d4aa-4d5b-8b38-9e9057e081ee/issue-in-connecting-sap-using-sap-adpater-in-biztalk-server-2013-r2?forum=biztalkr2adapters

    Rachit Sikroria (Microsoft Azure MVP)

    Monday, August 29, 2016 7:01 PM
    Moderator
  • Dear Rachit,

    Issue in that thread is when I was trying to import schema in BizTalk Orchestration, but that was got resolved when SAp basis team configure SAP user id as dialog user. Now issue is coming when I have deployed solution on BizTalk and trying to run the application , I am getting exception for wrong credentials

    Error is

    The adapter failed to transmit message going to send port "SendPort_SAP" with URL "sap://CLIENT=000;LANG=EN;@a/10.1.1.1/00?RfcSdkTrace=False&AbapDebug=False". It will be retransmitted after the retry interval specified for this Send Port. Details:"Microsoft.ServiceModel.Channels.Common.ConnectionException: Details: ErrorCode=RFC_OK. ErrorGroup=RFC_ERROR_LOGON_FAILURE. SapErrorMessage=Name or password is incorrect (repeat logon).  AdapterErrorMessage=. ---> Microsoft.Adapters.SAP.RFCException: Details: ErrorCode=RFC_OK. ErrorGroup=RFC_ERROR_LOGON_FAILURE. SapErrorMessage=Name or password is incorrect (repeat logon).  AdapterErrorMessage=.
       at Microsoft.Adapters.SAP.RfcClientConnection.Open()
       at Microsoft.Adapters.SAP.SAPConnection.Open(TimeSpan timeout)
       --- End of inner exception stack trace ---
    Server stack trace:
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndRequest(IAsyncResult result)
    Exception rethrown at [0]:
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at System.ServiceModel.Channels.IRequestChannel.EndRequest(IAsyncResult result)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result)".


    -- Regards Sandeep


    Monday, August 29, 2016 7:05 PM
  • Hi Exactly the same issue is being discussed here.

    https://social.msdn.microsoft.com/Forums/en-US/abc5b7c1-d4aa-4d5b-8b38-9e9057e081ee/issue-in-connecting-sap-using-sap-adpater-in-biztalk-server-2013-r2?forum=biztalkr2adapters

    Resolution's is

    Basically, looks like they configured the SAP account for BizTalk as a background user and hence the login is failing. The account should be aDIALOG user.


    Regards Pushpendra Singh : Please mark the reply as answer or vote it up, as deemed fit.


    wait a minute,  the op of the thread is you so it shall be resolved than :-)

    Regards Pushpendra Singh : Please mark the reply as answer or vote it up, as deemed fit.

    Tuesday, August 30, 2016 12:28 AM
  • Dear Rachit,

    Issue in that thread is when I was trying to import schema in BizTalk Orchestration, but that was got resolved when SAp basis team configure SAP user id as dialog user. Now issue is coming when I have deployed solution on BizTalk and trying to run the application , I am getting exception for wrong credentials



    Hello Sandeep,

    You need to refer: https://gautambiztalkblog.com/tag/sending-idocs-to-sap-from-biztalk/

    Firstly, on your WCF send port (SendPort_SAP) go to Credentials tab and Select the Do not use Single Sign-On option, and specify the user name and password to connect to an SAP system. This User should be the same to which you have currently provided DIALOG user access on SAP.

    Image result

    Also ensure below properties:

    Transport



    Rachit Sikroria (Microsoft Azure MVP)


    Tuesday, August 30, 2016 1:50 AM
    Moderator
  • Dear Rachit/Pushpendra,

    I checked SAP user in SAP logon and its working fine I can able to execute RFC .

    Also I am using same SAP user and defining under WCF-SAP transport properties,

    but in 2nd step you are saying the account(which is domain user) under which host instance is running..we should provide access in SAP as dialog user....how can we give domain user access in SAP.


    -- Regards Sandeep

    Tuesday, August 30, 2016 4:40 AM
  • Hi Sandeep,

    Don't bother about the 2nd step, you don't require to do that.

    1) Double check that you are providing the right password.

    2) Check with the SAP Admin that due to repeated login failure possibly User might got locked.

    3) You need to refer: https://gautambiztalkblog.com/tag/sending-idocs-to-sap-from-biztalk/

    As explain in the article get in touch with Sap Admin and ensure all other properties are set correctly.

    Transport


    Rachit Sikroria (Microsoft Azure MVP)

    Tuesday, August 30, 2016 5:21 AM
    Moderator
  • Dear Rachit,

    While configuring SAP adapter in BizTalk there is field named "SOAP Action Header’s Action  – provide the operation name and Action value"

    Pls advise what should I input in text field.


    -- Regards Sandeep

    Tuesday, August 30, 2016 10:29 AM
  • Dear Rachit,

    While configuring SAP adapter in BizTalk there is field named "SOAP Action Header’s Action  – provide the operation name and Action value"

    Pls advise what should I input in text field.


    -- Regards Sandeep

    This is a sample of SOAP Header:

    <BtsActionMapping xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
      <Operation Name=”Z_BAPI_PIP3B2_INBOUND” Action=”http://Microsoft.LobServices.Sap/2007/03/Rfc/Z_BAPI_PIP3B2_INBOUND” />
    </BtsActionMapping>

    Name parameter correspond to the Operation of the logical orchestration port and Action usually correspond to MessageType without #. This is default using from adapter wizard.

    To be sure to do all correctly you can do that:

    Import schema from SAP, after you’ll find a Bindinginfo file to create a physical port on BizTalk from admin console.
    Open this file and use the value of action paramenter to rename the operation of orchestration logical port.
    Deploy all, create physical port with binding file and configure your orchestration.

    Refer: Specifying SOAP Action

    You can also refer: http://biztalk-dish.blogspot.in/2012/05/generic-process-to-send-any-idocs-to.html


    Rachit Sikroria (Microsoft Azure MVP)


    Tuesday, August 30, 2016 10:35 AM
    Moderator
  • Dear Rachit,

    I did above steps now the error which is coming is

    The adapter failed to transmit message going to send port "WcfSendPort_SAPBinding_Rfc_Custom" with URL "sap://CLIENT=xxx;LANG=EN;@a/10.1.1.1/00?RfcSdkTrace=False&AbapDebug=False". It will be retransmitted after the retry interval specified for this Send Port. Details:"Microsoft.ServiceModel.Channels.Common.UnsupportedOperationException: Incorrect Action <BtsActionMapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <Operation Name="RFC001" Action="http://Microsoft.LobServices.Sap/2007/03/Rfc/RFC001" />
    </BtsActionMapping>. Correct the specified Action, or refer to the documentation on the allowed formats for the Actions. Note that Actions are case-sensitive.
    Server stack trace:
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndRequest(IAsyncResult result)
    Exception rethrown at [0]:
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at System.ServiceModel.Channels.IRequestChannel.EndRequest(IAsyncResult result)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result)".


    -- Regards Sandeep

    Wednesday, August 31, 2016 7:18 AM
  • Hi Sandeep,

    Do you have only single operation?

    If yes, then set SOAPActionHeader as below:

    http://Microsoft.LobServices.Sap/2007/03/Rfc/RFC001

    Refer: Specifying SOAP Action

    In the Action text box, specify the SOAP action for the operation. You can specify the action in the following ways:

    • By using the single action format. Use this format if the WCF-Custom port sends and receive messages for a single operation. For example:
      http://Microsoft.LobServices.Sap/2007/03/Rfc/RFC_CUSTOMER_GET
      
    • By using the action mapping format. Use this format if a single WCF-Custom port sends and receives messages for more than one operation. For example, if a single WCF-Custom port sends and receives messages for Op1 (to invoke RFC_CUSTOMER_GET RFC) and Op2 (to invoke BAPI_SALESORDER_CREATEFROMDAT2 BAPI), the SOAP action can be specified in the following manner:
      <BtsActionMapping>
        <Operation Name="Op1" Action="http://Microsoft.LobServices.Sap/2007/03/Rfc/RFC_CUSTOMER_GET " />
        <Operation Name="Op2" Action="http://Microsoft.LobServices.Sap/2007/03/Bapi/BUS2032/CREATEFROMDAT2/BAPI_SALESORDER_CREATEFROMDAT2" />
      </BtsActionMapping>
      
      This approach provides greater flexibility in terms of specifying a set of actions and hence enabling messages belonging to different action types to flow through the same port.

      The format for the SOAP action is different for each operation. For more information about action format for each operation, see individual topics under Technical Reference.



    Rachit Sikroria (Microsoft Azure MVP)

    Wednesday, August 31, 2016 7:33 AM
    Moderator
  • Dear Rachit,

    I kept Operation name in Orchestration Send-Receive Port same in Physical port in BizTalk under SOAP action header as

    <BtsActionMapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <Operation Name="Operation_1" Action="http://Microsoft.LobServices.Sap/2007/03/Rfc/Operation_1" />
    </BtsActionMapping>

    After this above error is not coming now different error is coming as...

    The adapter failed to transmit message going to send port "WcfSendPort_SAPBinding_Rfc_Custom" with URL "sap://CLIENT=000;LANG=EN;@a/10.1.1.11/00?RfcSdkTrace=False&AbapDebug=False". It will be retransmitted after the retry interval specified for this Send Port. Details:"Microsoft.ServiceModel.Channels.Common.MetadataException: RFC Operation_1 could not be resolved against SAP system because its metadata could not be obtained. ---> Microsoft.Adapters.SAP.RFCException: Details: ErrorCode=RFC_EXCEPTION. ErrorGroup=RFC_ERROR_APPLICATION_EXCEPTION. SapErrorMessage=EXCEPTION FU_NOT_FOUND RAISED.  AdapterErrorMessage=An error occurred while determining the function interface of the RFC Operation_1.
       at Microsoft.Adapters.SAP.RFCException.HelperThrow(Int32 retCode, String additionalErrorMessage)
       at Microsoft.Adapters.SAP.RfcClientConnection.GetRfcFunctionInterface(String rfcName)
       at Microsoft.Adapters.SAP.InternalRfcMetadata..ctor(String originalRfcName, SAPConnection sapConnection)
       at Microsoft.Adapters.SAP.SAPMetadataContract.ResolveOperationMetadata(String operationId, TimeSpan timeout, TypeMetadataCollection& extraTypeMetadataResolved)
       at Microsoft.ServiceModel.Channels.Common.Design.MetadataCache.GetOperationMetadata(String uniqueId, Guid clientId, TimeSpan timeout)
       at Microsoft.Adapters.SAP.SapFunctionMetadata.ResolveOperationMetadataUsingSdk(String absoluteName, String displayName, String funcName, String operationNamespace, SAPConnection sapConnection, Boolean isTrfc, MetadataLookup metadataLookup, TimeoutHelper timeoutHelper)
       --- End of inner exception stack trace ---
    Server stack trace:
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndRequest(IAsyncResult result)
    Exception rethrown at [0]:
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at System.ServiceModel.Channels.IRequestChannel.EndRequest(IAsyncResult result)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result)".


    -- Regards Sandeep

    Wednesday, August 31, 2016 7:58 AM
  • Hi Sandeep,

    First try setting name of logical send port and OperationName in BtsActionMapping of your physical send port to something more tuned/logical to what it is. Don't leave it default like "Operation_1".

    Even after doing it if it doesnt work than it is not Biztalk issue any more. You will have to get some configuration changes done at SAP end. You will have to chang the RFC Connection from non-unicode to unicode at SAP end using SAPGUI.

    Refer: https://sandroaspbiztalkblog.wordpress.com/2015/05/04/biztalk-wcf-sap-adapter-rfc-idoc_inbound_asynchronous-could-not-be-resolved-against-sap-system-because-its-metadata-could-not-be-obtained/

    Also you must read this article by Nino: https://ninocrudele.me/2012/12/04/biztalk-vs-sap-under-the-hood-integration-and-configuration/.

    It is must for you, if you need to understand the Biztalk-Sap communication settings end to end.


    Rachit Sikroria (Microsoft Azure MVP)


    Wednesday, August 31, 2016 8:12 AM
    Moderator
  • Dear Rachit,

    It means I need to change Operation_1 to some logical in Visual Studio Orchestration and same need to be kept in Physical port BTsActionMapping.

    Please advise for SAP physical port I import binding file so i see

    <BtsActionMapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <Operation Name="RFCName" Action="http://Microsoft.LobServices.Sap/2007/03/Rfc/RFCName" />
    < /BtsActionMapping>

    So do i need to overwrite....also i asked SAP team to enable RFC to be executed remotely.


    -- Regards Sandeep

    Wednesday, August 31, 2016 8:19 AM
  • Dear Rachit,

    It means I need to change Operation_1 to some logical in Visual Studio Orchestration and same need to be kept in Physical port BTsActionMapping.

    Please advise for SAP physical port I import binding file so i see

    <BtsActionMapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <Operation Name="RFCName" Action="http://Microsoft.LobServices.Sap/2007/03/Rfc/RFCName" />
    < /BtsActionMapping>

    So do i need to overwrite....also i asked SAP team to enable RFC to be executed remotely.


    -- Regards Sandeep

    Hi Sandeep,

    Yes, change the operation name in the logical port in BizTalk orchestration from Operation_1 to the operation for which you generate metadata, in your case which is RFCName.

    and keep the physical port BtsActionmapping as below:

    <BtsActionMapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <Operation Name="RFCName" Action="http://Microsoft.LobServices.Sap/2007/03/Rfc/RFCName" />
    < /BtsActionMapping>


    Rachit Sikroria (Microsoft Azure MVP)

    • Marked as answer by Sandeep.Handa Wednesday, August 31, 2016 1:42 PM
    Wednesday, August 31, 2016 8:22 AM
    Moderator
  • Dear Rachit,

    Now I can able to receive xml from SAP issue was SAP RFc connection type need to be set to Unicode, only issue is no data is coming from SAP ..blank xml is coming.

    advise how can I test SAP interface with BizTalk..

    When I am executing RFC from SAP Logon I am getting data ..but not when I execute from BizTalk


    -- Regards Sandeep

    Wednesday, August 31, 2016 1:01 PM
  • Hi Sandeep,

    Glad to know that you have successfully setup connectivity between Biztalk and SAP. Happy that I could help :)

    As your original question has been answered, I would request you to open a new thread for a new question for more visiblity.

    Don't forget to close the thread by marking appropriate posts as answer.


    Rachit Sikroria (Microsoft Azure MVP)

    Wednesday, August 31, 2016 1:20 PM
    Moderator