priya_antony
08-09-2007, 08:59 PM
kindly help trying to call the BAPI and it is working fine but the thing is the show data method is not working fine
oApplHelp.Views.Add UserForm1.SAPTableView1.Object this line gives an error saying that object doesn't support this property or method
so kindly help Badly stuck
Public Sub callBAPI()
Dim BAPISHELP As Object
Dim oIAstnr As Object, oIAstna As Object 'Input parameters
Dim oReturn As Object, oMessages As Table
If Not CheckSAPConnection Then
Exit Sub
End If
'Make an instance of SAP object
Set BAPISHELP = objBAPIControl.GetSAPObject("ZPCCHELP")
'Get a reference to the output parameters so they can be consulted
'after calling the BAPI
Set oApplHelp = objBAPIControl.DimAs(BAPISHELP, "ApplicantHelp", "APPLHELP")
Set oMessages = objBAPIControl.DimAs(BAPISHELP, "ApplicantHelp", "MESSAGES")
Set oReturn = objBAPIControl.DimAs(BAPISHELP, "ApplicantHelp", "RETURN")
'Call object's method with applicant name *Care*
BAPISHELP.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
'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
Thanks
Priya
oApplHelp.Views.Add UserForm1.SAPTableView1.Object this line gives an error saying that object doesn't support this property or method
so kindly help Badly stuck
Public Sub callBAPI()
Dim BAPISHELP As Object
Dim oIAstnr As Object, oIAstna As Object 'Input parameters
Dim oReturn As Object, oMessages As Table
If Not CheckSAPConnection Then
Exit Sub
End If
'Make an instance of SAP object
Set BAPISHELP = objBAPIControl.GetSAPObject("ZPCCHELP")
'Get a reference to the output parameters so they can be consulted
'after calling the BAPI
Set oApplHelp = objBAPIControl.DimAs(BAPISHELP, "ApplicantHelp", "APPLHELP")
Set oMessages = objBAPIControl.DimAs(BAPISHELP, "ApplicantHelp", "MESSAGES")
Set oReturn = objBAPIControl.DimAs(BAPISHELP, "ApplicantHelp", "RETURN")
'Call object's method with applicant name *Care*
BAPISHELP.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
'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
Thanks
Priya