2014 Jul 29 2:39 PM
Hi ,
I have addded 3 fields in me21n(purchase order) 1 in header and 2 fields in item tabs .when i enter values in those custom fields the order is saved but when i go to the corresponding order no in ekko and ekpo table , i am not getting any values for those fields in the table contents.
Could someone please let me know the solution .
Thank You ,
Rocky
2014 Jul 29 3:00 PM
Hi Rocky
Do you implemented any custom exit or BADI for ME21N? like BADI 'ME_GUI_PO_CUST' and 'ME_PROCESS_PO_CUST'...
you can search it on SCN for detail.
regards,
Archer
2014 Jul 29 5:18 PM
2014 Jul 29 6:04 PM
Hi,
This blog will show, how to finding user exit and implementing the same this will be useful for your requirment .
High level Requirement:
To add three fields into RFQ Item details
High level solution:
Basically the purchasing documents(RFQ/Contract/PO) are stored into the table EKKO and EKPO.
So we need to enhance the EKPO table, adding fields(label/text field) into screen
To find user exit for ME41(RFQ)
1. Goto ME41 Selct System menu and choose status(ALT+Y+S)
2. Double click SAPMM06E-Program (screen)
3. Select the menu Goto and choose Attributes(ALT+G+A) now you will get Package (ME)
4. Goto SMOD and press CTRL+F and give package as ME and execute
5. Now you can see 'MM06E005 Customer fields in purchasing document'
Now we got the enhancement 'MM06E005'.
Before implementing User Exit(Project) we need to cross check whether the enhancement has implemented already.
check the table MODACT and pass MEMBER as MM06E005 and execute, if any record is there then we can conclude the enhancement is implemented with other project(column name is NAME in table MODACT)
To implement user exit for ME41(RFQ)
Goto transaction CMOD
Give project name like ZPU00002 and click create button, give description
click Enhancement Assignments and give Enhancement as MM06E005
Now click Components button and you will get the following list.
Enhancement Impl Exp MM06E005 Customer fields in purchasing document
Function exit EXIT_SAPMM06E_006
EXIT_SAPMM06E_007
EXIT_SAPMM06E_008
EXIT_SAPMM06E_009
EXIT_SAPMM06E_012
EXIT_SAPMM06E_013
EXIT_SAPMM06E_014
EXIT_SAPMM06E_016
EXIT_SAPMM06E_017
EXIT_SAPMM06E_018
Screen exit SAPMM06E 0101 CUSTSCR1 SAPLXM06 0101
SAPMM06E 0111 CUSTSCR1 SAPLXM06 0111
SAPMM06E 0201 CUSTSCR1 SAPLXM06 0201
SAPMM06E 0211 CUSTSCR1 SAPLXM06 0211
SAPMM06E 0301 CUSTSCR1 SAPLXM06 0301
SAPMM06E 0311 CUSTSCR1 SAPLXM06 0311
Include tables CI_EKKODB
CI_EKPODB
1) Now we need to add three custom fields to EKPO table
Double click CI_EKPODB, add three fields using Append structure and activate, it will take 2 to 3 minutes because entire table gets adjusted.
2) Then we need to add custom fields(three) into the ME41 screen in Item details, get the item details screen number
(SAPMM06E 0211 CUSTSCR1 SAPLXM06 0211)
By clicking the screen 0211 and click layout then you will be in screen add and activate)
3) Then the screen field values should be moved into standard program(Structure-e_ci_ekpo)
Double click EXIT_SAPMM06E_018 now you will be into FM-EXIT_SAPMM06E_018, here we can use IMPORTING and CHANGING values. Inside this FM there will be INCLUDE ZXM06U40, just double click this include, system will show as warning(means to create) the just press enter. Now you will see include editor, here you can write your logic.
e_ci_ekpo-AAA = ekpo-AAA.
e_ci_ekpo-BBB = ekpo-BBB.
e_ci_ekpo-CCC = ekpo-CCC.
(AAA, BBB and CCC are custom fields in EKPO table as well as screen field name)
Without the above code(function exit), the new filed should not captured in EKPO while saving the transaction ME41.
Here if you want any validation do the following code
PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0211.
field : EKPO-AAA module check.
If we go again into another item the values should be moved into Screen level so need to write the following code.
Move i_kekpo-AAA to ekpo-AAA.
Move i_kekpo-BBB to ekpo-BBB.
Move i_kekpo-CCC to ekpo-CCC.
Till now we have done for creating RFQ(ME41) and change also ME42 will work.
Now we need to consider ME43(RFQ display)
Here we need to disable the custom fields which is created recently or else it will be editable mode.
Use the function exit EXIT_SAPMM06E_016 in PBO
PROCESS BEFORE OUTPUT.
MODULE STATUS_0311.
loop at screen.
if screen-name = 'EKPO-AAA' or screen-name = 'EKPO-BBB' or screen-name = 'EKPO-CCC'.
screen-active = 0.
modify screen.
endif.
endloop.
If you want access any main program attributes, you can access for example the purchase organization is in main program, but we cant access directly again we can access, please use the following code.
CONSTANTS : lv_ekorg_field TYPE char20 VALUE '(SAPMM06E)EKKO-EKORG',
FIELD-SYMBOLS : <lfs_ekorg> TYPE ekorg,
ASSIGN (lv_ekorg_field) TO <lfs_ekorg>.
IF sy-subrc = 0 .
Do your logic
ENDIF.
Activate your all other changes. Again go into CMOD, where you can see activate/deactivate button. Dont forget to activate or else your code will not be called.
If you dont want to call your custom codes just simply deactivate, that's it.
Finally you can do the transaction ME41/ME42/ME43 and records can be verified under table EKPO.
I hope you got clear idea of enhancing standard transaction, as of now we have discussed about table enhancement, Screen and Function Exit.