cancel
Showing results for 
Search instead for 
Did you mean: 

User exit in SD module

former_member184504
Participant
0 Kudos

Dear all,

I have written a particular code in User Exit named MV45AFZZ for SD module for sales order creation and change which is giving certain errors like updating error. and some times the sales order stops flowing in MRP and once i comment the code it starts flowing again in MRP. Is there any table getting missed to be updated in my user exit. I am pasting my code below. 

Requirement:- To change the reason for rejection in sales order creation and change through VA01 and VA02 respectively as per the

                        Delivery block.

{code}

DATA: wa_vbap LIKE xvbap.

DATA: wa_yvbap LIKE yvbap.

IF t180-trtyp = 'H'.    " "H" means Creation of Sales order

   IF vbak-lifsk = 01.

     LOOP AT xvbap[] INTO wa_vbap.

       wa_vbap-abgru = 'ZZ'.

       MODIFY xvbap[] FROM wa_vbap INDEX sy-tabix.

       CLEAR wa_vbap.

     ENDLOOP.

   ELSE.

     LOOP AT xvbap[] INTO wa_vbap.

       wa_vbap-abgru = ' '.

       MODIFY xvbap[] FROM wa_vbap INDEX sy-tabix.

       COMMIT WORK.

       CLEAR wa_vbap.

     ENDLOOP.

   ENDIF.

ELSEIF t180-trtyp EQ 'V'.   " "V" means change of Sales order

   IF vbak-lifsk = 01.

     LOOP AT xvbap[] INTO wa_vbap.

       wa_vbap-abgru = 'ZZ'.

       wa_vbap-updkz = 'U'.

       MODIFY xvbap[] FROM wa_vbap INDEX sy-tabix.

       CLEAR wa_vbap.

     ENDLOOP.

   ELSE.

     LOOP AT xvbap[] INTO wa_vbap.

       wa_vbap-abgru = ' '.

       wa_vbap-updkz = 'U'.

       MODIFY xvbap[] FROM wa_vbap INDEX sy-tabix.

       CLEAR wa_vbap.

     ENDLOOP.

   ENDIF.

ENDIF.

{code}

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Remove

COMMIT WORK. in the code.. ithink then it should work.

former_member184504
Participant
0 Kudos

I have tried that it by removing the Commit work. But it is not working even after removing the commit work.