Skip to Content
Author's profile photo George Serfiotis

Adding customer (Z-) fields to Purchase Orders

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.

/wp-content/uploads/2015/09/pic1_800746.png

/wp-content/uploads/2015/09/pic4_800749.png

  • 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.

Pic2.png

/wp-content/uploads/2015/09/pic3_800750.png

  • 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.

/wp-content/uploads/2015/09/pic5_800751.png

  • Using SE38 we go to include LXM06TOP  (main program SAPLXM06) and double-click on include ZXM06TOP in order to create it.

/wp-content/uploads/2015/09/pic6_800752.png

  • 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.

/wp-content/uploads/2015/09/pic7_800753.png

  • 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.

/wp-content/uploads/2015/09/pic8_800754.png

  • 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.

    screeninput = ‘0’.

    MODIFY SCREEN.

  ENDLOOP.

ENDIF.

/wp-content/uploads/2015/09/pic9_800755.png


/wp-content/uploads/2015/09/pic10_800777.png

Now we are ready to check our new field under the tab “Customer Data”:

/wp-content/uploads/2015/09/pic11_800783.png

Assigned tags

      8 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Nice article that help me a lot 

      Author's profile photo Former Member
      Former Member

      Thank you for posting such a great article! Good job, thanks for sharing such type of information.

      Author's profile photo Fernando Javier Ansaldo Lutz
      Fernando Javier Ansaldo Lutz

      Thanks by the artcule is very helpfull.

      I have a question, the customer field is the same for all items or this can be changed?

      Thanks a lot.

      Author's profile photo George Serfiotis
      George Serfiotis
      Blog Post Author

      What do you mean? Do you want different field per item or different field value per item??

      Author's profile photo ERNESTO READENE Bueno
      ERNESTO READENE Bueno

      Hi George,

      I followed your step by step procedures. The customer fields are now available in PO Screen but when I save the document, it was not populated / save in table EKPO. May I know how do I check if I did wrong or forgot something.

      Thanks a lot!

      Author's profile photo George Serfiotis
      George Serfiotis
      Blog Post Author

      Did you perform the following step activating transfer of custom fields to the purchase order? Have you activated the enhancements (CMOD)?

       

      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.

      Author's profile photo ERNESTO READENE Bueno
      ERNESTO READENE Bueno

      Yes, I already performed that step.

      Author's profile photo ERNESTO READENE Bueno
      ERNESTO READENE Bueno

      It's working now. Thanks a lot.