08-15-2013 4:56 AM
Hi,
Considers the below statements in SAPMV45A, Screen 4900 (PAI module).
CHAIN.
FIELD: vbap-matnr,
vbapd-matnr_g,
rv45a-mabnr,
* IS2ERP Media enhancement
vbap-idcodetype, "ISBN-Nr.
vbap-ismidentcode, "ISBN-Nr.
vbap-kdmat,
vbap-posex
MODULE vbap-posex_pruefen ON CHAIN-REQUEST.
ENDCHAIN.
I implemented my code enhancement in module 'vbap-posex_pruefen'.
May I know is there a way to trigger the enhancement codes only when VBAP-KDMAT is changed (while changes on other fields such as vbap-matnr, vbap-posex etc will not trigger it)?
Kindly please let me know if you know how to achieve this.
Thank much, Nick
08-17-2013 5:26 PM
Hi Nicholas,
Currently I am not over my system, so I can't tell you the correct answer, but would request you to look into the following proposed solutions :
1. Check if system contains the unchanged value ( previous value ) in variable YVBAP, if yes, then you can put your piece in code inside If clause ( If YVBAP-posex_pruefe NE XVBAP-posex_pruefe ).
2. Otherwise you can also check, if there is some Exit in PBO, if yes, set unchanged value in memory and then again check for the changed variable in PAI block.
Hope it helps.
Thanking You All.
08-15-2013 9:31 PM
Why did you put an enhancement there? There is the whole bunch of user exits available in SD, they're well documented and may be used to compare old and new values. Google -> SD user exit site:sap.com
08-17-2013 4:17 AM
Thanks Jelena. I tried embedded my custom code into user exit MV45AFZZ before this. However, I found that when it triggers my custom code, it wouldn't select/highlight the line item that triggered it. I would like to focus on that specific line item (that triggers the custom code) so that user will aware of that line item and then made the necessary data input correction on it. Thanks.
08-19-2013 2:57 PM
User exit to check VBAP values is USEREXIT_CHECK_VBAP in MV45AFZB. It's not going to highlight the whole line item, but I believe it should position the cursor on the item in question. I don't have it implemented in the current system, so can't confirm, unfortunately.
08-20-2013 1:17 AM
08-15-2013 11:30 PM
Hi Nicholas,
If you want to do a change to a field in the Sales item level, then you can achieve it in the subroutine - USEREXIT_MOVE_FIELD_TO_VBAP in the INclude - MV45AFZZ..
Since the above routine is triggered whenever you do changes to Sales line item. So you can introduce your check here
08-17-2013 4:24 AM
Thanks Raja. Initially, I tried embedded my custom code into user exit MV45AFZZ (subroutine userexit_field_modification) before this. However, I found that when it triggers my custom code, it wouldn't select/highlight the line item that triggered it. I would like to focus on that specific line item (that triggers the custom code) so that user will aware of that line item and then made the necessary data input correction on it. Thanks.
08-16-2013 2:11 AM
Instead of having the code within the chain, you can use this:
Field vbap-kdmat module vbap-posex_pruefen on request.
The module will only be entered if the value of vbap-kdmat is changed or considered to be changed....
Help says,
FIELD dynp_field MODULE mod [ {ON INPUT}
| {ON REQUEST}
| {ON *-INPUT}
| {ON {CHAIN-INPUT|CHAIN-REQUEST}}
| {AT CURSOR-SELECTION}.
... ON REQUEST
With this condition, module mod is called only if the value of the screen field dynp_field has been changed by input after the event PBO. It is considered as input if the existing input is overwritten with the same value or if the initial value of the field is entered explicitly. Besides user input, the following value input results in a call of mod:
08-17-2013 4:11 AM
Thanks Neil for your reply. My question is your suggested approach will involve the modification of SAPMV45A - Screen 4900, right? I am trying to avoid changing the SAP Screen as the changes might be lost when there is an upgrade in the future. Thanks again!
08-17-2013 5:26 PM
Hi Nicholas,
Currently I am not over my system, so I can't tell you the correct answer, but would request you to look into the following proposed solutions :
1. Check if system contains the unchanged value ( previous value ) in variable YVBAP, if yes, then you can put your piece in code inside If clause ( If YVBAP-posex_pruefe NE XVBAP-posex_pruefe ).
2. Otherwise you can also check, if there is some Exit in PBO, if yes, set unchanged value in memory and then again check for the changed variable in PAI block.
Hope it helps.
Thanking You All.
08-20-2013 9:05 AM
Thanks Ankit for your valuable suggestions. Initially, I was trying to use the YVBAP-KDMAT and XVBAP-KDMAT variables for comparison. However, I found that these two variables are sometimes not populated correctly (Do you know why?). Therefore, I chose to use your second suggested approach which is to store the previous unchanged value in Abap memory and then retrieve it for comparison against the latest changed value when user changed the CPN #. Thanks again, Ankit.