cancel
Showing results for 
Search instead for 
Did you mean: 

reason for rejection for sales order

Former Member
0 Kudos

I want to set reason for rejection when the sales order is created at first time.

I try to use user-exit MV45AFZZ and program as below:

FORM USEREXIT_SAVE_DOCUMENT.

IF VBAK-VBTYP = 'C' AND VBAK-VKORG = 'D100'.

LOOP AT XVBAP.

IF XVBAP-ABGRU = ''.

XVBAP-ABGRU = '01'.

MODIFY XVBAP.

ENDIF.

ENDLOOP.

ENDIF.

However it doesn't work.

Any suggestion?

thanks,

Yang

Accepted Solutions (1)

Accepted Solutions (1)

former_member1115366
Active Participant
0 Kudos

Changes to XVBAP need to happen before USEREXIT_SAVE_DOCUMENT. That exit is meant to change other tables (like custom ones) based on the current document.

Move your code to USEREXIT_SAVE_DOCUMENT_PREPARE and it should work. If you want to test for document creation (versus u201Cchangeu201D) then add this test:

  • If field T180-TRTYP contents 'H', the document will be *

  • created, else it will be changed.

Regards,

Ken

Former Member
0 Kudos

Dear Ken

it woks, thank you for your suggestion.

Answers (4)

Answers (4)

Former Member
0 Kudos

I want to find a standard way in SAP function

Former Member
0 Kudos

Hello Yang

In stead of using code to set a reason for rejection, I recommend using config and setting up Delivery and/or Billing Blocks for the Sales Document type ( IMG T Code VOV8).

This way you will use standard functionality, you can use work lists to display documents with Delivery/Billing Blocks( VA14L and V.23) and more importantly with Delivery block you can control printing order confirmation, prevent transfer of requirements etc. You can use standard delivered 'Delivery Blocks' or set up your won using the following menu path:

SPRO/IMG/ Logistics Execution/Shipping/Deliveries/Define Reasons for Blocking in Shipping

Let me know if this works for you.

Former Member
0 Kudos

Dear Chandrasekhar

Thank you for the idea of standard function.

but I'm not sure such standard function can met my requirement.

My request is:

1. the shipment exceeding credit limit but only up to 30% can be made upon approval by the Managing Director. Any shipment exceeding credit limit by 30% or more shall not be made or approved.

2.The number of past due days is 10 days or less; the amount of delayed payment is within the credit limit and the credit insurance will be applied, the shipment can be made upon approval by the Managing Director.

So I consider to user user exit to check the credit limit while save the sales order and set reason of rejection in order to block the order.

Do you have any further suggestion?

Former Member
0 Kudos

Hello Yang

In stead of using code to set a reason for rejection, I recommend using config and setting up Delivery and/or Billing Blcoks for the Sales Document type ( IMG T Code VOV8).

This way you will use standard functionality, you can use worklists to display documents with Delivery/Billing Blocks( VA14L and V.23) and more importantly with Dleivery block you can control priniting order confirmation, prevent transfer of requirements etc. You can use standard delivered 'Delivery Blocks' or set up your won using the following menu path:

SPRO/IMG/ Logistics Execution/Shipping/Deliveries/Define Reasons for Blocking in Shipping

Former Member
0 Kudos

Hi,

I think you have to check the system transaction = VA01 in MV45AFZZ in Save_Document. I think it should work.

Thanks

Mukund S