10-13-2008 1:34 PM
Hi,
I have written code in user exit EXIT_SAPMV45A_003 for TCode VA02 (Sales Order Change). The code is as given below:
LOOP at XVBAP.
If XVBAP-kwmeng = 100.
XVBAP-kwmeng = 99.
Modify XVBAP.
Endif.
If XVBAP-ARKTX = 'Pumpe Stahlguss Etanorm 170-230'.
XVBAP-ARKTX = 'Changed'.
Modify XVBAP.
Endif.
Endloop.
In debug mode I can see the changed values for Order Quantity (KWMENG) and description (ARKTX). However after the entire code is executed and when I enter the sales order, first I get a pop up "Express Document Update Was Terminated received from author XXXXX". And then when I hit enter, the values are not changed
The project in CMOD and the enhancement in SMOD are activated.
Any help would be appreciated.
Thanks in advance,
Mick
10-13-2008 1:52 PM
LOOP at XVBAP.
If XVBAP-kwmeng = 100.
XVBAP-kwmeng = 99. "this quanity i am not sure
"i think you have to change schedule lines also
"which is XVBEP table.
XVBAP-UPDKZ = 'U'.
Modify XVBAP.
Endif.
If XVBAP-ARKTX = 'Pumpe Stahlguss Etanorm 170-230'.
XVBAP-ARKTX = 'Changed'.
XVBAP-UPDKZ = 'U'. "Try this...
Modify XVBAP.
Endif.
Endloop.
Keep a break point in the above loop, and check in SM13 transaction for the Update termination cause. find the source code wher the error is from SM13 transaction.
10-13-2008 1:46 PM
try this:
MODIFY xvbap
TRANSPORTING ARKTX WHERE ref_field = xvbap-ref_field.
ref_field is the entry for which you want to modify .. it may be vbeln or posnr.
10-13-2008 1:47 PM
Hi Mick
It means a dump occurs while the data was beeing saved in a background process.
U should use the trx ST22 and SM13 in order to check the dump.
Anyway remember you have to set the update flag after changing a value of item of sales order.
LOOP at XVBAP.
If XVBAP-kwmeng = 100.
XVBAP-kwmeng = 99.
XVBAP-UPDKZ = 'U' <-----------------------------
Modify XVBAP.
Endif.
If XVBAP-ARKTX = 'Pumpe Stahlguss Etanorm 170-230'.
XVBAP-ARKTX = 'Changed'.
XVBAP-UPDKZ = 'U' <-----------------------------
Modify XVBAP.
Endif.
Endloop.
Max
10-13-2008 1:52 PM
LOOP at XVBAP.
If XVBAP-kwmeng = 100.
XVBAP-kwmeng = 99. "this quanity i am not sure
"i think you have to change schedule lines also
"which is XVBEP table.
XVBAP-UPDKZ = 'U'.
Modify XVBAP.
Endif.
If XVBAP-ARKTX = 'Pumpe Stahlguss Etanorm 170-230'.
XVBAP-ARKTX = 'Changed'.
XVBAP-UPDKZ = 'U'. "Try this...
Modify XVBAP.
Endif.
Endloop.
Keep a break point in the above loop, and check in SM13 transaction for the Update termination cause. find the source code wher the error is from SM13 transaction.
10-13-2008 2:09 PM
Thank you for your prompt response.
This is what I could see in SM 13.
10 MCV_STATISTICS_UPD_V2_ORDER V2 Error
Internal TSKH error, session terminated.
Please help. How can I solve this error.
Regards,
Mick
10-13-2008 2:13 PM
double click on MCV_STATISTICS_UPD_V2_ORDER function, there you see the information where the error caused inside the Function. In one of the perform include it will be. and why i am asking is , it gives more clear picture about the error, from there we can start analyzing the error.
10-13-2008 2:17 PM
10-13-2008 2:18 PM
When I double click on MCV_STATISTICS_UPD_V2_ORDER in SM13, the details that I can see are given below. It does not mention any perform or subroutine.
Function Module MCV_STATISTICS_UPD_V2_ORDER
Status Update was terminated
Report
Row
Error details Class: 14 Number: 005
14 005: Internal TSKH error, session terminated
10-13-2008 2:32 PM
Hi!
The logic is the following: the old values are stored in an YVBAP table and the new values have to be in the XVBAP table.
So you have to code it somehow like this:
LOOP at XVBAP.
store the old values, before anything has been changed, and if neccessary
READ TABLE yvbap WITH KEY posnr = xvbap-posnr.
IF sy-subrc NE 0.
MOVE-CORRESPONDING xvbap TO yvbap.
APPEND yvbap.
ENDIF.
If XVBAP-kwmeng = 100.
XVBAP-kwmeng = 99. "this quanity i am not sure
"i think you have to change schedule lines also
"which is XVBEP table.
IF XVBAP-UPDKZ IS INITIAL. "to keep the original state, if it is in insert or in delete mode
XVBAP-UPDKZ = 'U'.
ENDIF.
Modify XVBAP.
Endif.
If XVBAP-ARKTX = 'Pumpe Stahlguss Etanorm 170-230'.
XVBAP-ARKTX = 'Changed'.
IF XVBAP-UPDKZ IS INITIAL. "to keep the original state, if it is in insert or in delete mode
XVBAP-UPDKZ = 'U'. "Try this...
ENDIF.
Modify XVBAP.
Endif.
Endloop.
Regards
Tamás
Edited by: Tamás Nyisztor on Oct 13, 2008 3:34 PM
10-14-2008 7:03 AM
Thanks Vijay.
I am able to get the changed description in the sales order based on the code written in the user exit.
I guess for changing the order quantity at line item level, we will have to change the schedule lines also.
Points awarded.
10-13-2008 2:37 PM
Instead of Modifying XVBAP in the User exit EXIT_SAPMV45A_003, write your code in the Include MV45AFZZ subroutine USEREXIT_SAVE_DOCUMENT_PREPARE.
Regards,
Naimesh Patel