SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Creting PO through Visual Basic

Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ
View previous topic :: View next topic  
Author Message

Joined: 01 Sep 2007
Posts: 1636

PostPosted: Wed Apr 02, 2008 11:03 pm    Post subject: Creting PO through Visual Basic Reply with quote

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 = "220"
sapConnection.User = "PTBITUSR"
sapConnection.Password = "HELLO2"
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 pocur As Object
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")
Set pocur = theFunc.exports.Item("PO_HEADER_ADD_DATA")
poheader.Value("VENDOR") = "0024001291" 'Text1.Text

poheader.Value("PUR_GROUP") = "PE6" '''Text3.Text
poheader.Value("DOC_TYPE") = "NB" ''Text4.Text

poitems.Value(1, "PUR_MAT") = "SC101" ''Text5.Text
poitems.Value(1, "PLANT") = "1500" ''Text6.Text
poitems.Value(1, "NET_PRICE") = "2000" ''Text7.Text

poitemschedule.Value(1, "DELIV_DATE") = DTPicker1.Value
poitemschedule.Value(1, "QUANTITY") = 3 'Text9.Text
pocur.Value("CURRENCY") = "INR"
poheader.Value("PURCH_ORG") = "1500" '''Text2.Text

returnFunc =
PoNumber = theFunc.imports.Item("PURCHASEORDER")
Set retMess = theFunc.Tables.Item("RETURN")
If retMess Is Nothing Then

MsgBox retMess.Value(1, "MESSAGE")
MsgBox retMess.Value(1, "MESSAGE")
MsgBox "Purchase Order No : " & PoNumber & "Created"

End If

End Sub
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ All times are GMT + 4 Hours
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.