Obtaining the selected tree item: We want to add a function in the SAP "Dynamic Business Event menu". The user selects an item in the tree control and then clicks our button. How can we obtain the event id that the user has selected in the tree control?
In your InputScript, start with

Enter "/2"

SAP then displays the next screen which contains the selected event id as a normal output field. Use a Screen command for this screen and put the event id into an internal variable; then continue with your own function.