on 05-04-2013 12:38 PM
Dear all,
I created RFC function module for creating sales order from .net to sap. Its working fine in sap if your passing multiple line items also, but i'm not able to pass multiple rows through that structure , i'm passing single row that time its working fine. Here i'm pasting the code also , pls suggest me..
RfcDestination destination = RfcDestinationManager.GetDestination(rfc);
IRfcFunction fnOrderDetails = destination.Repository.CreateFunction("YBAPI_VA01_EC"); // This is RFC Name
IRfcStructure structInputs = destination.Repository.GetStructureMetadata("ZECOM_VA01").CreateStructure(); // Structure Name
DataTable dt1 = (DataTable)ViewState["dt"];
for (int i = 0; i < dt1.Rows.Count; i++)
{
structInputs.SetValue("AUART", "ZBV"); //dt1.Rows[i]["OrderType"].ToString()); // Filling the Structure
structInputs.SetValue("VKORG", "9000"); //dt1.Rows[i]["SalesOrganization"].ToString());
structInputs.SetValue("VTWEG", "06"); //dt1.Rows[i]["DistributionChannel"].ToString());
structInputs.SetValue("SPART", "03"); //dt1.Rows[i]["Division"].ToString());
structInputs.SetValue("BSTNK", "ECOM_pO");
structInputs.SetValue("KUNNR", "90031"); //dt1.Rows[i]["Customer"].ToString());
structInputs.SetValue("MATNR", "1718-0101-BLACK"); //dt1.Rows[i]["MaterialNo"].ToString());
structInputs.SetValue("WERKS", "9200"); //dt1.Rows[i]["Plant"].ToString());
structInputs.SetValue("J_3ASIZ", "30ABLACK"); // dt1.Rows[i]["Grid"].ToString());
structInputs.SetValue("WMENG", "1.000"); //dt1.Rows[i]["Quantity"].ToString());
IRfcTable tableimport = fnOrderDetails.GetTable("ZECOM_VA01");
//IRfcStructure structInputs = destination.Repository.GetStructureMetadata("ZECOM_VA01").CreateStructure();
tableimport.Insert(structInputs);
}
RfcSessionManager.BeginContext(destination);
fnOrderDetails.Invoke(destination); // Calling the Function Module
var result = fnOrderDetails.GetString("SALESDOCUMENT"); // Returning the Sales Document No.
This is .net side Code.
---> Sap side, PFA..
Regards,
Krishna
Assuming the ZECOM_VA01 import parameter is a table type or a table parameter just use YBAPI_VA01_EC.CreateTable and insert the rows.
You can see a similar example here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.