Webservice -   XI -   SAP(BAPI)

hi
i have one scenario using webservice, in this one i will post some input through  webservice  to BAPI which is in sap R/3 , and bapi output to publish using webservice,  i have no idea of webservice,  or how to use webservice in this scenario. Could you please help me in doing this one.
Regards
Pradeep P N
null

Hi,
Got the requirement finally
Before giving the solution, what you are now trying to do is what in XI terminology is called , <b>"Expose an Outbound Interface as a Webservice in XI"</b>.
<b>Integration Repository</b>
Follow this blog HTTP - RFC and create all the Integration Repsoitory content as shown in this blog,
<a href="/people/community.user/blog/2006/12/12/http-to-rfc--a-starter-kit">HTTP to RFC - A Starter Kit</a>
<b>Integration Directory</b>
This will be similar to a HTTP RFC , with just 2 added steps,
1. Create a Sender SOAP adapter and a Sender Agreement for the same.
2. Define a WSDL.
1 , is quite simple and is like any other SOAP adapter and Agreement.
2. To define the WSDL, look into section 3,,.2.2 of this document,
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d23cbe11-0d01-0010-5287-873a22024f79">How to use SOAP Adapter</a>.
Regards
Bhavesh

Similar Messages

  • Integrating Webservice with SAP

    Hi Experts,
    How to integrate Webservice with SAP ECC6.0( RFC)
    webservice : .Net
    regrads,
    stephen

    Read the below details
    . When we use *Sender SOAP Adapter how the connectivity is happening with Remote Clients.
    A:SOAP is an XML-based protocol for exchanging information in a decentralized, distributed environment.SOAP is a technology that allows XML to move easily over the Web. SOAP does this trough an XML envelope for delivering XML content and specifying a set of rules for services to follow when they receive a SOAP message.The fundamental change brought about by SOAP has been the ability to move data anywhere across the Web.
    When ever XI needs to talk to a webservice you will go for SOAP adapter. If you need to enable some functionality as webservice using XI you can use SOAP Sender adapter. If you need to send request to a webservice you will go for SOAP Receiver
    SOAP Message Structure :
    SOAP Envelop: The outermost element of SOAP message. The envelope element is the root of the XML document that defines a SOAP message.
    SOAP Header: An optional, yet key element in architecting a distributed system around XML. The header element provides a modular way of directing SOAP servers to do processing before passing the SOAP message on. For example, it is possible to add SOAP header information that instructs a server to add transaction or authentication information. Header are also important in building piped architectures where processing is done in stages and data is modified as it is passed from handler to handler.
    SOAP Body: An element that must appear in a SOAP message. The Body element is where the transported XML is loaded. SOAP makes no assumptions about the kind of XML transport in the body of a SOAP message. XML or it may take the form of remote procedure call.
    also these weblogs can give you a view where you can use SOAP adapters
    EP-XI Integration using Web Services and Web Dynpro MVC
    https://www.sdn.sap.com/sdn/weblogs.sdn?blog=/pub/wlg/1334 [original link is broken] [original link is broken] [original link is broken]
    Looking for replacing SAP.NET connectors with SAP XI?
    https://www.sdn.sap.com/sdn/weblogs.sdn?blog=/pub/wlg/2131 [original link is broken] [original link is broken] [original link is broken]
    how the connectivity is happening with Remote Clients?
    A:Configuring the Sender SOAP Adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/5ad93f130f9215e10000000a155106/content.htm
    2.How sender SOAP Adapter get those webservices from remote clients and when exactly Remote clients will send webservices to SOAP Adapter?
    It purely depends on ur client & if ur client provides WSDL file then u no need to develop it in ID and use that WSDL.WSDL describes a particular web service. Using a wsdl, we are requesting the broker to point the exact system, application, message interface. Once it is found, the SOAP channel is opened between the provider and the consumer. So the WSDL is a must to access web services.
    in XI, we have to define the Web service which we want to use for the Sender SOAP channel. It is done by choosing Define Web Service from the tool menu of Integration Directory.
    There is no need to code any thing. Here, what you are doing is, just exposing the sender service,channel,Message Interface as a web service.
    In XI, we need to map the incoming messages to the target message( to the actual web service from the provider) format and to maintain the technical and logical routing between the sender and receiver.
    Check this blog to generate WDSL file...
    Exposing BAPI as Web Services through SAP XI
    Configuring a SOAP Sender Channel:
    When we create a SOAP sender channel we have to define the namespace and the name of a message interface (values can be taken from Integration Repository).
    Select the Quality of Service according to your interface type. If you are using a synchronous interface, select Best Effort. Otherwise, select Exactly Once or Exactly Once in Order.
    Transport protocol : HTTP
    Message protocol : SOAP 1.1
    Adapter Engine: Integration Server
    3. I need exactly how the webservices request is passing through sender SOAP Adapter.
    After completion of ur scenario u can use XML spy for testing ur scenario.
    Refer this Blog how to send SOAP message from XML Spy
    Invoke Webservices using SAPXI
    Web Services Testing: SAP Netweaver Platform
    http://www.crosschecknet.com/web_services_testing_SAP.php
    Using the SOAP inbound channel of the Integration Engine
    XI: Propagation of meaningful error information to SOAP Client
    An Overview of SOAP
    Refer the following blogs for SOAP sender Configuration:
    How to Use the XI 3.0 SOAP Adapter
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d23cbe11-0d01-0010-5287-873a22024f79
    How Tou2026Set Up a Web-Service-Related Scenario with SAP XI
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/befdeb90-0201-0010-059b-f222711d10c0
    have a look at this weblog:
    How to use Client Authentication with SOAP Adapter
    SOAP Adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/69/a6fb3fea9df028e10000000a1550b0/content.htm
    Architecture of connector for SAP XI
    http://publib.boulder.ibm.com/infocenter/wbihelp/v6rxmx/index.jsp?topic=/com.ibm.wbia_adapters.doc/doc/sap_xi/sapximst14.htm
    Configuring the Sender SOAP Adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/5ad93f130f9215e10000000a155106/content.htm
    Security Settings for the Sender SOAP Adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/1f/7e2441509fa831e10000000a1550b0/content.htm

  • No Connection btw JCAPS 5.1.2 and SAP ECC 6.0 whle creatining SAP/Bapi OTD

    Hello.
    We have the following problem trying to build SAP BAPI/RFC OTD.
    1) JCAPS 5.1.2. SAP ECC 6.0. Jco version 2.1.7 (also tried 2.1.8, 2.0.12 with the same result). All steps were done according to SAP BAPI/ALE eWays user guides and readmes
    2) SAP client already installed and worked ok on the same host as the JCAPS
    3) It looks like the problem is in JCo. It seems like doesn't react when we trying to connect to SAP during creation of BAPI/RFC OTDs at design time.
    Error message: partner not reached
    ERRNO 10060
    All ports are open and no restrictions imposed on JCAPS server. There are no connection log entries on SAP router host.
    4)We tried to run sample Project which goes with eway, and the following entries in logical host log file were found:
    [#|2007-06-12T11:35:13.171+0600|WARNING|IS5.1.2|STC.eWay.SAP.BAPI.com.stc.connector.sapbapiadapter.sapbapi.SAPConnector|_ThreadID=17; ThreadName=Worker: 5;|SAPConnector.isConnect(): JCO Client is null|#]
    [#|2007-06-12T11:35:13.296+0600|INFO|IS5.1.2|STC.eWay.framework.management.com.stc.connector.management.util.Alerter|_ThreadID=17; ThreadName=Worker: 5;|sendAlert(), connection info: ConnectionInfo [ collaboration: cmBAPIOutbound_jcdFlightGetList, project: prjBAPIOutbound, component: eaSAPBAPI, deployment: dpBAPIOutbound, environment: envTest, logicalhost: LogicalHost1, integration server: IntegrationSvr1 ], monitor: ObjectReference [ name: SeeBeyond:GUID={70010000-D247521E130100-AC14015A-01},Name=prjBAPIOutbounddpBAPIOutbound|prjBAPIOutbound|dpBAPIOutbound|cmBAPIOutbound_jcdFlightGetList_eaSAPBAPI ], alert message: No connection established to SAP R/3 for user $$$$$$ on host $$$$$.|#]
    [#|2007-06-12T11:35:13.312+0600|WARNING|IS5.1.2|STC.eWay.SAP.BAPI.com.stc.connector.sapbapiadapter.sapbapi.SAPConnector|_ThreadID=17; ThreadName=Worker: 5;|SAPConnector.isConnect(): JCO Client is not connected.|#]
    [#|2007-06-12T11:35:34.781+0600|INFO|IS5.1.2|STC.eWay.framework.management.com.stc.connector.management.util.Alerter|_ThreadID=17; ThreadName=Worker: 5;|sendAlert(), connection info: ConnectionInfo [ collaboration: cmBAPIOutbound_jcdFlightGetList, project: prjBAPIOutbound, component: eaSAPBAPI, deployment: dpBAPIOutbound, environment: envTest, logicalhost: LogicalHost1, integration server: IntegrationSvr1 ], monitor: ObjectReference [ name: SeeBeyond:GUID={70010000-D247521E130100-AC14015A-01},Name=prjBAPIOutbounddpBAPIOutbound|prjBAPIOutbound|dpBAPIOutbound|cmBAPIOutbound_jcdFlightGetList_eaSAPBAPI ], alert message: Connection to SAP R/3 failed for user $$$$$$ on host $$$$$$.|#]
    [#|2007-06-12T11:35:34.781+0600|SEVERE|IS5.1.2|STC.eWay.SAP.BAPI.com.stc.connector.sapbapiadapter.sapbapi.SAPConnector|_ThreadID=17; ThreadName=Worker: 5;|Unable to initialize SAP R/3 Client Connection|#]
    Any help is appreciated

    Hi Yermek.
    I guess you are placed and set all jars relates to bapi/rfc.
    You need to pass atleast one parameter from jcd which will initiates the BAPI connection.
    i.e atleast from jcd you need to send a request.
    Hope it will work...
    Thanks,
    M.P.Rao.

  • Consuming external webservice in SAP

    Hi All,
    Wjile Consuming external webservice that is .NET webservice in SAP I am getting the error "Proxy generation terminated: WSDL
    (<extension> not supported)". Please can anyoone tell me what would be the issue and how should I resolve it.
    Thanks in Advance,
    Meenu.

    The SAP version that we are using is ECC 5.0. And the URL that they have given me to consume has some .svc extension.
    http://ctnhgesappdev.corp.timken.com/GES_EDISService/EDISService.svc?wsdl
    So when I am trying to consume this in SAP I am getting the error "Proxy generation Terminated : WSDL error : (<extension> not supported)".

  • Need Inputs - Creation of webservice in SAP R3 through PI

    Hi Experts,
    Need inputs that my client wants me to  create an webservice in SAP/R3 through PI and they (client) will call it by  their 3rd party software.
    Webservice contain fields like :- Comany_Code, Location_Code,Item _code etc.
    SAP -
    > PI ---> 3rd party
    Is this possible through PI ? Please comment !
    Thanks.

    Hi,
    If you have such kinda requirement , then it is easy to create WSDL(webservice) on PI System..
    Create a normal Xi Interface with normal Steps .....
    Your Sender DataType will be acc to Your requirement as clients want...
    go to tools - Define webservice ... ( will Use Outound Service Interface and namespace)
    read the template and Put values in there . This will genrate a WSDL for you , 
    You Can give this Genertaed , WSDL File to Client to consume in their application and Pass data to it ..
    Hope it helps ..
    Regards
    Prabhat Sharma.

  • How to retrieve the data from SAP-BAPI by using VB Code

    Hi ,
    I am new to BAPI.
    V have created an application in Visual Basic with the following fields
    EmpNo , EmpName, Addr1, Addr2, City and Phone (Only for Test)
    We have written the code for SAVING the data into SAP. Already we have
    constructed a table with the respective fields in SAP.
    For that we ourself created our own BAPI Structure / Function Group /
    Function Module/ Business Object - RELEASED related elements.
    1)Established the connection successfully.
    2)Stored the data into SAP Successfully and v r in need of
    3)HOW TO RETRIEVE THE DATA FROM SAP (USING GETLIST.....GETDETAIL....)
    Following is the code :
    'BAPI Structure  : ZBAPIEMP
    'Function Group  : ZBAPIEMP
    'Function Module : ZBAPI_EMP_CREATEFROMDATA
    'Business Object : ZBAPIEMP
    'Function Module : ZBAPI_EMP_GETLIST
    Dim bapictrl As Object
    Dim oconnection As Object
    Dim boEmp As Object
    Dim oZEmp_Header As Object
    Dim oImpStruct As Object
    Dim oExpStruct As Object
    Dim oreturn As Object
    Dim x As String
    Private Sub Form_Load()
    Set bapictrl = CreateObject("SAP.BAPI.1")
    Set oconnection = bapictrl.Connection
    oconnection.logon
    Set boEmp = bapictrl.GetSAPObject("ZBAPIEMP")
    Set oZEmp_Header = bapictrl.DimAs(boEmp, "CreateFromData", "EmployeeHeader")
    Set oImpStruct = bapictrl.DimAs(boEmp, "GetList", "EmployeeDispStruct")
    End Sub
    Private Sub cmdSave_Click()
        oZEmp_Header.Value("EMPNO") = txtEmpNo.Text
        oZEmp_Header.Value("EMPNAME") = txtEmpName.Text
        oZEmp_Header.Value("ADDR1") = txtAddr1.Text
        oZEmp_Header.Value("ADDR2") = txtAddr2.Text
        oZEmp_Header.Value("CITY") = txtCity.Text
        oZEmp_Header.Value("PHONE") = txtPhone.Text
        boEmp.CreateFromData EmployeeHeader:=oZEmp_Header, Return:=oreturn
        x = oreturn.Value("Message")
        If x = "" Then
            MsgBox "Transaction Completed!..."
        Else
            MsgBox x
        End If
    End Sub
    Private Sub cmdView_Click()
    End Sub
    COULD ANYBODY GUIDE ME, HOW TO RETRIEVE THE DATA FROM BAPI, FOR THE WRITTEN CODE.

    I didn't seen any other answers but here's how it's been done previously in our organization for a custom BAPI. In this example, we give material and language to return the part description. It's not specific to your project but may give you ideas..
    -Tim
    Option Compare Database
    Dim SAPLOGIN As Boolean
    Dim FunctionCtrl As Object
    Dim SapConnection As Object
    Sub SAPLOGOUT()
    On Error GoTo LogoutFehler
        SapConnection.logoff
        SAPLOGIN = False
    Exit Sub
    LogoutFehler:
        If Err.Number = 91 Then
            Exit Sub
        Else
            MsgBox Err.Description, vbCritical, "Fehler-Nr." & CStr(Err.Number) & " bei SAP-Logout"
        End If
    End Sub
    Function SAPLOG() As Boolean
    'Verbindungsobjekt setzen (Property von FunctionCtrl)
       Set FunctionCtrl = CreateObject("SAP.Functions")
       Set SapConnection = FunctionCtrl.Connection
    'Logon mit Initialwerten
       SapConnection.Client = "010"
       SapConnection.Language = "EN"
       SapConnection.System = "PR1"
       SapConnection.SystemNumber = "00"
       'SapConnection.Password = ""
       SapConnection.GroupName = "PR1"
       SapConnection.HostName = "168.9.25.120"
       SapConnection.MessageServer = "168.9.25.120"
         If SapConnection.Logon(0, False) <> True Then  'Logon mit Dialog
             Set SapConnection = Nothing
             DoCmd.Hourglass False
             MsgBox "No connection to SAP R/3 !"
             SAPLOGIN = False
             SAPLOG = False
             Exit Function
          End If
        SAPLOG = True
    End Function
    Function MatDescr(MatNr As String)
    Dim func1 As Object
    Dim row As Object, X As Integer, ErsteNr As String
    Dim DatensatzZähler As Long
    Dim RowField(1 To 50, 0 To 1) As String, RowLine As Long
        If Not SAPLOGIN Then
            If Not SAPLOG() Then
                MsgBox "No connection  to SAP !", 16
                SAPLOGOUT
                Exit Function
            End If
        End If
    ' Instanziieren des Function-Objektes
    Set func1 = FunctionCtrl.Add("Z_BAPI_READ_MAKT")
    ' Export-Paramter definieren
    func1.exports("MATNR") = MatNr
    func1.exports("SPRAS") = "EN"
    DoEvents
    If Not func1.call Then
        If func1.exception <> "" Then
            MsgBox "Communication Error with RFC " & func1.exception
        End If
        DoCmd.Hourglass False
        SAPLOGOUT
        Exit Function
    Else
      MatDescr = func1.imports("MAKTX")
    End If
    If MatDescr = "" Then
        MatDescr = "PART NO. NOT FOUND"
    End If
    End Function

  • Error in SAP BAPI

    Hello,
    I'm getting a error while trying to create a SAP BAPI OTD using the Enterprise Designer. After I give the client number, username and password and click next the following error comes
    Error in getBapiList(): Cannot convert field ID of type NUM to int
    Do I need to configure something on the SAP server?
    Cheers,
    Deepak

    This has been resolved. It was happenning because of the unicode settings of the SAP system and I was giving non unicode in the OTD setting. However, I'm facing another problem.
    SAP ALE eway is not appearing in my designer. I have installed both SAP ALE and SAP BAPI eway and then uploaded those in the edesginer through the upload center. In the connectivity map drop down it shows the SAP BAPI eway but not the SAP ALE eway. I have done everything which is mentioned in the documents.
    Regards,
    Deepak

  • How to use Webservices in SAP 7.0 SP 17

    Hi,
    I am having issues calling the webservices in SAP 7.0 SP 17.
    I am following the below mentioned tutorial to call a webservice from a portal project (PAR).
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b449e790-0201-0010-1188-ff17840712d3
    I have been successful to a point where my websevice needs authentication. I am not sure how to do this.
    Here is the code of doContent()
    public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
             try
                  logger.infoT("Inside doConent()...");
                   UserProfile up = pushUserProfileAttributes();
                   logger.infoT("After pushUserProfileAttributes()...");
                   ILDAPOperationsService port=(ILDAPOperationsService) PortalRuntime.getRuntimeResources ().getService (ILDAPOperationsService.KEY);
                   logger.infoT("After port()...");
                   RegisterUserResponse res = port.CreateExternalUserProfile(up);               
                   logger.infoT("After res ..user created." + res.getEmailAddress());
             } catch (UserRegistationFailed e){logger.errorT("Error in calling webservice...."+ e.getLocalizedMessage());}
                  catch (Exception e1){logger.errorT("Error in calling webservice...."+ e1.getLocalizedMessage());
    Its failing at RegisterUserResponse res = port.CreateExternalUserProfile(up);     
    and the error I am getting is
    Error : Error in calling webservice....com.sap.engine.services.webservices.jaxm.soap.accessor.NestedSOAPException: Problem in server response: [Unauthorized].
    Any help with this will be highly appreciated.
    Also , if any documentation could be shared.
    Looking forward to hear something soon on this.
    Thanks,
    Shiv

    Hi Sumit,
    you may move your question to the ABAP for SAP HANA community (http://scn.sap.com/community/abap/hana).
    Are you asking about the SAP_BASIS version, or which version do you refer to?
    Best,
      Jasmin

  • Automatic authentication with a webservice in SAP

    hi all
    I have a flex application which uses SOAP webservices from SAP to retrieve data.
    Everytime one of the SOAP webservices is called the user have to enter a name plus password
    I would like to make this automaticly. So that the user haven't got to fill this in. But Flex already filled it automaticcally.
    But how do this work? How can you set this in Flex?
    kind regards
    Anton Pierhagen

    hi Sathyamoorthi. That is correct. But i'd like to suppress this one time login for the user.
    My wish is that during the calling of the webservice in SAP, a system user is automatically login in the background just like the retrieving of the data.
    So the user who uses the flex application has no idea that a webservice in SAP is used for the retrieving of the data.
    Do you have any idea how to solve this?
    Kind regards,
    Anton Pierhagen

  • Calling webservice in SAP XI from Servlet

    I have requirment of Calling webservice in SAP XI from Servlet.
    COuld you provide information of caling simple webservice from servlet

    Hello Venkat,
    Getting Started with Web Services
    Web Services Infrastructure
    Getting Started with Web Services [original link is broken]
    Thanks,
    Satya

  • WebService From a BAPI & Commit

    Heyho!
    I created a Webservice from a BAPI (From BusinessPartner, to create a BP).
    There is the option to add  "TransactionCommit" and "TransactionRollBack" to the Service Definition (that is what i did).
    I consume the Webservice with an external Java-Application, create a BP and then call the commit.
    My Problem is that the BP can't be found anymore as if it wasn't even created.
    The counter for the BPs did counter++ but there is no BP to be shown.
    Anyone?
    regards
    frank

    Thank you all for your replies,
    i solved this problem with the following:
    1)
    i created a new RFC-able FM
    2)
    I Called the BAPI-Method
    3)
    I Called 'BAPI_COMMIT_TRANSACTION'
    4)
    I generated the Webservice
    thank you
    frank

  • SAP BAPI ActiveX Interface

    Hello,
    This is a cross post from LAVA forum...
    I'm trying to integrate our test stations to SAP ERP. SAP stores data in busines objects in busines object repository. The objects are exposed over BAPI interface. There is a lot of different busines objects in the repository. SAP developers can also build new objects if they want. The objective is to read inspection characeristics from quality management module of SAP. I haven't done much ActiveX stuff, neither know much about SAP, so I started with a simple example that I found searching for BAPI examples. The example works fine in Excel. The example just reads some data from a sales order object.
    Sub BAPI1()Dim
    oBook As Workbook
    Dim oSheet As Worksheet
    Dim oBAPICtrl As Object
    Dim oBAPILogon As Object
    Dim oSalesOrder As Object
    Dim oItem As Object
    Dim iIndex As Integer
    Set oBook = Application.ActiveWorkbook
    Set oSheet = oBook.Worksheets(1)
    ' Initialize SAP ActiveX Control.
    Set oBAPICtrl = CreateObject("sap.bapi.1")
    ' Initialize SAP ActiveX Logon.
    Set oBAPILogon = CreateObject("sap.logoncontrol.1")
    ' Initialize the connection object.
    Set oBAPICtrl.Connection = oBAPILogon.newconnection
    ' Logon with prompt.
    oBAPICtrl.Connection.System = "Q02"
    oBAPICtrl.Connection.Client = 101
    oBAPICtrl.Connection.Logon
    ' Retrieve a sales order.
    Set oSalesOrder = oBAPICtrl.GetSAPObject("SalesOrder","0010732181")
    ' Display Sales Order header data.
    oSheet.Cells(2, 1).Value = oSalesOrder.salesdocument
    oSheet.Cells(2, 2).Value = oSalesOrder.netvalue
    oSheet.Cells(2, 3).Value = oSalesOrder.orderingparty.customerno
    oSheet.Cells(2, 4).Value = oSalesOrder.documentdate
    oSheet.Cells(2, 5).Value = oSalesOrder.items.Count
    ' Logoff SAP and close the control.
    oBAPICtrl.Connection.logoff
    Set oBAPILogon = Nothing
    Set oBAPICtrl = Nothing
    End Sub
     I tried to implement that in LabVIEW. The logon and logout part works, I can also obtain SalesOrder object with GetSAPObject method. There is no error and probing the Object output from GetSAPObject methods gives an integer value - probably a reference to the SalesOrder object.
    Now I can't figure out how do I read the object properties. It's very simple in VBA. I also don't know how do I call object methods. This is apicture from SAP BAPI documentatios showing available properties and methods.
    I would appreciate any hints...
    bye, Mirko

    No, there isn't any reference type that matches BAPI Object. In fact, there can't be a fixed type reference, since BAPI object are actually function modules that SAP programmers write themselves using language called ABAP. I concluded that we can't call the object methods or read/write properties in LabVIEW, if we don't know the right type at development time. So, I gave up on BAPI API.
    There are also other methods of SAP integration. O step down on abstraction scale is Remote Function Call (RFC) API. The API is much more involved, but it allows us to call functions that are behind BAPI objects. In a few test that I did it worked fine. The interface is exposed over three ActiveX controls - SAP Remote Function Call Control, SAP Table Factory Control and SAP Logon Control.
    There is also .NET assembly and web services which I didn't tried.
    Regards, Mirko

  • BAPI-VB, Unable to call method GetDetail of USER Object using SAP.BAPI.1

    Hi,
    I am trying to call SAP Methods using Excel VBA.
    In the below example, I am trying to get the user details.
    I can solve this, if I use SAP.Functions object, but not when I use SAP.BAPI.1 object.
    The Procedure GetUserDetails() works fine, but the 2nd one GetUserDetails2() fails?
    Can you tell what is the difference in calling SAP method with SAP.Functions and SAP.BAPI.1 ?
    Also how can I run the program GetDetails2() using SAP.BAPI.1
    Const CNT_STR_USR As String = "XXXXX"
    Const CNT_STR_PWD As String = "XXXXX"
    Const CNT_STR_APPLN_SRVR As String = "ides47"
    Const CNT_STR_SYSTEM As String = "IDS"
    Const CNT_STR_SYS_NUM As String = "00"
    Const CNT_STR_CLIENT As String = "800"
    Const CNT_STR_LOGON_LANG As String = "EN"
    Const CNT_STR_LOG_FILE As String = "C:sap_vb.txt"
    Const CNT_INT_LOG_LEVEL As Integer = 9
    'Works Fine
    Public Sub GetUserDetails()
    'Using SAP Functions
    Dim obSAPFn As Object
    Dim obFuncUsrDtl As Object
    Dim obFuncRtrn As Object
    Dim obFuncLogDtl As Object
    Dim sRetStatus As String * 1, sErrText As String, sUsrGroup As String * 12
    Dim iRetRowCount As Integer, iLoop As Integer
    Dim bErrFlag As Boolean
    'Set obSAPFn = New SAPFunctions
    Set obSAPFn = CreateObject("SAP.Functions")
    obSAPFn.Connection.ApplicationServer = CNT_STR_APPLN_SRVR
    obSAPFn.Connection.SystemNumber = CNT_STR_SYS_NUM
    obSAPFn.Connection.User = CNT_STR_USR
    obSAPFn.Connection.Password = CNT_STR_PWD
    obSAPFn.Connection.Language = CNT_STR_LOGON_LANG
    obSAPFn.Connection.Client = CNT_STR_CLIENT
    obSAPFn.LogLevel = CNT_INT_LOG_LEVEL
    obSAPFn.LogFileName = CNT_STR_LOG_FILE
    'Check For Connection
    If obSAPFn.Connection.Logon(0, True) = False Then
        MsgBox "R/3 connection failed"
    Exit Sub
    Else
        If obSAPFn.Connection.IsConnected Then
    '    MsgBox "Connected"
        Else
        MsgBox "Not COnnected"
        Exit Sub
        End If
    End If
    'Get User Details.
    Set obFuncUsrDtl = obSAPFn.Add("BAPI_USER_GET_DETAIL")
    obFuncUsrDtl.Exports("USERNAME") = CNT_STR_USR
    obFuncUsrDtl.Call
    Set obFuncRtrn = obFuncUsrDtl.Tables("RETURN")
    iRetRowCount = obFuncRtrn.RowCount
    bErrFlag = False
    For iLoop = 1 To iRetRowCount
        If obFuncRtrn(iLoop, "TYPE") = "E" Then
    '        ErrorUsuario = True
            sErrText = "E" & obFuncRtrn(iLoop, "ID") & obFuncRtrn(iLoop, "NUMBER") & _
                         " " & obFuncRtrn(iLoop, "MESSAGE")
            MsgBox sErrText
            bErrFlag = True
            Exit For
        End If
    Next
    If bErrFlag = False Then
    Set obFuncLogDtl = obFuncUsrDtl.Imports("LOGONDATA")
    sUsrGroup = obFuncLogDtl("CLASS")
    MsgBox sUsrGroup
    End If
    Set obFuncRtrn = Nothing
    Set obFuncLogDtl = Nothing
    Set obFuncUsrDtl = Nothing
    obSAPFn.Connection.LogOff
    Set obSAPFn = Nothing
    End Sub
    ' Does not work
    Public Sub GetUserDetails2()
    'Using BAPI Object
    Dim obSapBAPICtrl As Object 'BAPI control object
    'Dim obSAPConn As Object 'Connection object
    Dim obSAPUSER As Object ' To Get Details of USER Object
    Dim obLogondata As Object, obDefaults As Object, obAddress As Object, obCompany As Object
    Dim obSnc As Object, obParameter As Object, obProfiles As Object, obActivitygroups As Object
    Dim obReturn As Object, obAddComrem As Object, obAddRml As Object, obAddPag As Object
    Dim obAddUri As Object, obAddSsf As Object, obAddPrt As Object, obAddRfc As Object
    Dim obAddX400 As Object, obAddSmtp As Object, obAddTlx As Object, obAddTtx As Object
    Dim obAddTel As Object, obAddFax As Object, obParameter1 As Object
    Dim sRetStatus As String * 1, sTransId As String, sUsrGroup As String
    Dim iRetRowCount As Integer, iLoop As Integer
    Set obSapBAPICtrl = CreateObject("SAP.BAPI.1")
    obSapBAPICtrl.Connection.ApplicationServer = CNT_STR_APPLN_SRVR
    obSapBAPICtrl.Connection.SystemNumber = CNT_STR_SYS_NUM
    obSapBAPICtrl.Connection.User = CNT_STR_USR
    obSapBAPICtrl.Connection.Password = CNT_STR_PWD
    obSapBAPICtrl.Connection.Language = CNT_STR_LOGON_LANG
    obSapBAPICtrl.Connection.Client = CNT_STR_CLIENT
    obSapBAPICtrl.LogLevel = CNT_INT_LOG_LEVEL
    obSapBAPICtrl.LogFileName = CNT_STR_LOG_FILE
    'Don't show the logon details
    'Connect to SAP
    If obSapBAPICtrl.Connection.Logon(0, True) = False Then
        MsgBox "R/3 connection failed"
        Exit Sub
    Else
        If obSapBAPICtrl.Connection.IsConnected Then
    '    MsgBox "Connected"
        Else
        MsgBox "Not COnnected"
        Exit Sub
        End If
    End If
    ‘Could not find a way to pass the User Id?
    ‘ Is this the right way to pass the user Id for this Object?
    Set obSAPUSER = obSapBAPICtrl.GetSAPObject("USER", CNT_STR_USR)
    Set obLogondata = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Logondata")
    Set obDefaults = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Defaults")
    Set obAddress = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Address")
    Set obCompany = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Company")
    Set obSnc = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Snc")
    Set obParameter = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Parameter")
    Set obProfiles = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Profiles")
    Set obActivitygroups = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Activitygroups")
    Set obReturn = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Return")
    Set obAddComrem = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddComrem")
    Set obAddRml = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddRml")
    Set obAddPag = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddPag")
    Set obAddUri = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddUri")
    Set obAddSsf = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddSsf")
    Set obAddPrt = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddPrt")
    Set obAddRfc = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddRfc")
    Set obAddX400 = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddX400")
    Set obAddSmtp = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddSmtp")
    Set obAddTlx = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddTlx")
    Set obAddTtx = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddTtx")
    Set obAddTel = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddTel")
    Set obAddFax = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "AddFax")
    Set obParameter1 = obSapBAPICtrl.DimAs(obSAPUSER, "GetDetail", "Parameter1")
    sTransId = obSapBAPICtrl.CreateTransactionID()
    'obSapBAPICtrl.TransactionId = sTransId
    obSAPUSER.GetDetail Logondata:=obLogondata, Defaults:=obDefaults, Address:=obAddress, _
    Company:=obCompany, Snc:=obSnc, Parameter:=obParameter, Profiles:=obProfiles, _
    Activitygroups:=obActivitygroups, Return:=obReturn, AddComrem:=obAddComrem, _
    AddRml:=obAddRml, AddPag:=obAddPag, AddUri:=obAddUri, AddSsf:=obAddSsf, _
    AddPrt:=obAddPrt, AddRfc:=obAddRfc, AddX400:=obAddX400, AddSmtp:=obAddSmtp, _
    AddTlx:=obAddTlx, AddTtx:=obAddTtx, AddTel:=obAddTel, AddFax:=obAddFax, _
    Parameter1:=obParameter
    iRetRowCount = obReturn.RowCount
    If iRetRowCount > 0 Then
        For iLoop = 0 To iRetRowCount
            sRetStatus = obReturn(iLoop, "TYPE")
            If sRetStatus = "S" Then
            sUsrGroup = obLogondata("CLASS")
            MsgBox sUsrGroup
            End If
        Next
    End If
    Set obSAPUSER = Nothing
    obSapBAPICtrl.Connection.LogOff
    'Set obSAPConn = Nothing
    Set obSapBAPICtrl = Nothing
    End Sub
    Regards,
    Vikas

    The problem was occuring because, the structure Return was not holding any values.
    But the other tables which returned values were getting populated.
    Regards,
    Vikas

  • Publishing a WebService in SAP ECC6.0

    Hello Everyone,
    I published a WebService in SAP ECC6.0 using a Remote enabled function module which has one input field and one output field. After publishing that in WSADMIN transaction when i give the URL in the browser the XML format has the Root node as function module name,internal table name as child node and the 2 fields of the function module as child node to internal table name. The issue is PeopleSoft team are not able to ping the 2 fields as they are in the 3rd level in XML file.
    Could you please let me know if there any solution to have those 2 fields under the Function Module name so that they can directly ping the root node to interact with the fields.Thanks in advance.
    Goutham

    Hello,
    Does anyone know how to maintain Authorization Field in SAP ECC6.0?
    Many thanks
    Sunny

  • SAP BAPI to get Component of any SAP Transaction

    Dear All,
    I Want to get the Component Id of any given SAP Transaction Code, with the help of some SAP RFC.
    I tried to get the Component, I got it too but I need some SAP BAPI to do this task.
    Some details are available over here,
    Component of any SAP Transaction
    Please Help.

    Hi Cvrian,
    There is no BAPI for this but there are some RFC functions to get what you want (since they are not BAPIs they may change without notice but probably won't).
    First get the transaction dev class info with RFC AKB_GET_TADIR. 
    For example if you give it OBJECT_TYPE = TRAN  and NAME = SU01 you will get the dev class info for transaction SU01. 
    The dev class info includes a component (in this example HLB0100102).  Now call RFC RH_GET_APPLICATION_COMPONENTS to get the list of component to map it to the human-readable component (in this example BC-SEC-USR-ADM). 
    Hope that solves your requirement.  This is not really a SolMan question but I wanted to be helpful

Maybe you are looking for