Saturday 4 June 2016

Stored Procedure - Owner Name Mandatory for All Purchase & Sales Documents


-----------------------------------SQ-OWner Name Mandatory--------------------------------------------------
If @object_type = '23' and @transaction_type in ( 'A','U')



BEGIN
If exists (Select P.DocEntry, P.DocCur From OQUT P INNER JOIN QUT1 Q on P.DocEntry = Q.DocEntry

Where Q.DocEntry=@list_of_cols_val_tab_del

and isnull(P.OwnerCode ,'') = '' )

Select @error = 2300001-01,

@error_message = 'Please Set Owner Name for SQ'



end
-------------------------------------SO-OWner Name Mandatory---------------------------------------------------
If @object_type = '17' and @transaction_type in ( 'A','U')



BEGIN
If exists (Select P.DocEntry, P.DocCur From ORDR P INNER JOIN RDR1 Q on P.DocEntry = Q.DocEntry

Where Q.DocEntry=@list_of_cols_val_tab_del

and isnull(P.OwnerCode ,'') = '' )

Select @error = 1700001-01,

@error_message = 'Please Set Owner Name for SO'



end
----------------------------------------------------------------------------------------------------

-------------------------------------Delivery - Owner Name Mandatory---------------------------------------------------------------------
If @object_type = '15' and @transaction_type in ( 'A','U')



BEGIN
If exists (Select P.DocEntry, P.DocCur From ODLN P INNER JOIN DLN1 Q on P.DocEntry = Q.DocEntry

Where Q.DocEntry=@list_of_cols_val_tab_del

and isnull(P.OwnerCode ,'') = '' )

Select @error = 151-01,

@error_message = 'Please Set Owner Name for Delivery'



end
-------------------------------------Return - Owner Name Mandatory----------------------------------------------------------------------
If @object_type = '16' and @transaction_type in ( 'A','U')



BEGIN
If exists (Select P.DocEntry, P.DocCur From ORDN P INNER JOIN RDN1 Q on P.DocEntry = Q.DocEntry

Where Q.DocEntry=@list_of_cols_val_tab_del

and isnull(P.OwnerCode ,'') = '' )

Select @error = 161-01,

@error_message ='Please Set Owner Name for Return'



end
-------------------------------------A/R Invoice - Owner Name Mandatory-----------------------------------------------------------------
If @object_type = '13' and @transaction_type in ( 'A','U')



BEGIN
If exists (Select P.DocEntry, P.DocCur From OINV P INNER JOIN INV1 Q on P.DocEntry = Q.DocEntry

Where Q.DocEntry=@list_of_cols_val_tab_del

and isnull(P.OwnerCode ,'') = '' )

Select @error = 131-01,

@error_message ='Please Set Owner Name for A/R Invoice'



end
-------------------------------------A/R Cr.memo - Owner Name Mandatory----------------------------------------------------------------
If @object_type = '14' and @transaction_type in ( 'A','U')



BEGIN
If exists (Select P.DocEntry, P.DocCur From ORIN P INNER JOIN RIN1 Q on P.DocEntry = Q.DocEntry

Where Q.DocEntry=@list_of_cols_val_tab_del

and isnull(P.OwnerCode ,'') = '' )

Select @error = 141-01,

@error_message ='Please Set Owner Name for A/R Cr.memo'



end
-------------------------------------PO - Owner Name Mandatory-------------------------------------------------------------------------------
If @object_type = '22' and @transaction_type in ( 'A','U')



BEGIN
If exists (Select P.DocEntry, P.DocCur From OPOR P INNER JOIN POR1 Q on P.DocEntry = Q.DocEntry

Where Q.DocEntry=@list_of_cols_val_tab_del

and isnull(P.OwnerCode ,'') = '' )

Select @error = 221-01,

@error_message ='Please Set Owner Name for PO'



end
-------------------------------------GRPO - Owner Name Mandatory-----------------------------------------------------------------------
If @object_type = '20' and @transaction_type in ( 'A','U')



BEGIN
If exists (Select P.DocEntry, P.DocCur From OPDN P INNER JOIN PDN1 Q on P.DocEntry = Q.DocEntry

Where Q.DocEntry=@list_of_cols_val_tab_del

and isnull(P.OwnerCode ,'') = '' )

Select @error = 201-01,

@error_message ='Please Set Owner Name for GRPO'



end
-------------------------------------Goods Return - Owner Name Mandatory----------------------------------------------------------------
If @object_type = '21' and @transaction_type in ( 'A','U')



BEGIN
If exists (Select P.DocEntry, P.DocCur From ORPD P INNER JOIN RPD1 Q on P.DocEntry = Q.DocEntry

Where Q.DocEntry=@list_of_cols_val_tab_del

and isnull(P.OwnerCode ,'') = '' )

Select @error = 211,

@error_message ='Please Set Owner Name for Goods Return'



end


-------------------------------------AP Invoice - Owner Name Mandatory--------------------------------------------------------------------
If @object_type = '18' and @transaction_type in ( 'A','U')



BEGIN
If exists (Select P.DocEntry, P.DocCur From OPCH P INNER JOIN PCH1 Q on P.DocEntry = Q.DocEntry

Where Q.DocEntry=@list_of_cols_val_tab_del

and isnull(P.OwnerCode ,'') = '' )

Select @error = 181-01,

@error_message ='Please Set Owner Name for AP Invoice'



end
-------------------------------------AP Cr.memo - Owner Name Mandatory--------------------------------------------------------------------
If @object_type = '19' and @transaction_type in ( 'A','U')



BEGIN
If exists (Select P.DocEntry, P.DocCur From ORPC P INNER JOIN RPC1 Q on P.DocEntry = Q.DocEntry

Where Q.DocEntry=@list_of_cols_val_tab_del

and isnull(P.OwnerCode ,'') = '' )

Select @error = 191-01,

@error_message ='Please Set Owner Name for AP Cr.memo'



end
--------------------------------------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment