Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Experts,

I've been juggling in the internet for quite sometime to find an answer, on how to execute the RFC CSAP_BOM_MAT_READ using SAP NCO.I can execute some other bapi's such as
BAPI_MATERIAL_GETLIST, and etc, but can't execute the RFC CSAP_BOM_MAT_READ.
The BAPI_MATERIAL_GETLIST is functioning inside the BAPI call, there are parameter tables involved (IRfcTable mm1 = mm.GetTable("MATNRSELECTION");, but for
CSAP_BOM_MAT_READ, it seems like a field or parameters.

What I have tried:

BAPI_MATERIAL_GETLIST ----WORKING PERFECTLY
ECCDestinationConfig cfg = new ECCDestinationConfig();

           RfcDestinationManager.RegisterDestinationConfiguration(cfg);

           RfcDestination dest = RfcDestinationManager.GetDestination("mySAPdestination");

           RfcRepository repo = dest.Repository;

           IRfcFunction mm = repo.CreateFunction("BAPI_MATERIAL_GETLIST");
           //mm.SetValue("MAXROWS", "500000");
           IRfcTable mm1 = mm.GetTable("MATNRSELECTION");
           IRfcTable mm1P = mm.GetTable("PLANTSELECTION");
           mm1.Append();

          mm1.SetValue("SIGN", "I");
          mm1.SetValue("OPTION", "NE");
           mm1.SetValue("MATNR_LOW", "&&&&");
           mm1.SetValue("MATNR_HIGH", "");

           mm1P.Append();
           mm1P.SetValue("SIGN", "I");
           mm1P.SetValue("OPTION", "EQ");
           mm1P.SetValue("PLANT_LOW", "711");
           mm1P.SetValue("PLANT_HIGH", "");
           mm.SetValue("MATNRSELECTION", mm1);
           mm.SetValue("PLANTSELECTION", mm1P);


           IRfcTable TBL2 = mm.GetTable("MATNRLIST");

           mm.Invoke(dest);

           DataTable dt = TBL2.ToDataTable("table1");

           //var companyDataTable = companyCodeList.ToDataTable(Name);
           this.dataGridView1.DataSource = dt;

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
CSAP_MAT_BOM_READ - GIVING ERROR Incompatible call, I've tried with multiple bom RFC but all are giving the same error.
ECCDestinationConfig cfg = new ECCDestinationConfig();

          RfcDestinationManager.RegisterDestinationConfiguration(cfg);

          RfcDestination dest = RfcDestinationManager.GetDestination("mySAPdestination");

          RfcRepository repo = dest.Repository;

          IRfcFunction mm = repo.CreateFunction("CSAP_MAT_BOM_READ");
          mm.SetValue("MATERIAL", "405114");
          mm.SetValue("PLANT", "0711");
          mm.SetValue("BOMUSAGE", "1");
          mm.Invoke(dest);
          IRfcTable TBL2 = mm.GetTable("T_STPO");
          DataTable dt = TBL2.ToDataTable("table1");
          this.dataGridView1.DataSource = dt;
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900