I am passing 3 tables to an IRfcFunction which creates an order on SAP. When I try to debug this program it is not giving any error messages, but this is not creating any order on SAP.
I am looking for any kind of help or tips in solving this issue. Thank you for your time.
IRfcFunction orderDetails = _rfcDest.Repository.CreateFunction(strBapi);
RfcStructureMetadata metaData = _rfcDest.Repository.GetStructureMetadata("ZBAPI_A_STRU_ORDER_CREATE_PART");
IRfcStructure structPartners = metaData.CreateStructure();
structPartners.SetValue("PARTN_ROLE", "SP");
structPartners.SetValue("PARTN_NUMB", "110024");
IRfcTable tblPartner = orderDetails.GetTable("PARTNERS");
tblPartner.Append(structPartners);
structPartners = metaData.CreateStructure();
structPartners.SetValue("PARTN_ROLE", "SH");
structPartners.SetValue("PARTN_NUMB", "110005");
tblPartner.Append(structPartners);
orderDetails.SetValue("PARTNERS", tblPartner);
metaData = _rfcDest.Repository.GetStructureMetadata("ZBAPI_A_STRU_ORDER_CREATE_COND");
IRfcStructure structConditions = metaData.CreateStructure();
structConditions.SetValue("ITM_NUMBER", "10");
structConditions.SetValue("COND_TYPE", "PR00");
structConditions.SetValue("COND_VALUE", "30");
structConditions.SetValue("CURRENCY", "USD");
IRfcTable tblConditions = orderDetails.GetTable("CONDITIONS");
tblConditions.Append(structConditions);
orderDetails.SetValue("CONDITIONS", tblConditions);
metaData = _rfcDest.Repository.GetStructureMetadata("ZBAPI_A_STRU_ORDER_CREATE_ITEM");
IRfcStructure structItems = metaData.CreateStructure();
structItems.SetValue("MATERIAL", "F500");
structItems.SetValue("TARGET_QTY", "3");
IRfcTable tblItems = orderDetails.GetTable("ITEMS");
tblItems.Append(structItems);
orderDetails.SetValue("ITEMS", tblItems);
RfcSessionManager.BeginContext(_rfcDest);
orderDetails.Invoke(_rfcDest);
IRfcStructure bapiTable = orderDetails.GetStructure("RETURN");
RfcSessionManager.EndContext(_rfcDest);
IRfcFunction orderDetails = _rfcDest.Repository.CreateFunction(strBapi);
RfcStructureMetadata metaData = _rfcDest.Repository.GetStructureMetadata ("ZBAPI_A_STRU_ORDER_CREATE_PART");
IRfcStructure structPartners = metaData.CreateStructure();
structPartners.SetValue("PARTN_ROLE", "SP");
structPartners.SetValue("PARTN_NUMB", "0011001234");
IRfcTable tblPartner = orderDetails.GetTable("PARTNERS");
tblPartner.Append(structPartners);
structPartners = metaData.CreateStructure();
structPartners.SetValue("PARTN_ROLE", "SH");
structPartners.SetValue("PARTN_NUMB", "0011567890");
tblPartner.Append(structPartners);
orderDetails.SetValue("PARTNERS", tblPartner);
metaData = _rfcDest.Repository.GetStructureMetadata("ZBAPI_A_STRU_ORDER_CREATE_COND");
IRfcStructure structConditions = metaData.CreateStructure();
structConditions.SetValue("ITM_NUMBER", "10");
structConditions.SetValue("COND_TYPE", "PR00");
structConditions.SetValue("COND_VALUE", "30");
structConditions.SetValue("CURRENCY", "USD");
IRfcTable tblConditions = orderDetails.GetTable("CONDITIONS");
tblConditions.Append(structConditions);
orderDetails.SetValue("CONDITIONS", tblConditions);
metaData = _rfcDest.Repository.GetStructureMetadata("ZBAPI_A_STRU_ORDER_CREATE_ITEM");
IRfcStructure structItems = metaData.CreateStructure();
structItems.SetValue("MATERIAL", "F500");
structItems.SetValue("TARGET_QTY", "3");
IRfcTable tblItems = orderDetails.GetTable("ITEMS");
tblItems.Append(structItems);
orderDetails.SetValue("ITEMS", tblItems);
RfcSessionManager.BeginContext(_rfcDest);
orderDetails.Invoke(_rfcDest);
IRfcStructure bapiTable = orderDetails.GetStructure("RETURN");
RfcSessionManager.EndContext(_rfcDest);