100% found this document useful (1 vote)
3K views20 pages

Enhancement For Addition Tab in ME51 Screen at Header and Item Level

The document describes steps to add custom fields and subscreens to the purchase requisition header and item level screens in SAP. It involves creating new classes, function modules, function groups and making implicit enhancements to existing classes and methods.

Uploaded by

Tushar Karhale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
3K views20 pages

Enhancement For Addition Tab in ME51 Screen at Header and Item Level

The document describes steps to add custom fields and subscreens to the purchase requisition header and item level screens in SAP. It involves creating new classes, function modules, function groups and making implicit enhancements to existing classes and methods.

Uploaded by

Tushar Karhale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

1.

Add z fields to CI include provided (CI_EBANDB) in standard table EBAN for custom header
of purchase requisition:

2. Add a public method ZZGET_NEXT_SUBVIEW_COUNT into class


CL_TABSTRIP_VIEW_MM.

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.

Screen Description Purpose


Number
9899 Subscreen Used for the screen container of
Container other two subscreens
9900 Subscreen – TPL Used for displaying/inputting the
Additional Tab related sales data of PR
Above PBO and PAI modules are located at the INCLUDE program LMEVIEWSF01.

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.

And please set ZPR_HEADER_CUSTOM_SAVE_CORE as the update module.


7. Apply implicit enhancement implementation to add the New Subscreens onto the Tabstrip of PR
header

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.

Why do we need to add this enhancement?


When users just change the data in the enhanced custom header screen but leave the standard data
unchanged (EBAN, EBKN, TEXT, etc), the application will not recognize the changing of the
document. So, application will not trigger the saving process for the document.
In this case we need to overwrite the changed indicator of LCL_REQ_HEADER, so that the program
can recognize and accept the changing of the document.
Because it has a CHECK statement in the method, we need to add the implicit enhancement at the
beginning of the method; otherwise, the implemented codes will be skipped under certain
circumstance (for example, Create Mode, ME51N), see below screenshot.

So, the enhancement is below:


9. Implement the Badi ME_PROCESS_REQ_CUST, and then insert below codes into the method OPEN
(It is easy to understand that application need to initialize and read the custom header data when a
new purchase requisition is opened).
In this case, the Badi implementation is ZME_PROCESS_REQ_CUST.

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 in the implementation part of LCL_REQ_HEADER (INCLUDE program LMEREQF08 of function


group MEREQ), I make such implicit enhancement:
11. Add an implicit enhancement at the POST method of local class LCL_INSTANCE_FACTORY.
The POST method of local class LCL_INSTANCE_FACTORY is located at INCLUDE program LMEREQF06
of function group MEREQ.

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.

The INCLUDE program ZZMEREQ_ENHANCEMENT has below codes:


The subroutine get_transaction_type is used for returning the transaction type of processed PR. This
subroutine will be called at the PBO module MODIFY_CUSTOM_SCREEN of function group
ZME51N_HEADER_ENHM.
If we have no this subroutine, the subscreens PBO can’t get the transaction type of PR, that means
we can’t modify INPUT attribute of the subscreen fields by different transactions types (please see
PBO module MODIFY_CUSTOM_SCREEN).

13 Custom Tab field values will be saved in Table EBAN.


14. For Item Level Custom Tab Addition.
14.1 Append your custom field to CI_EBANDB .
14.2 Create subscreen and add custom field to screen number 111.

14.3 EXIT_SAPLMEREQ_001 is used to Export Data to Customer Subscreen for


Purchase Requisition (PBO).
14.4 EXIT_SAPLMEREQ_003 is used to Import Data from Customer Subscreen for Purchase
Requisition
14.5 PBO –> Status module.

You might also like