BAPI-VB Connect Error

Advertisement
Hi Experts
I have used the following code which gives error in the line
If con.logon(0, False) True Then.
whats the reason, can anyone explain and correct me.
Regards
Rajaram
Private Sub Command1_Click()
Set bapictrl = CreateObject("SAP.BAPI.1")
Set con = bapictrl.Connection
con.Client = "391"
con.User = "sap01"
con.password = "victory"
con.Language = "EN"
If con.logon(0, False) True Then
MsgBox "No connection to R/3!"
Exit Sub 'End program
Else
MsgBox "connection to R/3 Successful!"
End If
End Sub
Private Sub Command2_Click()
Dim x As String
Set Obj = bapictrl.GetSAPObject("ZEMPLOYEE")
Set Header = bapictrl.DimAs(Obj, "ZBAPIEMP", "EMPDB")
Set sreturn = bapictrl.DimAs(Obj, "ZBAPIEMP", "Return")
Header.Value("code") = TextBox1.Text
Header.Value("name") = TextBox2.Text
Header.Value("salary") = TextBox3.Text
Obj.zbapiemp EMPDB:=Header, RETURN:=sreturn
x = sreturn.Value("message")
If x = "" Then
MsgBox "Created Successfully........"
Else
MsgBox x
End If
End Sub
Private Sub Command3_Click()
End
End Sub
Advertisement

Replay

Hi,
Go Through the Follwing Code:
INCLUDE BAPI OBJECT FROM REFRENCES FIRST.
Code
Option Explicit
Dim functionCtrl As Object
Dim sapConnection As Object
Dim theFunc As Object
Dim PoNumber
Private Sub Command1_Click()
Set functionCtrl = CreateObject("SAP.Functions")
Set sapConnection = functionCtrl.Connection
sapConnection.Client = "500"
sapConnection.user = "USERNAME"
sapConnection.password = "PASSWORD"
sapConnection.Language = "EN"
If sapConnection.logon(0, False)  True Then
    MsgBox "No connection to R/3 System"
    Exit Sub                                           'End program
End If
Set theFunc = functionCtrl.Add("BAPI_PO_CREATE")
Dim poheader As Object
Dim poitems As Object
Dim poitemschedule As Object
Dim retMess As Object
Dim returnFunc As Boolean
Dim startzeil As Integer
Dim endcol As Integer
Dim the_name As String
Set poheader = theFunc.exports.Item("PO_HEADER")
Set poitems = theFunc.tables.Item("PO_ITEMS")
Set poitemschedule = theFunc.tables.Item("PO_ITEM_SCHEDULES")
poheader.Value("VENDOR") = Text1.Text
poheader.Value("PURCH_ORG") = Text2.Text
poheader.Value("PUR_GROUP") = Text3.Text
poheader.Value("DOC_TYPE") = Text4.Text 
poitems.Rows.Add
poitems.Value(1, "PUR_MAT") = Text5.Text
poitems.Value(1, "PLANT") = Text6.Text
poitems.Value(1, "NET_PRICE") = Text7.Text 
poitemschedule.Rows.Add
poitemschedule.Value(1, "DELIV_DATE") = Text8.Text
poitemschedule.Value(1, "QUANTITY") = Text9.Text 
returnFunc = theFunc.call
PoNumber = theFunc.imports("PURCHASEORDER")
Set retMess = theFunc.tables.Item("RETURN")
If retMess Is Nothing Then
MsgBox retMess.Value(1, "MESSAGE")
Else
MsgBox "Purchase Order No : " & PoNumber & "Created"
End If
End Sub
Hope it will solve your problem.
Thanks
Rajesh Kumar

Connection error on ichat with 10.5.5

hi, I´ve a problem with ichat on my imac with 10.5.5. there is a communication error when video chat shoud start. my wife´s macbook with 10.5.5 an nearly the same software and configuration have no problems. her´s working fine with other people and I

RFC Connection Error during Web AS ABAP Database Instance

I keep getting RFC Connection error installing the database instance.  The following are the pertinent logs: INFO 2007-05-09 20:10:04 Working directory changed to C:\Program Files\sapinst_instdir\NW04\SYSTEM\ABAP\MSS\UC\DB. INFO 2007-05-09 20:10:04 O

The video player is in the connection error state.

Flash cS 5.5 / Win 7. Inserting video into movieclip both with 'import video' wizard and via component. FLV that plays fine on a number of different servers. On opening (after gathering metadata) the message 'The video player is in the connection err

PDP connection error when not on wi-fi

This has probably been asked elsewhere so sorry in advance if it has!! Since leaving the house this morning (I use wifi at home) I've had "no network connection" even though I have full 3G signal! I've tried the hard reset & reset from the s

OBIEE 11g database connection error after deploying to server.

Hi, I deployed RPD to obiee 11g server and when I run a report it is giving database connectivity error. In 10g we just specify OLAP_DSN, OLAP_USER and same in connection pool with database password. I did the same in 11g as well but it's not working

Connection error- N91, and battery life

I have been using Nokia mobiles for the last 10 years, usually with Orange, but now switched to O2. 1. Had the phone a week and when in conversation with someone the call just drops - done this a few times. The signal is still on maximum. Anyone had

RFC connection error (VPN-access)

Hi! I have the following error for the RFC connection: The RFC connection is setup as follows. /H/10.101.7.1/S/3299/H/10.151.6.194 10.101.7.1 = IP of our SAP Router 10.151.6.194 = IP of customer system The RFC connection is established: SAP Router (i

Database Connection error in Crystal Reports using SAP BW system

Hi, While using Crystal Reports in trying to build a report on the SAP Query in SAP/BW System using the MDX driver, I am able to get the structure of the query fields into the report but on the other hand while trying to refresh the report for data I

Why am I getting a "connection error" when trying to buy a paid app in the Mac App Store?

Okay, so I am currently running OS X Mountain Lion on a brand new Macbook Pro 15 inch (early 2013). I haven't had any problems so far. However, today I tried buying a $10 app in the app store, and when I put in my login credentials to validate the pu

Server Connection Error

Hello, I'm trying to scan a document to send to my email and I get the Server Connection Error message.  I've tried several possible solutions that I saw online but nothing has worked.  I've also added the Scan to Email app and it gives me the same m

Closed connection error when connection isn't being closed

Hi, Currently I am trying to connect to an Oracle 11g database via JDBC. However, everytime I run the code I get the following error: java.sql.SQLException: Closed Connection at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:

Handle the Network Connection Error ...

The main purpose is to handle the Network Connection Error, when there is a Network Connection Error or pc loss the connection (remove the ETH cable), and it work in IE but not with firefox. When there isn't connection during play of sound1, Flash ca

OS X LION 10.8.2 connection error with AFP

Ok the issue is that i tried to access my external harddrive over AFP with OS X LION and got a error message like this one above. I couldn't login with a registered user . We had the same problem in a earlier update but somehow got around it follwing

N70 Connection Errors

I've seen a couple of mentions of this issue on the forum but don't think I've seen a fix for it yet. I've just upgraded to an N70 (Vodafone Pay monthly through CPW) and have on several occasions now found that my phone appears to have dropped off th

E61i - Connection error in "Dual mode"

Yesterday, after 2 months of normal usage, my E61i, settled on "dual mode", stopped to work. On the screen it appears instead of "3G" the symbol of an antenna (GSM connection) without the name of the operator. If I try to make a call i

6680 no txt/connection error

Hi there, I updated my phone from the version 4.x firmware to the latest version of it which is v5.04.07. After updating my phone, i hoped that it would be problem free but it is not. After the update, the phone has got two new random problems which

HP Web Services keeps returning a no internet connection error. HP1025nw

I am trying to setup the eprint service to work on my printer.  When I try to enable web-service on my printer, it returns an error message saying, there is no internet connection. I have updated the firmware as specified thru eprnt support, and stil

Unable to Connect error 948 via SQL

System Center 2012 DPM trying to connect to a SQL instance on a different server using Windows Authentication. Getting the unable to connect error "Unable to cnnect to xxx.domain.com (ID: 948) Verify that the DPM service is running on this computer&q

MLB at Bat 2011 no audio only connection error

I do not get any audio with my iPhone 4 using the MLB.com at Bat 11 app. Whenever I go to the audio all I get is a connection error. I have sent emails to MLB.com at Bat 11 4 times not and have not had a responce. Is there something I can do to remed