In this document a step-by-step guide for adding customer (Z-) fields to Purchase Orders that are displayable and modifiable either in header level or in item level.
- We start by adding enhancement MM06E005 to a project in transaction CMOD and activating it.
- We create structures CI_EKKODB (header level) and/ or CI_EKPODB (item level) by double-clicking on the corresponding line under "Include tables", and add to them the fields that are of interest to us, e.g. ZZFIELD1 and ZZFIELD2 respectively. We save and activate.
- We create screens SAPLXM06 0101 (header level) and/ or 0111 (item level) by double-clicking on the corresponding line under "Screen exit", and add the customer fields defined in the previous step using the structures CI_EKKODB/ CI_EKPODB (and NOT EKKO/ EKPO), e.g. CI_EKKODB-ZZFIELD1/ CI_EKPODB-ZZFIELD2. We save and activate.
- Using SE38 we go to include LXM06TOP (main program SAPLXM06) and double-click on include ZXM06TOP in order to create it.
- We add the following variable declarations that will be used for holding the information whether we create/ change/ display a purchase order:
For item level:
TABLES: ci_ekpodb.
DATA: gw_aktyp.
For header level:
TABLES: ci_ekkodb.
DATA: gw_trtyp.
- We now want to implement the transfer of information from the purchase order to our newly created customer screen and store activity type (i.e. create/ change/ display). To achieve that in CMOD we double-click on EXIT_SAPMM06E_006 (header level)/ EXIT_SAPMM06E_016 (item level), and double-click on include ZXM06U36/ ZXM06U41, respectively, in order to create it. Then, we add the following code:
For item level:
MOVE-CORRESPONDING i_ci_ekpo TO ci_ekpodb.
gw_aktyp = i_aktyp.
For header level:
MOVE-CORRESPONDING i_ci_ekko TO ci_ekkodb.
gw_trtyp = i_trtyp.
- We now want to implement the transfer of information from our newly created customer screen to the purchase order. To achieve that in CMOD we double-click on EXIT_SAPMM06E_008 (header level)/ EXIT_SAPMM06E_018 (item level), and double-click on include ZXM06U37/ ZXM06U40, respectively, in order to create it. Then, we add the following code:
For item level:
MOVE-CORRESPONDING ci_ekpodb TO e_ci_ekpo.
For header level:
MOVE-CORRESPONDING ci_ekkodb TO e_ci_ekko.
- Finally on the PBO of the newly created customer screens we add a module with the following code in order to render non-modifiable the Z-fields when the purchase order is being displayed (and not changed/ created). A new include is created for the PBO module.
gw_trtyp is used for header level and gw_aktyp for item level:
IF gw_trtyp EQ 'A'. "gw_aktyp = 'A'.
LOOP AT SCREEN.
screen-input = '0'.
MODIFY SCREEN.
ENDLOOP.
ENDIF.
Now we are ready to check our new field under the tab "Customer Data":