sap connectivity with ms excel _ scn

Upload: mohamad-nizam-dikon

Post on 09-Feb-2018

270 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    1/30

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/docs/DOC-31015 1/30

    Getting Started Newsletters Store

    Products Services & Support About SCN Downloads

    Industries Training & Education Partnership Developer Center

    Lines of Business University Alliances Events & Webinars Innovation

    Login RegisterWelcome, Guest Search the Community

    Ac tivity Communications Actions

    Brow se

    3 Tweet 5

    created by Ronny Hon Aug 22, 2012 4:07 PM, last modified by Ronny Hon Aug 22, 2012 9:29 PM

    Data from SAP to MS Office Applications

    SAP Connectivity with MS Excel

    Share 3

    Version 1

    http://scn.sap.com/people/nimesh.master2http://scn.sap.com/people/nimesh.master2http://twitter.com/search?q=http%3A%2F%2Fscn.sap.com%2Fdocs%2FDOC-31015https://twitter.com/intent/tweet?hashtags=scn&original_referer=http%3A%2F%2Fscn.sap.com%2Fdocs%2FDOC-31015&text=SAP%20Connectivity%20with%20MS%20Excel&tw_p=tweetbutton&url=http%3A%2F%2Fscn.sap.com%2Fdocs%2FDOC-31015&via=SAPCommNethttp://scn.sap.com/contenthttp://scn.sap.com/actionshttp://scn.sap.com/communicationshttp://scn.sap.com/activityhttp://scn.sap.com/login.jspahttp://scn.sap.com/docs/login.jspahttp://scn.sap.com/community/uachttp://scn.sap.com/community/developer-centerhttp://scn.sap.com/community/downloadshttp://scn.sap.com/welcomehttp://www.sapstore.com/http://scn.sap.com/community/newslettershttp://scn.sap.com/community/getting-started
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    2/30

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/docs/DOC-31015 2/30

    Using the connection SAP with MS Office, users spreads data from SAP application to right

    within Microsoft Office desktop applications, including Excel, Outlook, Word and Power point.

    With the SAP-MS Office connectivity, end-users can interact with SAP transactions direct ly

    within their Excel spreadsheet, their Outlook e-mail screen, and their Word documents and on

    heir Power point presentations.

    Here we have a simple application to connect SAP with MS-office tools Excel.

    But before thatWhy? How? And Use!

    Why Data from SAP to MS Office Applications

    http://scn.sap.com/servlet/JiveServlet/showImage/102-31015-1-131110/1.jpg
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    3/30

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/docs/DOC-31015 3/30

    In spite of large moneys in SAP, most business users continue to be unsatisfied with it because

    data from SAP is not easily accessible in their favorite desktop productivity tools -- Microsoft

    Excel, Microsoft Outlook and Microsoft Word. Since Microsoft Office Applications are not

    connected t o SAP, users are forced to

    Use error-prone cut-copy-paste to populate their Excel spreadsheets.

    Switch screens from Outlook to gather data and take decisions as they respond to e-mails.

    Manually update data from Excel Spreadsheets to enterprise applications.

    Benefits of Data from SAP to Microsoft Office Applications

    SAP-MS Office Connectivity extends data from SAP to Microsoft Excel, Microsoft Outlook and

    Microsoft Word using a SOA based Information Delivery Server and Microsoft Office Add-ins,

    and provides the following benefits

    Eliminates cut-and-paste based data collecting mechanism from SAP to Microsoft Excel.Enables users to get real-time data from SAP within Excel with a single-click Refresh.

    Enables users to query and update SAP transactions from within Outlook screens.

    Allows the users t o update SAP from within Excel, Outlook and Word.

    Avoids any data-integrity issues with copying and reduces compliance issues.

    Who Benefits

    http://scn.sap.com/servlet/JiveServlet/showImage/102-31015-1-131126/2.jpg
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    4/30

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/docs/DOC-31015 4/30

    Production and Logistics Managers who want to create Excel reports from latest SAP data.

    Managers who want to track projects and status automatically as they receive status e-

    mails.

    Analysts who want to combine data from SAP and other enterprise data stores for

    budgeting purposes.

    Example:

    Here is the main part comes up. We shall take simple scenario for SAP with MS Excel

    connec tivity. So lets begin!!

    ust before start, I would like to give little overview on what we are actually going to do. So,

    here are the scenarios!!

    Excel File Scenarios

    Create a MS excel file for user input.

    Create user interface in excel sheet to input data for the customer master and output

    http://scn.sap.com/servlet/JiveServlet/showImage/102-31015-1-131127/3.jpg
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    5/30

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/docs/DOC-31015 5/30

    cells.

    Apply VB code to make connection with SAP.

    Read the input data for customer master from the excel file sheet.

    Fetch data from SAP using connection code from SAP.

    Display output within excel sheet itself.

    SAP Scenarios

    Create a funct ion module in ABAP that is Remote Enabled.

    Create IMPORT, EXPORT and TABLES parameters as per requirement from MS excel.

    Write logic to display customer master details based on input from Excel file.

    Activate the function module.

    WellA picture says thousand words. So, lets begin!

    MS Excel User Interface

    First of all, lets create MS excel file with customer master input. We shall create simpleselection screen for user input.

    http://scn.sap.com/servlet/JiveServlet/showImage/102-31015-1-131128/4.jpg
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    6/30

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/docs/DOC-31015 6/30

    Wellfilling cell values are simple here but how to add buttons (Get Address and Reset

    Output) here? This was also new in my case since new version of MS office.

    ust follow following steps for this:

    Click MS office button and select Excel Options button from the menu.

    ou will see here a new tab named Developer

    http://scn.sap.com/servlet/JiveServlet/showImage/102-31015-1-131132/5.jpg
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    7/30

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/docs/DOC-31015 7/30

    Click on Insert and then select Button from the form control. Later on you can double click

    on the button and set its properties (Caption, Color, etc.)

    Congratulations! Our input screen is finished here. Lets design our output screen now.

    I have created my output screen just after the input screen. You can create anywhere in the

    excel file. Here terms anywhere descries to other worksheet also.

    http://scn.sap.com/servlet/JiveServlet/showImage/131185/7.jpghttp://scn.sap.com/servlet/JiveServlet/showImage/102-31015-1-131133/6.jpg
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    8/30

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/docs/DOC-31015 8/30

    he output screen is simple as you see. Nothing much to do here. I just simple colored the cells

    or better look.

    Great! Looks like we finished user interface here. (Did we miss something...Naah for now!)

    SAP Select DataSince we are taking simple example to fetch detail from customer master, lets create a

    unction module for it.

    Create a function module.

    Enter function group and Short text.

    Make sure your function module is Remote Enabled.

    http://scn.sap.com/servlet/JiveServlet/showImage/131193/9.jpghttp://scn.sap.com/servlet/JiveServlet/showImage/131192/8.jpg
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    9/30

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/docs/DOC-31015 9/30

    Now lets create Tables parameters:

    http://scn.sap.com/servlet/JiveServlet/showImage/131194/10.jpg
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    10/30

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/docs/DOC-31015 10/30

    Here we have two Tables parameters

    ET_KUNNR (Input) : Customer numbers pass in to the function module

    ET_CUST_LIST (Output): Data will be fetched in function module and display on the excel

    sheet.

    Note: We have created a Z structure (ZNM_CUST_LIST) for the output list. Here are

    the fields for the structure:

    http://scn.sap.com/servlet/JiveServlet/showImage/131195/11.jpg
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    11/30

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/docs/DOC-31015 11/30

    We are all set with input and output structures.

    Now, lets fetch the data. Here is the only coding part came up in SAP. Look at below screen.

    http://scn.sap.com/servlet/JiveServlet/showImage/131196/12.jpg
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    12/30

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/docs/DOC-31015 12/30

    Here, we are select ing all the customer details from the KNA1 (customer master) table from the

    input table (ET_KUNNR) from excel file and return to the table (ET_CUST_LIST).

    http://scn.sap.com/servlet/JiveServlet/showImage/131197/13.jpg
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    13/30

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/docs/DOC-31015 13/30

    Now we have all the records in the table ET_CUST_LIST.

    So, again congratulation friends! You have completed most of the things. The remaining step

    now is to display the list in the excel file.

    Lets now connect the SAP and MS Excel.

    Go to the Developer tab and click on Visual Basic icon.

    he VB editor will be opened and we are going to write the code for connection of excel and

    SAP with sending and receiving data.

    Here is the variable declaration list. These are the global variables. Lets understand each of

    hem.

    Variable Description

    3/21/2014 SAP C ti it ith MS E l | SCN

    http://scn.sap.com/servlet/JiveServlet/showImage/131199/15.jpghttp://scn.sap.com/servlet/JiveServlet/showImage/131198/14.jpg
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    14/30

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/docs/DOC-31015 14/30

    objBAPIControl For creating object to access SAP functions.

    objgetaddress To make BAPI function call via objBAPIControl.

    vLastRow Last row of output list

    vRows Total number of records returned from the SAP

    vcount_add Variable for increment records

    Index_add Variable for next record (Index)

    objaddress Object for SAP table (for customer master output)

    objkunnr Object for SAP table (for customer master input)

    Here are the properties for the Get Address button.

    3/21/2014 SAP Connectivitywith MS Excel | SCN

  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    15/30

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/docs/DOC-31015 15/30

    Lets code when Get Address button is clicked.

    Setup the local variables

    3/21/2014 SAP Connectivitywith MS Excel | SCN

    http://scn.sap.com/servlet/JiveServlet/showImage/131200/16.jpg
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    16/30

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/docs/DOC-31015 16/30

    Variable Description

    LogonControl Logon control is to make login in SAP.

    R3Connection Ro make connection to SAP R/3 using logon control.

    retcd Return Code

    SilentLogon If True no popup will ask to enter SAP login details

    Now lets setup the connection with SAP R/3 using following code.

    Lets do SAP Login here.

    3/21/2014 SAP Connectivitywith MS Excel | SCN

    http://scn.sap.com/servlet/JiveServlet/showImage/131205/18.jpghttp://scn.sap.com/servlet/JiveServlet/showImage/131204/17.jpg
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    17/30

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/docs/DOC-31015 17/30

    Perfect!! We have made the connection with SAP R/3. Now we are able to send and receive

    he data from MS Excel to SAP R/3 and vice versa.

    But how to send my customer details and receive? Hmmm..we need to use internal tables

    hose are created in SAP function module. (Do you remember?....NO?... checkout Tables

    parameters in funct ion ZNM_GET_CUSTOMER_DETAILS). So, lets do this.

    Here, ZNM_GET_CUSTOMER_DETAILS is our function module created in SAP.

    ET_KUNNR: Customer details input details

    ET_CUST_LIST: Customer output details.

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/servlet/JiveServlet/showImage/131213/20.jpghttp://scn.sap.com/servlet/JiveServlet/showImage/131218/19.jpg
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    18/30

    y |

    http://scn.sap.com/docs/DOC-31015 18/30

    We are reading here each cell from excel worksheet for input.

    Here we have called the FM and passed the input details to process.

    Result:

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/servlet/JiveServlet/showImage/131215/22.jpghttp://scn.sap.com/servlet/JiveServlet/showImage/131214/21.jpg
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    19/30

    http://scn.sap.com/docs/DOC-31015 19/30

    vcount_add returns total number of records from the SAP. And we have already set the loop to

    display records in the cells.

    Here, R3Connection.Logoff is to sign off from your SAP account.

    Here is the output screen:

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/servlet/JiveServlet/showImage/131216/23.jpg
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    20/30

    http://scn.sap.com/docs/DOC-31015 20/30

    Wow!! We have output result. Good job!! But what is the use of another button Reset Output

    here? Yesgood question.

    he Reset Output button will clear all the data and messages from the screen. Look at below

    code:

    ----------------------------------------------------------------------------------------------------------------------

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/servlet/JiveServlet/showImage/131222/25.jpghttp://scn.sap.com/servlet/JiveServlet/showImage/131217/24.jpg
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    21/30

    http://scn.sap.com/docs/DOC-31015 21/30

    Now we have completed the entire example here. N joy.

    Here is the entire code:

    Option Explicit

    im objBAPIControl, objgetaddress As Object

    im vLastRow, vRows As Integer

    im vcount_add, index_add As Integer

    Public objaddress, objkunnr As SAPTableFactoryCtrl.Table

    Private Sub GetAddress_Click()

    'Local variables

    Dim LogonControl As SAPLogonCtrl.SAPLogonControl

    Dim R3Connection As SAPLogonCtrl.Connection

    Dim retcd As Boolean

    Dim SilentLogon As Boolean

    'Set Connection

    Set LogonControl = CreateObject("SAP.LogonControl.1")

    Set objBAPIControl = CreateObject("SAP.Functions")

    Set R3Connection = LogonControl.NewConnection

    'SAP connection

    R3Connection.Client = "810"

    R3Connection.ApplicationServer = "10.226.33.14"

    R3Connection.Language = "EN"

    R3Connection.User = "238499"

    R3Connection.Password = "xxx"

    R3Connection.System = "EC6"

    R3Connection.SystemNumber = "00"

    R3Connection.UseSAPLogonIni = False

    SilentLogon = False

    retcd = R3Connection.Logon(0, SilentLogon)

    If retcd True Then MsgBox "Logon failed": Exit Sub

    objBAPIControl.Connection = R3Connection

    3/21/2014 SAP Connectivity with MS Excel | SCN

  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    22/30

    http://scn.sap.com/docs/DOC-31015 22/30

    'Assign the Parameters

    Set objgetaddress = objBAPIControl.Add("ZNM_GET_CUSTOMER_DETAILS")

    Set objkunnr = objgetaddress.Tables("ET_KUNNR")

    Set objaddress = objgetaddress.Tables("ET_CUST_LIST")

    'Assign customer

    If ThisWorkbook.ActiveSheet.Cells(6, "B").Value "" Then

    objkunnr.Rows.Add

    objkunnr.Value(1, "SIGN") = ThisWorkbook.ActiveSheet.Cells(6, 2).Value objkunnr.Value(1, "OPTION") = ThisWorkbook.ActiveSheet.Cells(6, 3).Value

    objkunnr.Value(1, "LOW") = ThisWorkbook.ActiveSheet.Cells(6, 4).Value

    objkunnr.Value(1, "HIGH") = ThisWorkbook.ActiveSheet.Cells(6, 5).Value

    End If

    objgetaddress.call

    vcount_add = objaddress.Rows.Count

    For index_add = 1 To vcount_add

    vRows = 11 + index_add

    ActiveSheet.Cells(vRows, 2) = objaddress.Value(index_add, "KUNNR")

    ActiveSheet.Cells(vRows, 3) = objaddress.Value(index_add, "LAND1")

    ActiveSheet.Cells(vRows, 4) = objaddress.Value(index_add, "NAME1")

    ActiveSheet.Cells(vRows, 5) = objaddress.Value(index_add, "ORT01")

    ActiveSheet.Cells(vRows, 6) = objaddress.Value(index_add, "PSTLZ")

    ActiveSheet.Cells(vRows, 7) = objaddress.Value(index_add, "REGIO")

    ActiveSheet.Cells(vRows, 8) = objaddress.Value(index_add, "KTOKD")

    ActiveSheet.Cells(vRows, 9) = objaddress.Value(index_add, "TELF1")

    ActiveSheet.Cells(vRows, 10) = objaddress.Value(index_add, "TELFX")

    Next index_add

    'If address not exist then show error

    If vcount_add = "" Then

    ActiveSheet.Cells(10, 11) = "Invalid Input"

    Else

    ActiveSheet.Cells(10, 12) = "BAPI Call is successfull"

    ActiveSheet.Cells(11, 12) = vcount_add & " rows are returned"

    End If

    3/21/2014 SAP Connectivity with MS Excel | SCN

  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    23/30

    http://scn.sap.com/docs/DOC-31015 23/30

    Average User Rating

    (6 ratings)

    3 Tweet 5

    R3Connection.Logoff

    End Sub

    Private Sub ResetOutput_Click()

    LastRow = Cells(Rows.Count, "B").End(xlUp).Row

    For vRows = 12 To vLastRow

    ThisWorkbook.ActiveSheet.Cells(vRows, 2).Value = ""

    ThisWorkbook.ActiveSheet.Cells(vRows, 3).Value = ""

    ThisWorkbook.ActiveSheet.Cells(vRows, 4).Value = ""

    ThisWorkbook.ActiveSheet.Cells(vRows, 5).Value = ""

    ThisWorkbook.ActiveSheet.Cells(vRows, 6).Value = ""

    ThisWorkbook.ActiveSheet.Cells(vRows, 7).Value = ""

    ThisWorkbook.ActiveSheet.Cells(vRows, 8).Value = ""

    ThisWorkbook.ActiveSheet.Cells(vRows, 9).Value = ""

    ThisWorkbook.ActiveSheet.Cells(vRows, 10).Value = ""

    ext vRows

    ThisWorkbook.ActiveSheet.Cells(10, 12).Value = ""

    ThisWorkbook.ActiveSheet.Cells(11, 12).Value = ""

    End Sub

    (Note: Button properties need to be set)

    20057 View s Topics: abap, in-memory_business_data_management

    Share 3

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/community/abap/connectivity/tags#/?tags=in-memory_business_data_managementhttp://scn.sap.com/community/abap/connectivity/tags#/?tags=abaphttp://twitter.com/search?q=http%3A%2F%2Fscn.sap.com%2Fdocs%2FDOC-31015https://twitter.com/intent/tweet?hashtags=scn&original_referer=http%3A%2F%2Fscn.sap.com%2Fdocs%2FDOC-31015&text=SAP%20Connectivity%20with%20MS%20Excel&tw_p=tweetbutton&url=http%3A%2F%2Fscn.sap.com%2Fdocs%2FDOC-31015&via=SAPCommNet
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    24/30

    http://scn.sap.com/docs/DOC-31015 24/30

    19Comments

    Like (0)

    Sujeet KadamAug 23, 2012 7:44 AM

    Nicely explained. a step-by-step guide. Thanks for sharing!

    Like (1)

    Manuel AntunesDec 4, 2012 3:04 PM

    Excellent tutorial. Thank you!

    Like (0)

    Eddie WooMay 21, 2013 10:23 AM

    This is g reat! Is it poss ible to integrate date from more than one SAP function module to a sing le

    excel file?

    Like (0)

    Dmitry ShipulinMay 23, 2013 1:58 PM

    Very useful. Thank you!

    Like (0)

    Eddie WooMay 26, 2013 5:54 PM (in response to Dmitry Shipulin)

    No problem . Good luck buddy!

    Hari JanpareddyMay 27, 2013 6:01 PM

    Hi,

    I struck very badly with the below iss ue.

    I have to export data from SAP Tables (Eg: BUT000) to Excel. But I dont have Edit access in SAP only

    thing is I have view access i.e I cant write any program in ABAP editor. So Please help me in quering

    tables of SAP using VB Macro. I have to Query BUT000 table and fetch the information when

    3/21/2014 SAP Connectivity with MS Excel | SCN

    BPID="100002345" Please help me

    http://scn.sap.com/people/hari.janpareddyhttp://scn.sap.com/people/eddie.woohttp://scn.sap.com/people/dmitry.shipulinhttp://scn.sap.com/people/eddie.woohttp://scn.sap.com/people/mantuneshttp://scn.sap.com/people/sujeet.kadam
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    25/30

    http://scn.sap.com/docs/DOC-31015 25/30

    Like (0)

    BPID= 100002345 . Please help me.

    Thanks,

    Hari.

    Like (0)

    Surya kallakuriJul 20, 2013 5:09 PM

    Very useful. Thank you!

    Like (0)

    Praveen TyagiAug 6, 2013 4:29 PM

    Hi - I am getting "User de fined Type not defined" error on "SAPTableFactoryCtrl.Table"

    can you tell me which REFERENCE do I need to s elect in EXCEL.

    Thanks!

    Like (0)

    Giriesh mamuruganAug 26, 2013 4:01 PM (in response to Praveen Tyagi)

    Hi Praveen,

    Please Declare the below in VB Sheet1

    Option Explicit

    Private LogonControl As SAPLogonCtrl.SAPLogonControl

    Private R3Connection As SAPLogonCtrl.Connection

    Private TableFactory As SAPTableFactory

    Public Functions As SAPFunctionsOCX.SAPFunctions

    Dim ob jBAPIControl, objgetaddressn As Object

    Dim vLastRow, vRows As Integer

    Dim vcount_add, index_add As Integer

    Private objaddres s, objkunnr As SAPTableFactoryCtrl.Table

    It will not give any error.

    Jeffrey QuesadaSep 24, 2013 11:58 PM (in response to Giriesh mamurugan)

    Hello.

    I am still having the error "User defined Type not defined", do I need to s elect any

    3/21/2014 SAP Connectivity with MS Excel | SCN

    reference?

    http://scn.sap.com/people/jeffrey.quesadahttp://scn.sap.com/people/giriesh.mamuruganhttp://scn.sap.com/people/praveen.tyagi2http://scn.sap.com/people/surya.kallakuri
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    26/30

    http://scn.sap.com/docs/DOC-31015 26/30

    Like (0)

    reference?

    Thank you in advance,

    Jeffrey

    Giriesh mamuruganAug 26, 2013 4:16 PM

    Hi Rohny,

    When I am trying to login the SAP system from Excel it is showing me an error

    When I am connecting using rem ote desktop of my client

    SAP_CMINIT3 : rc=20 > Connect to SAP gateway failed and please find the details:

    Error Group

    RFC_ERROR_COMMUNICATION

    Message

    SAP_CMINIT3 : rc=20 > Connect to SAP gateway failed

    Connect_PM GWHOST=212.78.237 .247, GWSERV=sapgw00, SYSNR=00

    LOCATION CPIC (TCP/IP) on local host

    ERROR partner '212.78.237.247:3300' not reachedTIME Mon Aug 26 15:03:37 2013

    RELEASE 720

    COMPONENT NI (network interface)

    VERSION 40

    RC -10

    MODULE nixxi.cpp

    LINE 3286

    DETAIL NiPConnect2: 212.78.237.247:3300

    SYSTEM CALL connect

    ERRNO 10060

    ERRNO TEXT WSAETIMEDOUT: Connection tim ed out

    COUNTER 1

    *******************************************************************************************

    When I am trying it from my system:

    CMALLC: rc=27 > Connect from SAP Gateway to RFC server failed.

    Please find the Details below:

    Error Group

    RFC_ERROR_COMMUNICATION

    Message

    CMALLC : rc=27 > Connect from SAP gateway to RFC server failed

    3/21/2014 SAP Connectivity with MS Excel | SCN

    Connect PM GWHOST=212.78.237 .247, GWSERV=sapgw00, SYSNR=00

    http://scn.sap.com/people/giriesh.mamurugan
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    27/30

    http://scn.sap.com/docs/DOC-31015 27/30

    Like (0)

    Connect_PM GWHOST 212.78.237 .247, GWSERV sapgw00, SYSNR 00

    LOCATION SAP-Gateway on host HEXLSVR001.dixons.co.uk / sapgw00

    ERROR timeout during allocate

    TIME Mon Aug 26 15:14:24 2013

    RELEASE 720

    COMPONENT SAP-Gateway

    VERSION 2

    RC 242

    MODULE gwr3cpic.c

    LINE 2025

    DETAIL no connect of TP sapdp00 from host 212.78.237.247 after 20 secCOUNTER 2

    *******************************************************************

    Can you please tell me anything further has to be done other than the mentioned in the blog.

    Like (0)

    Erwin LeitnerAug 31, 2013 8:18 PM

    Hello,

    Thank you for sharing knowledge

    all the best erwin

    Like (0)

    Madhu VadlamaniSep 4, 2013 7:53 AM

    Good one.

    Jeffrey QuesadaSep 25, 2013 6:11 PM

    Hello.I am having the following error "User defined Type not defined", when the system tried to compile

    line:

    Public objaddres s, ob jkunnr As SAPTableFactoryCtrl.Table

    Do I need to select any reference?

    Thank you in advance,

    Jeffrey

    3/21/2014 SAP Connectivity with MS Excel | SCN

    Like (0)

    http://scn.sap.com/people/jeffrey.quesadahttp://scn.sap.com/people/madhu.vadlamanihttp://scn.sap.com/people/erwin.leitner
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    28/30

    http://scn.sap.com/docs/DOC-31015 28/30

    Like (0)

    Like (0)

    Siddharth PatelNov 26, 2013 9:19 AM

    Hi Giriesh,

    I am ge tting "User defined Type not defined" error on Publ ic Functions As

    SAPFunctionsOCX.SAPFunctions.

    After implem enting the changes in your comment.

    Can you please help me with the issue.

    Thanks in advance,

    Sidd

    Like (0)

    Giriesh mamuruganNov 26, 2013 1:24 PM (in response to Siddharth Patel)

    Hi Siddharth,

    Paste this code in the sheet1 o f your VB Script.

    Hope you are doing it in the Module and because of that you are getting the error.The code below to enter:

    Option Explicit

    Private LogonControl As SAPLogonCtrl.SAPLogonControl

    Private R3Connection As SAPLogonCtrl.Connection

    Private TableFactory As SAPTableFactory

    Public Functions As SAPFunctionsOCX.SAPFunctions

    Dim objBAPIControl, objgetaddressn As Object

    Dim vLastRow, vRows As Integer

    Dim vcount_add, index_add As Integer

    Private objaddress, objkunnr As SAPTableFactoryCtrl.Table

    I am unable to attach screen shot, so I will try to explain it in words:choose visual basic option from the developer key, you can see

    VBAProject(name of your excel) followed by Microsoft excel projects folder and if you

    expand it you can s ee the s heet1, were you can post the above code. If you are s till facing

    the issue pleas e revert back.

    With Regards,

    Giriesh M

    3/21/2014 SAP Connectivity with MS Excel | SCN

    Siddh th P t l N 27 2013 8 03 AM (i t Gi i h )

    http://scn.sap.com/people/giriesh.mamuruganhttp://scn.sap.com/people/siddharth.patel2http://scn.sap.com/people/siddharth.patel2
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    29/30

    http://scn.sap.com/docs/DOC-31015 29/30

    Like (0)

    Siddharth PatelNov 27, 2013 8:03 AM (in response to Giriesh mamurugan)

    Hi ,

    Thanks for your reply but i am still getting the same error.

    Error with

    Public Functions As SAPFunctionsOCX.SAPFunctions as not defined.

    Regards,

    Sidd

    Like (0)

    Siddharth PatelNov 27, 2013 2:12 PM (in response to Giriesh mamurugan)

    Hi Giriesh,

    I have tried a lot but nothing w orks sam e error everytime.

    I wanted to know is there any tools->references needs to be enabled for this.

    If not then, please let me know the s olution.

    Regards,Sidd

    Like (0)

    Giriesh mamuruganNov 29, 2013 12:39 PM (in response to Siddharth Patel)

    Hi Siddharth,

    You dont want to do anything explicit other than m ention in this blog. I

    am not in the exact position to say what went wrong. Please m ention your

    mail Id so that I can s end the excel which I have done for your reference.

    (But it is not completed till the end , as I am facing connectivity iss ue).

    With Regards,

    Giriesh M

    3/21/2014 SAP Connectivity with MS Excel | SCN

    http://scn.sap.com/people/giriesh.mamuruganhttp://scn.sap.com/people/siddharth.patel2http://scn.sap.com/people/siddharth.patel2
  • 7/22/2019 SAP Connectivity With MS Excel _ SCN

    30/30

    http://scn.sap.com/docs/DOC-31015 30/30

    Follow SCNSite Index Contact Us SAP Help Portal

    Privacy Terms of Use Legal Disclosure Copyright

    http://www.sap.com/corporate-en/our-company/legal/copyright/index.epxhttp://www.sap.com/corporate-en/our-company/legal/impressum.epxhttp://www.sdn.sap.com/irj/scn/policyhttp://www.sdn.sap.com/irj/scn/policy?view=PPhttp://help.sap.com/http://scn.sap.com/docs/DOC-18476http://scn.sap.com/docs/DOC-19361http://spr.ly/SCNgoogleplushttp://bit.ly/SCNLnIhttp://bit.ly/SCNyouThttp://bit.ly/SCNFBhttp://bit.ly/SCNTwR