This sample shows how to execute the SAP transaction MMBE (stock overview) using the Transaction class.
About
In this application the user can enter a material number and the name of a plant. By clicking a button, the SAP GUI is launched and the transaction MMBE (stock overview) is executed to list the entered materials and plants.
Tip
The installation package of ERPConnect includes the Transaction-Recorder tool. This tool records transactions and implements them to code, see Transaction-Recorder.
Call Transaction MMBE
The following sample code executes the SAP transaction MMBE (stock overview):
usingSystem;usingERPConnect;usingERPConnect.Utils;// Set your ERPConnect licenseLIC.SetLic("xxxx");usingvarconnection=newR3Connection(host:"server.acme.org",systemNumber:00,userName:"user",password:"passwd",language:"EN",client:"001"){Protocol=ClientProtocol.NWRFC,UseGui=true,};connection.Open();Console.Write("Material: ");stringmaterial=Console.ReadLine();Console.Write("Plant: ");stringplant=Console.ReadLine();vartransaction=newTransaction(connection){ExecutionMode=TransactionDialogMode.ShowAll,TCode="MMBE"};transaction.AddStepSetNewDynpro("RMMMBEST","1000");transaction.AddStepSetOKCode("ONLI");transaction.AddStepSetCursor("MS_WERKS-LOW");transaction.AddStepSetField("MS_MATNR-LOW",material);transaction.AddStepSetField("MS_WERKS-LOW",plant);// runtransaction.Execute();