2012 Jan 07 8:05 AM
Dear Gurus
(I am new to BAPI)
I have one Z table ZZONE_SMS. I have created a BAPI which is having one import field ZZone, one export field RETURN (Sale_Qty) and one i table IZONETAB. When I test BAPI and give ZZone parameter the BAPI return me the sale_qty figure.
I want to access it in VB Code. I am connected to TRN server through RFC and connection successful. Kindly guide me how I can have the sale_qty value in my VB code.
1. Am I missing something in my BAPI. Please guide me.
2. How I can have sale_qty it in VB.
regards,
RSA
Dear Gurus
(I am new to BAPI)
I have one Z table ZZONE_SMS. I have created a BAPI which is having one import field ZZone, one export field RETURN (Sale_Qty) and one i table IZONETAB. When I test BAPI and give ZZone parameter the BAPI return me the sale_qty figure.
I want to access it in VB Code. I am connected to TRN server through RFC and connection successful. Kindly guide me how I can have the sale_qty value in my VB code.
1. Am I missing something in my BAPI. Please guide me.
2. How I can have sale_qty it in VB.
regards,
RSA
2012 Jan 09 4:52 AM
Hi,
Can you place the VB code, so that i ca help you.
How you are calling bapi using Vb
2012 Jan 09 8:01 AM
Private Sub Command1_Click()
Dim oBapiCtrl As Object
Dim oBapiLogon As Object
Dim oData As Object
Dim oItem, oReturn As Object
Dim iIndex As Integer
Dim oTable As Object
Set oBapiCtrl = CreateObject("sap.bapi.1")
Set oBapiLogon = CreateObject("sap.logoncontrol.1")
oBapiCtrl.Connection = oBapiLogon.NewConnection
oBapiCtrl.Connection.ApplicationServer = "192.168.2.219"
oBapiCtrl.Connection.System = "TRN"
oBapiCtrl.Connection.Client = "600"
oBapiCtrl.Connection.User = "xcom"
oBapiCtrl.Connection.Password = "abcdef"
oBapiCtrl.Connection.Language = "EN"
oBapiCtrl.Connection.SystemNumber = "00"
If oBapiCtrl.Connection.Logon(0, True) <> True Then
MsgBox "not connected", vbInformation, "SAP Logon"
Exit Sub
End If
If oBapiCtrl.Connection.Logon(0, True) <> False Then
MsgBox "SAP " & oBapiCtrl.Connection.System & " Connected!!!!", vbInformation, "SAP Logon"
End If
If oBapiCtrl.Connection.IsConnected Then
Set oData = oBapiCtrl.GetSAPObject("ZBapisms", "LALAMUS")
Set oTable = oBapiCtrl.DimAs(oData, "BapismsFm", "IZONETAB") 'DimAs only initialize the table/structure
MsgBox (oTable.ColumnCount)
MsgBox (oTable.RowCount)
For i = 1 To oTable.ColumnCount 'I only can get the column names from said table IZONETAB
MsgBox (oTable.Columns(i).Name)
Next i
''' there is no value as table opened with DimAs (Initialized)
MsgBox (oTable.Columns("ZZONE").Value(1))
MsgBox (oTable.Columns("SALE_QTY").Value(1))
End If
End Sub
2012 Jan 09 9:32 AM
Hi,
You are extracting only table values. If you need export parameters values, use structure in vbcode
2012 Jan 10 4:43 AM
How I can call structure and how i can use it in my code, can u pls give some example (VB CODE).
Thanks
RSA
2012 Jan 10 11:57 AM
Hi,
RfcDestination prd = RfcDestinationManager.GetDestination("SE37");
RfcRepository repo = prd.Repository;
IRfcFunction getdaterfcfunction = repo.CreateFunction("BAPI_DATESPECS_GETDETAILEDLIST");
getdaterfcfunction.SetValue("EMPLOYEENUMBER",
Login1.UserName);
IRfcTable getdaterfctable=getdaterfcfunction["DATESPECIFICATIONSDATA"].GetTable();
// IRfcStructure getdaterfcstructre = getdaterfctable[0] as IRfcStructure;
getdaterfcfunction.Invoke(prd);
getdaterfctable[0]["VALIDBEGIN"].GetString();
//Session["PERNR"] = ir["PERNR"].GetString();
Session["BEGDA"] = getdaterfctable[0]["VALIDBEGIN"].GetString();
Session["ENDDA"] = getdaterfctable[0]["VALIDEND"].GetString();
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |