on 08-06-2007 12:55 PM
Hi experts need your help
Actually i m trying to call a bapi using a bapi control and display the data on to a SAP Table view the thing is SAP connection is working fine and the data is also getting retrived but the ShowData method is not working
Even the bapi control is working fine
BADLY STUCK KINDLY HELP
Just posting the code below which is in use
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----
Public Sub ShowData()
Dim Col As Object
'Connect Table object with the Table View
oApplHelp.Views.Add UserForm1.SAPTableView1.Object
(THE ABOVE STATEMENT GIVES AN ERROR SAYING OBJECT DOESN'T SUPPORT THIS PROPERTY OR METHOD)
'Table Update
oApplHelp.Refresh
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).Protection = 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
Hi,
Try to Download APOLoader and see it can connect properly to SAP. Look on the APOLoader code.. (It has full logic to save and retrieve from APO..)
/Shibi
Thanks for rewarding points if this is helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
4 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.