Results 1 to 4 of 4

Thread: VBA Excel and SAP

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    4

    VBA Excel and SAP

    Hi,
    I have a sample VBA code for a connction to Sap usin a macro Excel.

    I find this kind of VB Object:

    Dim objTable As Object ' Sap Table retrieved

    I wish to know more exackty about this object for retrieving field information and filling Excel cells or List Box.

    Any help will be well appreciated.

    Thanks in advance

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: VBA Excel and SAP

    Welcome to the Forums.

    Dim objTable As Object is an example of Late Binding. What it does it decalre a variable as a generic Object.
    Then when the code tries to CreateObject as a particular type the system determines if the type is available on
    the system. What type of program is SAP? And could you post more code to see if someone could be able
    to determine it?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    4

    Re: VBA Excel and SAP

    Hi RobDog888,
    and thanks for the reply!
    I need to write a macro Excel for receiving info from a SAP Table.
    I have this example but I need explanation about the object Table.
    More exactly I find the definition of the table

    Dim objTable As Object

    then a function return a table ...

    Set objTable = MyFunction.Tables("TABLE NAME")

    where Dim MyFunction as Object
    Dim oSapFunctions As Object
    Set MyFunction = oSapFunctions.Add("Function Name")

    etc ... call the function

    Then I found

    (case one)

    For Each Customer In objTable.Rows
    cells(i,1) = Customer("NAME1")
    cells(i,2) = Customer("NAME2")
    ...
    i=i+1
    Next

    (case two)

    For longColIndex = 1 to objTable.ColumnCount
    msgbox objTable.Columns(longColIndex).ColumnInfo.TypeName
    Next

    The result of the case two????
    I need to store all data of my table, row after row in a strucure type and I'll find a date format. In VB how can I handle this situation avoiding errors in variables with type not correct?

    If this SAP Table is considered as a normal table, where can I find methods end attributes? Where can I find a documentation?
    Thanks in advance for your kind support.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: VBA Excel and SAP

    So SAP is some kind of database? If it is then it should have some kind of database or table schema.
    Schema is the design and definition of the structure which makes up the table. You may be able to then loop
    through the table schema recording its data.

    HTH
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width