11-29-2011 12:47 PM
Hi All,
I have added a new field via Screen-exit to ME22N and it's working fine.
The problem I have is that ME22N can be used in Display mode and in such mode I would like to disable my field.
How can I tell the mode?
I searched the forum and found few threads, but none were answered.
Regards,
Ayal Telem.
11-29-2011 1:53 PM
Thanks for everyone, but you missed the point.
I know how to code for ME23N. This is not the problem.
The problem is the duality of ME22n, which basically used to Change a document, but also have a Display mode.
How can I tell at which mode am I when ME22n is called or refreshed (e.g. after you save your work in this t-code, it will automatically switch to display mode).
Regards,
Ayal Telem.
11-29-2011 1:19 PM
Hi,
Use below code inside your code where you are setting field properties of your custom fields.
IMPORT i_trtyp FROM MEMORY ID 'change/display'.
IF sy-subrc = 0.
CASE i_trtyp.
* Display
WHEN 'A'.
screen-input = 0.
* Change
WHEN 'V'.
screen-input = 1.
ENDCASE.
MODIFY SCREEN.
ENDIF.
Field i_trtyp contain value of idsplay/change.
If i_trtyp = 'V' means ME22n screen in change mode.
If i_trtyp = 'A' means ME22n screen in Display mode.
BR,
Vijay
11-29-2011 1:23 PM
In the PBO of Screen 0111 of program SAPLXM06 check the sy-tcode.
If it is ME23N, disable the EKPO_CI-ZField.
" Program SAPLXM06 and Screen 0111
LOOP AT SCREEN.
IF screen-name EQ 'EKPO_CI-ZFIELD' AND
sy-tcode EQ 'ME23N'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
PS: the above is applicable for Z field in PO 'Item Level', if it is in header level screen number will be 0101
11-29-2011 1:53 PM
Thanks for everyone, but you missed the point.
I know how to code for ME23N. This is not the problem.
The problem is the duality of ME22n, which basically used to Change a document, but also have a Display mode.
How can I tell at which mode am I when ME22n is called or refreshed (e.g. after you save your work in this t-code, it will automatically switch to display mode).
Regards,
Ayal Telem.
11-29-2011 4:20 PM
Hi,
In your PBO write below statement.
IMPORT i_trtyp FROM MEMORY ID 'change/display'.
if value of i_trtyp is 'V' means ME22N -change mode
if value of i_trtyp is 'A' means ME22N -display mode
See above code of mine.
In standard program they are setting field i_trtyp to memory which contain display/change information.
Try this.
BR,
Vijay
11-30-2011 7:04 AM
11-30-2011 7:23 AM
11-30-2011 7:46 AM
Dear Vijay,
I tried it but it returns nothing.
I found the SAP code where they change the mode and they are not using any global flag, just local classes.
Enjoy,
Ayal.
11-30-2011 9:13 AM
Hi
Use the below approach.
Inside below costomer exit EXPORT the display/change flag to memory.
CALL FUNCTION 'EXIT_SAPMM06E_006'
EXPORTING
i_ekko = ekko
i_ekko_old = *ekko
i_trtyp = trtyp <---this contain flag 'A' or 'V' for display /change.
i_ci_ekko = l_ci_ekko
i_bstyp = ekko-bstyp
i_no_screen = im_no_screen
i_lfa1 = lfa1
i_lfm1 = lfm1
i_kekko = kekko
i_aekko = aekko
i_rekko = rekko
i_vorga = t160-vorga
TABLES
tekpo = lt_usr_tekpo
teket = lt_usr_teket
tekkn = lt_usr_tekkn
tkomv = lt_usr_tkomv
EXCEPTIONS
OTHERS = 0.
Put below code inside above customet exit.
EXPORT i_trtyp TO MEMORY ID 'change/display'.
Try this.
BR,
Vijay
11-30-2011 9:38 AM
Dear Vijay and Nabheet,
Your approach might work for some but here is the problem:
The behaviour of ME22N is changing pending its caller.
If you call it from the Command-line (field at the top-left of the screen), after the "Save" action it will automatically revert to Dispaly mode.
If you call it from another program (like from SE93), after the "Save" action it will return to the caller (in our example, you'll be back to t-code SE93).
The problem with your approach is that you will not always be able to clear the Parameter-ID you use to indicate the mode.
I have found another [better] solution using Implicit-enhancement.
Package MEGUI has a class called "LCL_TRANSACTION_PO". I have played with my Parameter-ID in the following methods:
1. Change_To_Display: switch to display.
2. Display_To_Change: switch to change.
3. Save: switch to display
4. Close: clear flag
According to my test thus far, it cover all options :).
Thank you and enjoy.
Ayal Telem.
11-30-2011 9:41 AM
Thanks for the feedback. But i believe when SAP has provide with the parameter when Data is changed or display what is the need of the enhancement.
Anyways will keep this also in mind.
thanks
Nabheet
11-30-2011 9:56 AM
Dear Nabheet,
First, let's agree that you have to use a Parameter-ID flag to indicate to your PBO how to set your field/s.
The problem I found with your approach is that, in certain scenarios, you will not be able to clear your flag, which mean its value will affect your next access to ME22N.
Enjoy,
Ayal.
11-30-2011 9:59 AM
To whom it may concern,
Due to SDN issue I was not able to post my code in previous message.
So here it is.
Example of the code in the Enhancements (example from Save method):
" After Save, the PO will be re-display in Display mode (if transaction called from
" Command-line filed [top of the screen]).
" This enhancement will set a Parameter-ID flag to inidicate we are changing mode.
" This is needed to set the mode of the new field we added ("Responsible Purchaser"
" in tab "Link To Order" of ME2xN) when we change mode in ME22N.
" The field is added in screen-exit 101 of "MM06E005" and is maintained in
" "ZXM06U36" (update from db) and "ZXM06U37" (updating to db).
" ------ NOTE: This flag is also changed in other methods of this class. ------
DATA: lv_mode TYPE char1.
* ---------- "THIS IS EXAMPLE - EACH METHOD SHOULD SET FLAG ACCORDINGLY" ---------*
lv_mode = 'D'. "Display mode
SET PARAMETER ID 'ZME28_101_MODE' FIELD lv_mode.
And this is the code in the PBO of the screen-exit (101 in my case):
MODULE pbo_101 OUTPUT.
DATA: lv_mode TYPE char1.
" Getting a mode flag.
" This flag is set at Enhancements in methods
" of class "LCL_TRANSACTION_PO" of package "MEGUI".
GET PARAMETER ID 'ZME28_101_MODE' FIELD lv_mode.
LOOP AT SCREEN.
IF screen-name CS 'CI_EKKODB-ZZ_BKGRP'. "Responsible Purchaser field
IF lv_mode = 'D' or "Display mode
sy-tcode = 'ME23N'.
screen-input = '0'. "Disabled
ELSE.
" By default ME22N is coming in Change mode.
screen-input = '1'. "Enabled
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMODULE. "PBO_101 OUTPUT
According to my test thus far, it cover all options :).
Thank you and enjoy.
Ayal Telem.
11-30-2011 10:03 AM
Dear Ayal
I do agree with your point but my question here is in Real time Scenario or In production system will end user have access to SE93
I dont think so.
Anyways the solution looks good.
thanks
Nabheet
11-30-2011 2:32 PM
Dear Nabheet,
SE93 was just a quick example you can test.
More Production-like scenario will be when a process is using "CALL TRANSACTION" to access ME22N.
Regards,
Ayal.
02-24-2020 8:56 PM
I have Exactly the same requirement . How can I find whether Me22n is in display mode or in change mode, Depending upon which I need to set my custom fields editable or non editable.
11-30-2011 8:56 AM
Hi,
If you have used MM06E005 then in that in function module we have parameter as I_TRTYP its transaction type. You can check its value. Else please let us know which exit have you used.
thanks
Nabheet
02-24-2020 8:57 PM
I have Exactly the same requirement . How can I find whether Me22n is in display mode or in change mode, Depending upon which I need to set my custom fields editable or non editable.
02-24-2020 8:57 PM
I have Exactly the same requirement . How can I find whether Me22n is in display mode or in change mode, Depending upon which I need to set my custom fields editable or non editable.