Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

User Exit for VA02

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos
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 REPLIES 10

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

former_member188685
Active Contributor
0 Kudos
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.

0 Kudos

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

0 Kudos

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.

0 Kudos

Hi

Also check the dump in trx ST22

Max

0 Kudos

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

0 Kudos

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

0 Kudos

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.

naimesh_patel
Active Contributor
0 Kudos

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