05-09-2006 4:00 AM
Within the enhancement SAPMF02D (has a function exit), I need to know which mode the current program is running in, such as in Display mode (Display Customer) or in Change mode (Change Customer).
What's the best way to do it?
Thank you very much!!!
05-09-2006 5:57 AM
Thank you so much for your replies!
I've tried this way before. But the problem is that, say, first I run tcode xd03 to display the customer, then I can click on the Change Icon to switch to the Change Mode. However, the tcode is still xd03, instead of xd02.
So I thought maybe there are other ways to do it.
Thank you!
05-09-2006 5:18 AM
Hi yun,
1. The FM in this exit does not provide
anything for detecting the mode.
2. However,
we can use sy-tcode
to know, which is the current transaction code.
(This same technique is used in almost
all sap transactions, to detect the mode
- display, change, create,delete etc,
bcos the program is same for all these activities,
so, the distinguishing factor is only the tcode)
3. In your case also,
FD02= change customer
FD03 = display customer
FD01 = create customer
(u can check all these tcodes in se80,
program SAPMF02D)
4.<b> Not only this is the best way,
THIS IS THE ONLY WAY.</b>
(in the most direct & practical approach)
regards,
amit m.
05-09-2006 5:46 AM
Hello,
Check on the T-code is the most suitable way for your requirement.
Regards,
Naimesh
05-09-2006 5:57 AM
Thank you so much for your replies!
I've tried this way before. But the problem is that, say, first I run tcode xd03 to display the customer, then I can click on the Change Icon to switch to the Change Mode. However, the tcode is still xd03, instead of xd02.
So I thought maybe there are other ways to do it.
Thank you!
05-09-2006 6:05 AM
Hi yun,
1. Just check out
the value of sy-ucomm in the user exit.
2. It must be UPDA (for edit)
regards,
amit m.
05-09-2006 6:14 AM
Hello Yun,
This user exit should be called whenever user presses save button. The description of the FM is like "Customers: User Exit for Checks prior to Saving". SO, this will be called in only create and change mode. Not in the Dispaly mode.
Try to set the break point and do the debug, you will have better idea.
Regards,
Naimesh
05-09-2006 7:08 AM
05-09-2006 6:07 AM
Hi,
You can check with the screen attributes in the userexit.
Screen attributes of the field, checking such as : input, output etc.
This will have the correct information of the screen during runtime.
Please award some points, if found useful.
Thanks,
Bharadwaj
05-09-2006 7:15 AM
Hi, B raju
Your information is helpful too! But that screen merely contains two subscreen areas. So I couldn't get the attribute of the screen fields.
05-25-2006 5:37 AM
Hi Yun,
This code will help you in identifying if customer is currently opened in edit or change mode. Hope you can use this logic in building your code.
REPORT ZSA_3 .
tables: SEQG3, kna1.
data i_enq like SEQG3 occurs 0 with header line.
CALL FUNCTION 'ENQUEUE_READ'
EXPORTING
GCLIENT = SY-MANDT
GNAME = 'KNA1'
GARG = ' '
GUNAME = SY-UNAME
LOCAL = ' '
IMPORTING
NUMBER =
SUBRC =
TABLES
ENQ = i_enq
EXCEPTIONS
COMMUNICATION_FAILURE = 1
SYSTEM_FAILURE = 2
OTHERS = 3
.
if not i_enq-GARG is initial.
write: 'Customer',i_enq-GARG+3(10), 'is currently opened in edit mode'.
else.
Write 'No customer is currently opened in display mode'.
endif.
plz award some points if find it useful.
Thanks & Regards,
Sandeep Arora
05-25-2006 6:00 AM
Thanks for your reply!
I also found that I could use T020 to determine the running mode.
Thanks!