Skip to Content
0
Former Member
May 28, 2008 at 04:08 AM

How do I enter a data to B1 form via windows form?

23 Views

I'm trying to add the data from a windows form, to the SAP B1 form (e.g. Sales order), now i'm just trying 1 component only which is the CustCode.

I've been thinking about this but i can't figure it out like how's the structure of the class I should create...

In my VBproj (VS_2005), i have a simple form (just "TextBox1" and "Button1"), then I have a class "appending.vb":

Option Strict Off

Option Explicit On

Public Class appending

Public oItem As SAPbouiCOM.Item

Public oTextbox As SAPbouiCOM.EditText

Private WithEvents SBO_Application As SAPbouiCOM.Application

Private Sub SetApplication()

Dim SboGuiApi As New SAPbouiCOM.SboGuiApi

Dim sConnectionString As String

sConnectionString = Environment.GetCommandLineArgs.GetValue(1)

SboGuiApi.Connect(sConnectionString)

SBO_Application = SboGuiApi.GetApplication()

End Sub

Public Sub New()

MyBase.New()

SetApplication()

End Sub

End Class

and also Form1.vb class:

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim oappend As New appending

If oappend.oitem.UniqueID = 4 Then

oappend.oitem.String = TextBox1.Text

End If

End Sub

End Class

Note that unique ID 4 is because i searched in the system information (CtrlSfihtD) that the customerID in the sales order form has the Item = 4, which is the unique ID, but this property is readonly prop, so that I can't directly instruct to append the data from textbox1 to the item where unique ID is 4 (..UniqueID = 4..)

I know my code just wont work at all, but i'm really have no more idea about this....

critics, comment and idea please...

Thanks,

Martin