Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 6th, 2007, 10:27 PM
Registered User
 
Join Date: Aug 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Excel and VBA

Hi experts
Need ur help
Actually what am i trying to do is to call the BAPI and display the data on to the SAP tableview the SAP connection is fine and the input parameters are also working fine but i m badly stuck in displaying the data on to the SAP table view kidly help
Just posting the code that i m using or if any other way out to it kindly inform me


Public Sub callBAPI()

Dim oBAPIHelp As Object
Dim oIAstnr As Object, oIAstna As Object 'Input parameters
Dim oReturn As Object, oMessages As Object



If Not CheckSAPConnection Then
    Exit Sub
End If

'Make an instance of SAP object

Set oBAPIHelp = objBAPIControl.GetSAPObject("BAPISHELP")


'Set input parameters of the BAPI

'Set oIAstnr.Value = "022"
'Set oIAstna.Value = "*Luis*"


'Get a reference to the output parameters so they can be consulted
'after calling the BAPI
Set oApplHelp = objBAPIControl.DimAs(oBAPIHelp, "ApplicantHelp", "APPLHELP")
'Set oMessages = objBAPIControl.DimAs(oBAPIHelp, "ApplicantHelp", "MESSAGES")
'Set oReturn = objBAPIControl.DimAs(oBAPIHelp, "ApplicantHelp", "RETURN")


'Call object's method with applicant name *Care*
oBAPIHelp.ApplicantHelp _
               IAstnr:=frmApplicant.txtApplicantNo, _
               IAstna:=frmApplicant.txtApplicantName, _
               ApplHelp:=oApplHelp, _
               MESSAGES:=oMessages, _
               RETURN:=oReturn

If oApplHelp.RowCount > 0 Then
Call ShowData
    'MsgBox "Data found"
Else
    On Error Resume Next
    MsgBox "Errors."
End If

End Sub


------------------Show Data Method----------------------

Private Sub ShowData()
Dim Col As Object

'Connect Table object with the Table View
oApplHelp.Views.Add UserForm1.SAPTableView1.Object

[GIVES AN ERROR SAYING THAT OBJECT DOESN'T SUPPORT THIS PROPERTY]

'Table Update
oApplHelp.Refresh
[GIVES AN ERROR SAYING THAT OBJECT DOESN'T SUPPORT THIS PROPERTY]


Set Col = UserForm1.SAPTableView1
'Loop at table columnsFor Each Col In oApplHelp.Columns
For Each Col In oApplHelp.Columns
    UserForm1.SAPTableView1.Columns(Col.Index).Name = Col.Name
    UserForm1.SAPTableView1.Columns(Col.Index).Protect ion = True
Next Col


'Column Headings
UserForm1.SAPTableView1.Columns("I_ASTNR").Header = "Applicant No"
UserForm1.SAPTableView1.Columns("I_ASTNA").Header = "Applicant Name"


'Automatically adopt column width to contents
UserForm1.SAPTableView1.ColumnAutoWidth 1, UserForm1.SAPTableView1.ColumnCount

End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
Code works in Excel VBA but not Access VBA fossx Access VBA 2 May 21st, 2007 08:00 AM
New to Excel VBA anukagni Excel VBA 0 June 24th, 2006 05:51 AM
Converting excel data to Access using excel VBA ShaileshShinde VB Databases Basics 1 April 26th, 2006 07:57 AM
VBA Excel jayanp Access VBA 3 December 16th, 2004 03:18 AM
Excel VBA to SQL & back to VBA edesousa Excel VBA 1 June 1st, 2004 02:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.