You occasionally might find it necessary to create custom messages and dialog boxes for your scripts. Although WS does not contain a dedicated comand to create custom dialog boxes (also called 'modal 1 screens'), you can still create a custom dialog box to contain any messages that you wish to display on the screen. You can also add pushbutons, text, and other elements to these boxes. To create a custom dialog box, please do the following.
Open the script file for the 'RSM04000_ALV.E2000' dynpro. This is the SAP dialog box that appears to ask if you wish to make a choice of actions. The default dialog box is shown below.

Add the following code to retitle the screen and erase any elements that might already be there.
title('Decision to Proceed');
clearscreen();
Add the following code to place explanatory text on the new blank dialog box.
text([2,2], 'Do you want to create pricing conditions'); text([3,2], 'Press <Yes> to continue, Press <No> to stop');
Add the following code to elminate the dialog box's default 'Generate' and 'End Session' pushbuttons.
del('P[Generate]');
del('P[End Session]');
Add text to create new pushbuttons to call the custom operations you will define. in our example, we are calling a function or returning to the MM01 transaction.
text('P[Continue]','@01@Yes');
text('P[Cancel]','@02@No');
onUIEvents['Enter'] = {"fcode":"/12", "process":executeVK11}
onUIEvents['/12'] = {"fcode":"/nmm01"};
Add code for the custom function if you wish to call one. In our example, we are either calling a custom function to transport us to the VK11 transaction and perform pricing conditions. The sample code we are using to call the VK11 transaction is shown below.
function executeVK11() {
UI_MODE = '';
onscreen '*'
enter('/nvk11');
onscreen '*'
set('F[Condition type]','PR00');
enter();
onscreen '*'
enter();
}
Save your changes. Then log into SAP and call the new dialog box by typing '/o' in the transaction field. The new dialog box will appear as shown below.

The custom dialog box is now ready to use.