Friday 2 September 2016

Creating Custom Fields in ME31K , ME32K , ME33K

As we know the enhancement to the screen is not impossible but it is not supported because we need some S_DEVELOP authorisation and modify some of the Standard table with z fields .That why please consider this document only if water is above your head and is a critical requirement of client
1) Create a Project using CMOD Tcode.
2) Give the enhancement name MM06E005.
3) Go to component Tab.


Creating Custom Fields in ME31K , ME32K , ME33K

4) go to SAPMM06E  0201 (This is for Header if you want to add tab on Header)
go to layout and design the screen according to your requirement

Creating Custom Fields in ME31K , ME32K , ME33K

It seems you have created your screen. Now go back to PBO and create a module with any name I name it as PBO so as to remove any confusion as described below. Just double click to create it will ask you to create with some name like this ZXM06O01 or whatever just press enter to create save it in your request.

Creating Custom Fields in ME31K , ME32K , ME33K

Now we are reaching towards the conclusion as we are going to play with the data we are going to insert in our fields.

First of all in the first screen you will see    EXIT_SAPMM06E_006 double click on that you will find
INCLUDE ZXM06U36-> double click on that->it will ask to create and save it in your request. This is the first exit which is executed so we will export our values from there. After implementing this exit just put a hard break point and for testing execute me33k with->enter agreement number -> execute.
Click on Header our breakpoint will be triggered. This indicates everything is fine (ALL IS WELL).See the below screen the Yellow field is our custom field. Now from here we will export our values so do like this

IF i_ekko-zvat is NOT INITIAL.
FREE MEMORY ID 'ZVAT'.
zvat = i_ekko-zvat.
EXPORT zvat to MEMORY id 'ZVAT' .
ENDIF.

IF i_ekko-zdelivery is NOT INITIAL.
FREE MEMORY ID 'ZDELIVERY'.
zdelivery = i_ekko-zdelivery.
EXPORT zdelivery to MEMORY id 'ZDELIVERY' .
ENDIF.

IF i_ekko-ZFREIGHT is NOT INITIAL.
FREE MEMORY ID 'ZFREIGHT'.
ZFREIGHT = i_ekko-ZFREIGHT.
EXPORT ZFREIGHT to MEMORY id 'ZFREIGHT' .
ENDIF.

Creating Custom Fields in ME31K , ME32K , ME33K

In the above part you have exported the values but so as to store this values in table you need to go to the PBO which we have created.It will lead to ZXM06O01 which system has automatically created .
Now here we will manipulate our custom screen like storing the values in standard table or your z table. We will import the value which have been exported earlier.

IF sy-tcode EQ 'ME21N' OR sy-tcode EQ 'ME22N' OR sy-tcode EQ 'ME23N'.
  
     DATA: zvat TYPE zvat.
     DATA: zdelivery(30) TYPE c.
     DATA: zfreight(50) TYPE c.
     DATA: i_trtyp .

     IMPORT zvat TO zvat FROM MEMORY ID 'ZVAT'.
     IMPORT zdelivery TO zdelivery FROM MEMORY ID 'ZDELIVERY'.
     IMPORT zfreight TO zfreight FROM MEMORY ID 'ZFREIGHT'.

     IMPORT i_trtyp TO i_trtyp FROM MEMORY ID 'I_TRTYP'.

     ekko_ci-zvat = zvat.
     ekko_ci-zdelivery = zdelivery.
     ekko_ci-zfreight = zfreight.

     IF i_trtyp = 'A'.
**   if sy-tcode = 'ME23N' OR sy-tcode EQ 'ME29N'..
       LOOP AT SCREEN.
         IF screen-group1 = 'VAT' OR screen-name = 'EKKO_CI-ZVAT'.
           screen-input = 0.
         ENDIF.

         IF screen-group1 = 'DEL' OR screen-name = 'EKKO_CI-ZDELIVERY'.
           screen-input = 0.
         ENDIF.

         IF screen-group1 = 'FRT' OR screen-name = 'EKKO_CI-ZFREIGHT'..
           screen-input = 0.
         ENDIF.
         MODIFY SCREEN.
       ENDLOOP.
**  endif.
     ENDIF.

     IF i_trtyp <> 'A'.
**   if sy-tcode = 'ME23N' OR sy-tcode EQ 'ME29N'..
       LOOP AT SCREEN.
         IF screen-group1 = 'VAT' OR screen-name = 'EKKO_CI-ZVAT'.
           screen-input = 1.
         ENDIF.

         IF screen-group1 = 'DEL' OR screen-name = 'EKKO_CI-ZDELIVERY'.
           screen-input = 1.
         ENDIF.

         IF screen-group1 = 'FRT' OR screen-name = 'EKKO_CI-ZFREIGHT'..
           screen-input = 1.
         ENDIF.
         MODIFY SCREEN.
       ENDLOOP.
**  endif.
     ENDIF.

   ENDIF.

Now as per the document everything has been explained regarding storing and retrieving the values from fields. You might have noticed that I have used the zvat field in ekko_ci which is the standard. For doing this you will require S_DEVELOP Authorization to append standard table with your Z feild so consult your basis team soon you get authorization do like this go to se11-> ekko ->scroll down to find CI_EKKODB structure for more explanation find the screen shot

Creating Custom Fields in ME31K , ME32K , ME33K

double click on this CI_EKKODB it will ask you to create the structure -> click on yes button ->the following screen will be displayed.

Creating Custom Fields in ME31K , ME32K , ME33K

now create the z data element  for your fields and enter it save it and activate it.
Now you are ready with the custom fields in Header and your standard table will look like this.

Creating Custom Fields in ME31K , ME32K , ME33K

No comments:

Post a Comment