nunomaia / nwrfcnet Goto Github PK
View Code? Open in Web Editor NEWAn easy way of making SAP RFC calls from .NET Core
License: Apache License 2.0
An easy way of making SAP RFC calls from .NET Core
License: Apache License 2.0
I have the options, basically a where clause, working to restrict the rows being returned.
I would now like to return only the fields/columns I need, similar to a where clause.
Is this something that can be done currently?
Thanks
Handle RFC Type BCD
Handle Cday RFC Type field
Move RFC Table management to a new class RfcTable
Handle Date Rfc Type field
move Samples folder to solution root folder
Handle TSecond RFC Type field
Logon on with SNC.
User and password are replaced by snc_qop, snc_myname, snc_partnername and snc_lib parameters.
Handle DtWeek Rfc Type field
Move native libary functions to a new RfcChar class
Hi nunomaia
As issues below
Could not open the ICU common library.
The following files must be in the path described by
the environment variable "PATH":
icuuc50.dll, icudt50.dll, icuin50.dll [D:/depot/bas/753_REL/src/flat/nlsui0.c 662] pid = 25568
Thanks.
I am trying to get this to work with a .net core web application. I keep getting an error about PATH. I know I can set this up locally and configure PATH, but how do I package this to deploy to the webserver? Do I have to setup PATH on all the webservers as well? How would this work in a kubernetes environment?
I'm calling the SAP function like that
using (var conn = new RfcConnection(builder => builder
.UseConnectionHost(_sapConfig.ServerHost)
.UseLogonUserName(_sapConfig.Username)
.UseLogonPassword(_sapConfig.Password)
.UseLogonClient(_sapConfig.Client)))
{
conn.Open();
using (var func = conn.CallRfcFunction(_sapConfig.FuncName))
{
func.Mapper = new RfcMapper();
func.Mapper.Parameter<SapFunctionParameters>().Property(x => x.EmployeeID)
.HasParameterName("EMP_NO")
.HasParameterType(RfcFieldType.Int8);
func.Mapper.Parameter<SapFunctionParameters>().Property(x => x.RunDate)
.HasParameterName("RUN_DATE")
.HasParameterType(RfcFieldType.Date);
func.Mapper.Parameter<BapiOutput>().Property(x => x.Details)
.HasParameterName("PA0000_OUT")
.HasParameterType(RfcFieldType.Table);
func.Mapper.Parameter<SapFunctionResults>().Property(x => x.MANDT)
.HasParameterName("MANDT")
.HasParameterType(RfcFieldType.String);
func.Mapper.Parameter<SapFunctionResults>().Property(x => x.PERNR)
.HasParameterName("PERNR")
.HasParameterType(RfcFieldType.Int8);
func.Invoke(new SapFunctionParameters { EmployeeID = 1692, RunDate = new DateTime(2021, 1, 1) });
var output = func.GetOutputParameters<BapiOutput>();
}
}
calling the function which returns a table of parameters as shown in the image
and I'm mapping two columns of the returned table to a class
public class BapiOutput
{
public SapFunctionResults[] Details { get; set; }
}
public class SapFunctionResults
{
public string MANDT { get; set; }
public long PERNR { get; set; }
}
getting error NwRfcNet.RfcException: 'Type BapiOutput is not mapped'
Try to copy NetWeaver libs to the same folder of your app binaries
Originally posted by @nunomaia in #47 (comment)
Handle String Rfc Type field
I try to build .net core container (mcr.microsoft.com/dotnet/core/sdk:3.0-alpine + mcr.microsoft.com/dotnet/core/aspnet:3.0-alpine).
On loading sapnwrfc.dll, I get an error "Unable to load shared library '/app/libs/nwrfcnet/sapnwrfc.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: Error loading shared library /app/libs/nwrfcnet/sapnwrfc.dll: Exec format error"
In issue #32 author has got .so libs, but in SAP Note 2573790 I could not find these such libs.
By the way, I load NwRfcNet lib not from Nuget, but directly from DLL. Because the last pull request has not been uploaded to NuGet yet.
In current moment RfcConnection include functions of connection configurations and connection itself. I think it would be better, extract RfcConnectionConfiguration into separate class and make it
input parameter of RfcConnection constructor.
Handle Decf16 and Rfc Types fields
Handle DtDay Rfc Type field
Isn't possible to read RFC String parameters with a length larger then 1024.
Check if native library function return buffer to small, increase size and try to read again.
if (rc == RfcInterop.RFC_RC.RFC_BUFFER_TOO_SMALL)
{
buffer = new char[bufferLength];
rc = RfcInterop.RfcGetString(dataHandle, name, buffer, (uint)buffer.Length, out bufferLength, out errorInfo);
}
Is it possible to work with generic output instead of defining Outputs for every function call?
When trying to connect a table via the RFC_READ_TABLE function I receive the following error:
According to this source https://success.jitterbit.com/display/DOC/Guide+to+Using+RFC_READ_TABLE+to+Query+SAP+Tables its returning a table not found error:
namespace SapFunctions.ReadTable
{
public static class SapReadTable
{
//private RfcConnection _conn = new RfcConnection();
/// <summary>
/// ReadTable
/// </summary>
/// <param name="sTableName">string</param>
/// <param name="saFields">string[]</param>
/// <param name="saOptions">string[]</param>
/// <param name="sSortField">string with name and direction</param>
/// <param name="iMaxRowCount">int</param>
/// <returns>DataTable or empty</returns>
public static string[] ReadTable(string sTableName, in string[] saFields, in string[] saOptions, in string sSortField, int iMaxRowCount = 0)
{
using (RfcConnection _conn = new RfcConnection(hostname: "XXXXX.de.ina.com", client: "XX",language: "EN",systemNumber:"XX",
sncQop: "X",
sncPartnername: "XXX",
sncLib: "qgsskrb5.dll"
))
{
_conn.Open();
sTableName = "MARA";
using (RfcFunction f = _conn.CallRfcFunction("RFC_READ_TABLE"))
{
ParameterMapping();
f.Invoke(new SAPInputs
{
QueryTable = sTableName,
Delimiter = ";",
No_Data = "",
RowCount = 0,
RowSkips = 0
});
var out_T = f.GetOutputParameters<SAPTableOutput>();
}
}
return new string[] { };
}
static void ParameterMapping()
{
var mapper = RfcMapper.DefaultMapper;
mapper.Parameter<SAPInputs>()
.Property(x => x.QueryTable)
.HasParameterName("QUERY_TABLE")
.HasParameterType(RfcFieldType.Char).MaxLength(60);
mapper.Parameter<SAPInputs>()
.Property(x => x.Delimiter)
.HasParameterName("DELIMITER")
.HasParameterType(RfcFieldType.Char).MaxLength(2);
mapper.Parameter<SAPInputs>()
.Property(x => x.No_Data)
.HasParameterName("NO_DATA")
.HasParameterType(RfcFieldType.Char).MaxLength(2);
mapper.Parameter<SAPInputs>()
.Property(x => x.RowCount)
.HasParameterName("ROWCOUNT")
.HasParameterType(RfcFieldType.Int);
mapper.Parameter<SAPInputs>()
.Property(x => x.RowSkips)
.HasParameterName("ROWSKIPS")
.HasParameterType(RfcFieldType.Int);
mapper.Parameter<SAPTableOutput>()
.Property(x => x.Fields)
.HasParameterName("FIELDS")
.HasParameterType(RfcFieldType.Table);
mapper.Parameter<SAPTableOutput>()
.Property(x => x.Options)
.HasParameterName("OPTIONS")
.HasParameterType(RfcFieldType.Table);
mapper.Parameter<SAPTableOutput>()
.Property(x => x.Data)
.HasParameterName("DATA")
.HasParameterType(RfcFieldType.Table);
}
}
public class SAPInputs
{
public string QueryTable { get; set; }
public string Delimiter { get; set; }
public string No_Data { get; set; }
public int RowSkips { get; set; }
public int RowCount { get; set; }
}
public class SAPTableOutput
{
public string[] Fields { get; set; }
public string[] Options { get; set; }
public string[] Data { get; set; }
}
}
Handle UtcLong Rfc Type field
Handle RFC Time type
System.DllNotFoundException: Unable to load DLL 'sapnwrfc' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
When i try to open connection, i get this error:
NwRfcNet.RfcException: Conversion error between two character sets.
Could you explain why i get it and any ideas how to fix it.
The connection to include the server name, and other parameters needed to establish the initial connection.
Hello,
thank you for your work on this package, I really appreciate it!
I was wondering if you support connecting to a message server since the constructor does not accept the parameters MSHOST, R3NAME/SystemId and GROUP.
Am I missing something here?
I'm not an SAP dev, just trying to interface with it, so excuse me if I'm on the wrong track..
If you do not support it, do you plan on adding support?
Cheers
Handle UtcSecond Rfc Type field
How can we write back to SAP using this library with input and output parameters.
For example :
RfcFunction func=conn.CallRfcFunction("BAPIFuncName");
func.Invoke();
Handle TMinute Rfc Type field
Handle Date Rfc Type field
Handle UtcMinute Rfc Type field
Handle DtMonth RFC Type field
Handle MUM Rfc Type field
I've already installed locally sapnwrfc,dll (downloaded directly from SAP) in windows PATH. But I keep getting this error:
'Unable to load DLL 'sapnwrfc' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)'
Already added the reference in my .NET Core Web App Project, but nothing seems to work.
Has anyone found the solution?
Hi, if I set a mapper through the RfcFunction.Mapper Property it doesn't consider it, the RFC only worked when I modified the default mapper.
Handle Float Rfc Type field
Handle Int8 Rfc Type field
How to receive the RETURN of a BAPI
Sample:
BAPI_PROC_MESS_DEST_RECEIVE_PM
those Tables we are sending successfull
But we are not able to Rewceive#
what to do?
Hi.
It's seems that the package requires sapnwrfc.dll.
Correct?
Handle Xstring Rfc Type field
Handle Byte Rfc Type field
Handle TSecond Rfc Type field
can you support automatic load of SAP RFC Native Library DLL?
such as :
win64>icudt50.dll/icuin50.dll/icuuc50.dll/libicudecnumber.dll/libsapucum.dll/sapnwrfc.dll
linux64>libicudata.so.50/libicudecnumber.so/libicui18n.so.50/libicuuc.so.50/libsapnwrfc.so/libsapucum.so
This is just an idea (and you might have reason for not doing things this way), but in my mind it seems more logical to associate the mapper with a specific RfcFunction rather than the RfcConnection, so multiple mappers would be used where multiple function calls are required, rather than a single generic RfcConnection.Mapper (RfcFunction.DefaultMapper).
Handle Structure Rfc Type field
Hi,
Thats the only one libray ever that i found over the web which using netweaver and supporting .net core. Thanks for all.
I'd like to use it on some asp.net core app as an integration. Adding async support would be great.
Also if possible, could you add some attribute mapping ?
Instead:
mapper.Parameter<SomeOutputClass>().Property(x => x.SomeProp)
.HasParameterName("SOME_MAPPED_FIELD")
.HasParameterType(RfcFieldType.SomeType);
Using attribute mapping like:
public class SomeOutputClass
{
[RfcParam("SOME_MAPPED_FIELD", RfcFieldType.SomeType, "Maybe some description here")]
public string SomeProp {get; set;}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.