Skip to main content
Solved

Approval Process in Customer invoice

  • August 25, 2023
  • 2 replies
  • 226 views

Forum|alt.badge.img+9

Hello , 

I need to prevent the creation of a new customer invoice if the customer is not approved .

I tried to create a custom event to control that , But it does’t stop  the creation of a new customer invoice .

I applied the custom event on CustomerOrderInvHead (LU) and INVOICE_TAB and here is the script of my event action : 

DECLARE 
lu_name_ VARCHAR2(1000) ; 
key_ref_  VARCHAR2(32000) ; 
result_ VARCHAR2(32000) ; 
--approval_status_ VARCHAR2(1000) ; 
BEGIN
lu_name_     := 'CustomerOrderInvHead'; 
key_ref_   := 'CUSTOMER_ID=&NEW:IDENTITY^'  ;                     
result_ := approval_routing_api.is_approved(lu_name_,key_ref_);    

IF (result_ = 'FALSE') THEN
      Error_SYS.Record_General(lu_name_, 'APPROVAL_ROUTING: This invoice cannot be created. The customer is not approved') ;
end if;

END;

 

Does anyone have an idea what could be the problem ? 

 

Thank you ,

Hanane

 

 

Best answer by Hanane

Thank you for the reply .

Actually the problem was : when the field invoice cust in the customer is filled , the check is directed to the invoice customer instead of the ordering customer .

It’s okey for my case so problem resolved , but I’ll leave my explanation here in case it will help someone else .

2 replies

Forum|alt.badge.img+15
  • Superhero (Employee)
  • 180 replies
  • August 29, 2023

@Hanane 

My starting point would be check the value result_ . Can you try out the following. 

This will print out the result_ value so we can see what the approval api returning

Error_SYS.Record_General(lu_name_, 'APPROVAL_ROUTING: This invoice cannot be created. The customer is not approved') ;

 


Forum|alt.badge.img+9
  • Author
  • Sidekick
  • 42 replies
  • Answer
  • August 30, 2023

Thank you for the reply .

Actually the problem was : when the field invoice cust in the customer is filled , the check is directed to the invoice customer instead of the ordering customer .

It’s okey for my case so problem resolved , but I’ll leave my explanation here in case it will help someone else .