The OneStream Community is temporarily frozen until June 29th due to the ongoing maintenance. Please read the blog post here to learn more.
Forum Discussion
PrithviK
2 years agoNew Contributor III
Extract data from BAPI_AP_ACC_OPENITEMS
Hello Everyone,
Has anyone done an extract for BAPI "BAPI_AP_ACC_OPENITEMS" using RFC connection from SAP. I have below code, any suggestions here. What will be the Imports if we have to extract 7-10 columns in the extract ?
Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Transformer, ByVal args As ConnectorArgs) As Object
Dim r3Conn As R3Connection
Try
'Create and open the R3 Connection
r3Conn = Me.GetConnection(si, globals, api)
r3Conn.Open()
Dim r3Func As RFCFunction = r3Conn.CreateFunction("BAPI_AP_ACC_GETOPENITEMS")
r3Func.Exports("CompanyCode").ParamValue = "1000"
r3Func.Execute()
Return r3Func.Imports("").ToTable()
' End Select
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
Finally
If Not r3Conn Is Nothing Then r3Conn.Close
End Try
End Function
6 Replies
- PrithviKNew Contributor III
If I add the above line. Replaced TB with LINEITEMS for AP Open Items table.
Return r3Func.Imports("LINEITEMS").ParamValue.ToADOTable(). I am getting below error
Public member 'ToADOTable' on type 'RFCStructure' not found.
- Nikpowar97Contributor
Hi Prithvi,
I assume you are running a SIC Rule, Can you give this a try:' Define which columns to import Dim imports As New RFCStructure() imports.AddField("Field1") ' Example: Field1 imports.AddField("Field2") ' Example: Field2 ' Add more fields as needed ' Import the specified columns into a table Dim dataTable As DataTable = r3Func.Imports("").ToTable(imports)Replace "Field1", "Field2" with the actual field names you want to extract from the BAPI response. Make sure these fields correspond to the fields available in the BAPI result set. This should allow you to extract the desired columns from the BAPI response.
Thanks,
Nikhil- PrithviKNew Contributor III
Hi Nikhil, this is not SIC, rather am using Connector rule for this export
Related Content
- 1 year ago