Conversion error from DECF34 to byte[]
When there is a RFC call to function module from SAP we are getting error from dot net code as below
When there is a function call via RFC we are getting below error
ERROR IN Y_BC_IXOS_CHECK_LINE_ITEMS FUNCTION : FIELD HIST_TAX_FACTOR1 of STRUCTURE BSEG (GETTER): cannot convert DECF34 into Byte[]
Is there a way where we can resolve the Conversion error from DECF34 to byte[]?
Below is the code where there is error:-
Public Function CheckLineItemsNew(ByVal strCompanyCode As String, ByVal DataList As Hashtable, ByRef ErrorList As DataTable) As String
Dim strMessage As String = ""
Dim strFunction As String = GetObjectNameFromConfig("Y_BC_IXOS_CHECK_LINE_ITEMS")
Dim DataTable As IRfcTable
Dim ErrorTable As IRfcTable
Dim DataIn As IRfcStructure
Dim i As Integer
ErrorList = New DataTable
If DataList.Count = 0 Then
strMessage = "The input list 'DataList' is empty."
Return strMessage
End If
Try
WriteLog("Start CheckLineItemsNew")
'Set Function
Dim MyFunction As IRfcFunction = SapDestination.Repository.CreateFunction(strFunction)
'Set import values
MyFunction.SetValue("IW_BUKRS", strCompanyCode.ToUpper)
'Set Table
Dim metadata As RfcStructureMetadata = SapDestination.Repository.GetStructureMetadata("BSEG")
DataTable = MyFunction.GetTable("IWT_LINEITEMS")
'Add data
For i = 1 To DataList.Count
DataIn = metadata.CreateStructure()
If DataList.Item(i).ContainsKey("HKONT") Then
DataIn.SetValue("HKONT", DataList.Item(i).Item("HKONT").ToString.ToUpper)
End If
If DataList.Item(i).ContainsKey("WRBTR") Then
DataIn.SetValue("WRBTR", DataList.Item(i).Item("WRBTR").ToString.ToUpper)
End If
'If DataList.Item(i).ContainsKey("MWSKZ") Then
' DataIn.SetValue("MWSKZ", DataList.Item(i).Item("MWSKZ").ToString.ToUpper)
'End If
If DataList.Item(i).ContainsKey("KOSTL") Then
DataIn.SetValue("KOSTL", DataList.Item(i).Item("KOSTL").ToString.ToUpper)
End If
If DataList.Item(i).ContainsKey("AUFNR") Then
DataIn.SetValue("AUFNR", DataList.Item(i).Item("AUFNR").ToString.ToUpper)
End If
If DataList.Item(i).ContainsKey("PROJK") Then
DataIn.SetValue("PROJK", DataList.Item(i).Item("PROJK").ToString.ToUpper)
End If
If DataList.Item(i).ContainsKey("SGTXT") Then
DataIn.SetValue("SGTXT", DataList.Item(i).Item("SGTXT").ToString.ToUpper)
End If
If DataList.Item(i).ContainsKey("VBUND") Then
DataIn.SetValue("VBUND", DataList.Item(i).Item("VBUND").ToString.ToUpper)
End If
If DataList.Item(i).ContainsKey("XREF3") Then
DataIn.SetValue("XREF3", DataList.Item(i).Item("XREF3").ToString.ToUpper)
End If
If DataList.Item(i).ContainsKey("BUKRS") Then
DataIn.SetValue("BUKRS", DataList.Item(i).Item("BUKRS").ToString.ToUpper)
End If
If DataList.Item(i).ContainsKey("MATNR") Then
DataIn.SetValue("MATNR", DataList.Item(i).Item("MATNR").ToString.ToUpper)
End If
If DataList.Item(i).ContainsKey("PRCTR") Then
DataIn.SetValue("PRCTR", DataList.Item(i).Item("PRCTR").ToString.ToUpper)
End If
If DataList.Item(i).ContainsKey("BEWAR") Then
DataIn.SetValue("BEWAR", DataList.Item(i).Item("BEWAR").ToString.ToUpper)
End If
'Only for France GSBER and ZUONR
If DataList.Item(i).ContainsKey("GSBER") Then
DataIn.SetValue("GSBER", DataList.Item(i).Item("GSBER").ToString.ToUpper)
End If
If DataList.Item(i).ContainsKey("ZUONR") Then
DataIn.SetValue("ZUONR", DataList.Item(i).Item("ZUONR").ToString.ToUpper)
End If
DataTable.Append(DataIn)
DataIn = Nothing
Next
'Call function
MyFunction.Invoke(SapDestination)
'Get error table
ErrorTable = MyFunction.GetTable("EWT_RETURN")
'Convert datatable
strMessage = ConvertToDataTable(ErrorTable, "EWT_RETURN", ErrorList)
Catch ex As Exception
strMessage = ex.Message
WriteLog("ERROR CheckLineItemsNew : " & strMessage)
End Try
Return strMessage
End Function
1 answer
Sort by: Most helpful
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more