Searching for a way to process a custom function code in subscreen from MM06E005 enhancement will probably take you to function module SCREEN_SEQUENCE_CONTROL. Further exploring will point you to tables T186 and T186 which holds a lot of function codes… and all of this seems a little bit complicated. Hopefully, SAP published a note 138855 about this issue, here is an example of implementation:
1. Add your custom function code to a subscreen element – it must have Z_xx format. Here I added a button with Z_GO code to RFQ screen.
2. There is a statement in the note about applying corrections to exit function modules, but as of release 4.6A they are contained in the standard system.
These modules from XM06 function group have params for carrying a custom function code from/to a customer subscreen:
EXIT_SAPMM06E_007, import param I_UCOMM type SY-UCOMM – the module for export data to a subscreen in header screens in PAI events
EXIT_SAPMM06E_017, import param I_UCOMM type SY-UCOMM – for importing data from a custom subscreen in header screens
EXIT_SAPMM06E_008, export param E_UCOMM type SY-UCOMM – for export data to a subscreen in item screens in PAI events
EXIT_SAPMM06E_018 export param E_UCOMM type SY-UCOMM – for importing data from a custom subscreen in item screens
You have to create (in ZXM06TOP) a global field for holding the value from these parameters.
(ZXM06TOP can be created using forward navigation from LXM06TOP)
3. Now you have to transfer the function code from/to your custom subscreen to the just created global field. The function code is carried out in exit function modules parameters mentioned above. In our case we use only a header screen so in export modules EXIT_SAPMM06E_007 (include ZXM06U38) we must put:
In import module EXIT_SAPMM06E_008 (include ZXM06U37) we do the opposite:
If you want to use an item type screen, do the same with EXIT_SAPMM06E_008 and EXIT_SAPMM06E_018.
4. Program PAI of your subscreen. What’s important – after processing you custom function code you have to set the global value (gv_ucomm in our case) to one of the codes from table T168F. If you won’t do this, you’ll end with error code. So, in PAI module for 301 subscreen I added a simple message and at the end I set gv_ucomm to KOPF function code which directs logic to the header screen again (use the debugger for finding specified codes, for example if you want to forward logic to other screen).
That’s all. Now button is on the RFQ screen and its function code is handled properly.
Without setting gv_ucomm value to a code from T168F program would end with error: