on 03-22-2012 2:00 PM
Hi, i a new member of This community. Im working in a project with integration SAP X .NET. There are two teams on this project in a developing sap and we developed in. net.
I need to run an RFC that performs the opening of a sales order in SAP, it takes as parameters and returns a table with another table data from the sales order.
public static PedidoFechado Rfcw005(string codigoEmp, List<String> lstDados)
{
lstTeste2.Add("HEMP1ZOR1OV02C1S1EV025483000020274000002027402950000000000000000000000000000000020120322FL22A01A 000000001800003012270000000000,000000000000,00 FOBGOIAS CE020");
lstTeste2.Add("I000001BGH2312 000000001,000NACIONAL DEP100000022,960000000000,00000000,000000,000008,890000,000000,00");
// Get destination instance. The destination is configured in app.config.
RfcDestination destination = RfcDestinationManager.GetDestination(ABAP_APP_SERVER);
// you may, or may not, want the default trace level to match the trace level of the destination -- comment or uncomment the following line
// RfcTrace.DefaultTraceLevel = destination.Parameters.GetTraceLevelAsUint();
destination.Ping();
IRfcFunction rfcFunction = destination.Repository.CreateFunction("Z_RFCW005");
rfcFunction.Invoke(destination);
//Seta os parametros da rfc
IRfcFunction function = destination.Repository.CreateFunction("STFC_STRUCTURE");
IRfcStructure importStructure = function.GetStructure("IMPORTSTRUCT");
rfcFunction.Invoke(RfcDestinationManager.GetDestination(ABAP_APP_SERVER));
int linhas = lstDados.Count;
PedidoFechado obj = new PedidoFechado();
IRfcTable objTable = rfcFunction.GetTable("T_ENTR");
IRfcTable objTable1 = rfcFunction.GetTable("T_SAID");
objTable.Append(linhas);
for (int i = 0; i < objTable.Count; i++)
{
objTable.CurrentIndex = i;
objTable.SetValue("MANDT", codigoEmp);
objTable.SetValue("REG", lstDados[i]);
}
objTable1.Append(linhas);
PedidoFechado obj2 = new PedidoFechado();
for (int x = 0; x < objTable1.RowCount; x++)
{
obj2.mandt = objTable1[x].GetValue("MANDT").ToString();
obj2.reg = objTable1[x].GetValue("REG").ToString();
}
return obj2;
}
Apparently the parameters are being used correctly, but do not get the return table. sap the team says that this trace in the log that a window is already open is trying to be opened again.
Someone could help solve this problem?
hi felipe,
Please find the below link. This is the my recent wiki in SDN, in this wiki i am explained about sap to .net connectivity and inserting, selecting and updating data from sap database using c#net.
http://wiki.sdn.sap.com/wiki/pages/editpage.action?pageId=263291953
Hey felipe you have any query's or doubts regarding this issue please give reply to me.
Best Regards,
Harish.Y
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.