Enhancement For Addition Tab in ME51 Screen at Header and Item Level
Enhancement For Addition Tab in ME51 Screen at Header and Item Level
Add z fields to CI include provided (CI_EBANDB) in standard table EBAN for custom header
of purchase requisition:
This method is used for counting the subview (subscreen) of the tabstrip
3. Create a function group as the core processing logic of the enhancement, and at the
meantime, it also provides subscreens.
In this case, the function group is ZS2PFG_ME51N_HEADER_ENHM. Below is the code of
the TOP INCLUDE.
Include LMEVIEWSF01, which is used in enhancements on purchase order subscreens.
LZME51N_HEADER_ENHMCLS is a program file to store the class of our enhancement.
Below code for include LZS2PFG_ME51N_HEADER_ENHMCLS
4. Create 2 subscreens for tabstrip subscreen of PR header.
SubScreen 9900
5. Insert an INCLUDE program LZS2PFG_ME51N_HEADER_ENHMF01 into function group
ZS2PFG_ME51N_HEADER_ENHM. This INCLUDE program used for storing the subroutines of the
function group.
6. Insert below function modules into the function group ZME51N_HEADER_ENHM.
Once the above steps are done, you can see the TPL additional Data subscreens is appearing on the
tabstrip of PR header.
8. Add an implicit enhancement into method if_purchase_requisition~get_transaction_state The
method is a component of local class LCL_REQ_HEADER in function group MEREQ, and located at
INCLUDE program LMEREQF12.
Based on the exporting parameter of the method, we know that this method is used for returning
the transaction states of the purchase requisition, for example, whether the purchase requisition has
been changed.
10. Add a new public method zzcustom_after_post into local class LCL_REQ_HEADER.
Once we implement the custom header screen on purchase requisition, the system behaviors of
change mode (ME52N) will have some difference from the original behaviors after saving the PR
document.
The original behavior: the system will alternate the transaction type from change mode to display
mode (my_state->trtyp). And changed indicator my_state->changed will be reset to SPACE. (see at
the last of method implementation prepare_post of local class lcl_req_header in INCLUDE program
LMEREQF08)
New behavior of our implementation: If user only changes custom header data but leave standard
data unchanged (EBAN, EBKN, TEXT, etc), the method prepare_post will raise an exception
no_changes before reset of the changed indicator and alternation of transaction type. In this case
the purchase requisition will leave to changed state and change mode after saving the PR document.
This is different from the original system behavior.
To overcome the gap between original behavior and new behavior, we need to have a method to set
the transaction type and changed indicator as what it is in standard behavior after the document is
saved. So I introduce the new method zzcustom_after_post for local class LCL_REQ_HEADER.
In the definition part of LCL_REQ_HEADER (INCLUDE program LMEREQF07 of function group
MEREQ), I make such implicit enhancement:
And now you will see the method zzcustom_after_post is called after the commit, so that the
changed indicator and transaction type are reset.
12. Add an implicit enhancement at the end of LMEREQFXX. In the enhancement, insert an INCLUDE
program ZZMEREQ_ENHANCEMENT.