requirement
NCo3016_Net20_x86.msi
add reference ( C:\Program Files (x86)\SAP\SAP_DotNetConnector3_Net20_x86 )
sapnco.dll, sapnco_utils.dll
source code for c# with asp.net
DataSet ds = new DataSet("T_DATA");
try
{
RfcDestination rfcDestination = null;
IDestinationConfiguration destinationConfig = null;
string destinationName = "SAP.LogonControl.1";
destinationConfig = new SAPDestinationConfig();
destinationConfig.GetParameters(destinationName);
if (RfcDestinationManager.TryGetDestination(destinationName) == null)
{
RfcDestinationManager.RegisterDestinationConfiguration(destinationConfig);
rfcDestination = RfcDestinationManager.GetDestination(destinationName);
if (rfcDestination != null)
{
rfcDestination.Ping();
}
RfcRepository rfcRepository = rfcDestination.Repository;
IRfcFunction rfcFunction = rfcRepository.CreateFunction("Z_XXXXX_ORDER");
rfcFunction.SetValue("I_AXXXX", sWO);
rfcFunction.Invoke(rfcDestination);
ds.Tables.Add(ConvertToDotNetTable(rfcFunction.GetTable("T_DATA")));
RfcDestinationManager.UnregisterDestinationConfiguration(destinationConfig);
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return ds;
댓글 없음:
댓글 쓰기