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: 

Enhancements- user exit_save_document_prepare

Former Member
0 Kudos

Hi,

My requirement is when sales order is created, the RSD field in sales order(VBAK-ZZREQSDATE) will be get populated automatically or entered by the users manually.But the requirement is that if the difference between the RSD date and Order Creation Date(erdat) is less than 14 working days, then while SAVING the Sales Order the system must pop up a warning message "RUSH Order u2013Lead Time < 14 days".other wise it should be saved as normal order.

1.Iam using userexit_save_document_prepare, i need help in writing the code for this requirement.

Any body please help me in completing this requirement.

Thanks & Regards,

Narasimha

5 REPLIES 5

Former Member
0 Kudos

Hi

DATA: DELTA_DAY TYPE I.

DELTA_DAY = VBAK-ZZREQSDATE - VBAK-ERADT.

IF DELTA_DAY => 14.
   MESSAGE E208(00) WITH 'RUSH Order u2013Lead Time < 14 days'.
ENDIF.

It's not clear if you check VBAK-ZZREQSDATE has to be greater than VBAK-ERADT, beacause if it's less than VBAK-ERADT.the difference will be negative:.

DATA: DELTA_DAY TYPE I.

IF VBAK-ZZREQSDATE > VBAK-ERADT.

  DELTA_DAY = VBAK-ZZREQSDATE - VBAK-ERADT.

  IF DELTA_DAY => 14.
     MESSAGE E208(00) WITH 'RUSH Order u2013Lead Time < 14 days'.
  ENDIF.
ELSE.
  ?????????????
ENDIF.

Max

0 Kudos

Hi Max,

Really thanks a lot.

The same requirement added some functionality like below mentioned.

A Z Table needs to be maintained with the fields Sales Org (VKORG) as key field,Order Type (AUART) & Lead Time Days as key field.

When Sales Order is created, the user exit_save_document_prepare must be used to read the above table and if any entries maintained based on Sales Org /Order type or only based on Sales Org , the corresponding lead time days must be considered to determine whether the Sales Order is a normal order or an Rush Order. If the difference between the RSD date (VBAK- ZZRDATE ) & Order Date-Created on date ( VBAK-ERDAT) is less than 14 working days, then while SAVING the Sales Order the system must pop up a message "RUSH Order u2013Lead Time < 14 days".

Please reply if u got any idea on the above requirement with model code

Thanks in Advance,

Narasimha

0 Kudos

Hi Max,

Any reply please..

Thanks,

Narasimha

0 Kudos

HI,

Maintain a ztable .....with table maintance or in any other means as suggested for your requirement....

next in USEREXIT_SAVE_DOCUMENT_PREPARE .....

declare workarea of you ztable type...and fetch the data form your ztable into the workarea with ...where condition on sales org ...as

select < >

from ztable

where sorg = xvbak-vkorg..

if sy-subrc = 0.

write the logic for lead time.....and raise the message ....

endif.

Thanks,

Shailaja Ainala.

0 Kudos

Hi Shailaja,

Thanks for your response, i got idea how to proceed.

Regards,

Nagendra