cancel
Showing results for 
Search instead for 
Did you mean: 

SAP B1 Prevent update of a UDF in Order Detail RDR1 line item detail

0 Kudos

I know there are a ton of questions already answered about UDF and preventing them from being updated by using SP_TransactionNotification. However, none of them address blocking updates on the line item level.(or none that I have found)

I added a field to capture the Original order quantity from the customers PO. This UDF XX_POQty updates the SAP Quantity field RDR1.Quantity. Once the order is saved I want to prevent XX_POQty from being changed. I still want to be able to change RDR1.Quantity, because by agreement we can over ship to customers by 5% and to over ship we need to change the order quantity. I know we can go back in the ADOC and ADO1 to see the original amount but it is easier to have it right on the order. If we do not change the RDR1.Quantity the order would auto close the line after 1,000 were shipped. And No, they do not want to add a line for the overage, that would be too easy. 🙂

added this code to SP_TransactionNotification but it does not work. Any ideas?

if (@object_type ='17') and ( @transaction_type ='U')
begin 
if EXISTS (select U_U_XX_POQty from RDR1 T0 where T0.DocEntry = @list_of_cols_val_tab_del and T0.LineNum =@list_of_cols_val_tab_del and U_U_XX_POQty is not null)
begin

set @error = 152
           Set @error_message = 'Original Order Amount Cannot be changed'
end
end

Accepted Solutions (0)

Answers (1)

Answers (1)

Johan_H
Active Contributor
0 Kudos

Hi Philip,

"I added a field to capture the Original order quantity from the customers PO."

To where?

"This UDF XX_POQty updates the SAP Quantity field RDR1.Quantity."

Why? Why would you not just enter the original quantity directly into the RDR1.Quantity field?

"Once the order is saved I want to prevent XX_POQty from being changed. I still want to be able to change RDR1.Quantity, because by agreement we can over ship to customers by 5% and to over ship we need to change the order quantity. "

Making some assumtions, you can do this with SP_TransactionNotification, by comparing RDR1.Quantity to XX_POQty (+5%).

if (@object_type ='17') and ( @transaction_type ='U')
 begin 
  if EXISTS (select isnull(T0.U_U_XX_POQty, 0) 
from RDR1 T0
where T0.DocEntry = @list_of_cols_val_tab_del
and T0.Quantity > (isnull(T0.U_U_XX_POQty, 0) * 1.05))
begin
set @error = 152
set @error_message = 'Original Order Amount Cannot be changed, and Quantity Cannot exceed it by more than 5%'
end
end

Regards,

Johan

0 Kudos

Johan,

We want to capture the amount the customer ordered versus the amount we produced and shipped. U_U_XX_POQty captures the amount the customer ordered and RDR1.Quantity is the amount we produced and shipped. Currently we update RDR1.Quantity with the overage, but then we need to go back to the customer PO (not in SAP) or the transaction log to figure out what was ordered by the customer.

Basically I want to lock the U_U_XX_POQty field after sales enters the order because production needs to change RDR1.Quantity to ship the overage and I do not want them to change the original amount saved in U_U_XX_POQty.

maybe I can modify what you posted. I am just not sure how to get the query to check all the lines in RDR1 for the order.

Philip

Johan_H
Active Contributor
0 Kudos

Hi Philip,

I think I get it. How is the customer order amount saved into the U_U_XX_POQty field originally?

Regards,

Johan