Searching for way to process custom function code in subscreen from MM06E005 enhancement will propably 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 subscreen element – it must have Z_xx format. Here I added 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 standard system.
These modules from XM06 function group have params for carrying custom function code from/to customer subscreen:
EXIT_SAPMM06E_007, import param I_UCOMM type SY-UCOMM – module for export data to subscreen in header screens in PAI events
EXIT_SAPMM06E_017, import param I_UCOMM type SY-UCOMM – for import data from custom subscreen in header screens
EXIT_SAPMM06E_008, export param E_UCOMM type SY-UCOMM – for export data to subscreen in item screens in PAI events
EXIT_SAPMM06E_018 export param E_UCOMM type SY-UCOMM – for import data from custom subscreen in item screens
You have to create (in ZXM06TOP) global field for holding value from these parameters.
(ZXM06TOP can be created using forward navigation from LXM06TOP)
3. Now you have to transfer function code from/to custom subscreen to just created global field. Function code is carried out in exit function modules parameters mentioned above. In our case we use only 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 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 simple message and at the end I set gv_ucomm to KOPF function code which directs logic to header screen again (use debugger for finding specified codes ie. 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 code from T168F program would end with error: