on 09-06-2016 1:14 PM
Dear Experts,
I have small requirement.
In Business partner master data, defined as properties 1 & 2.
My requirement as Based on business partner properties A/R credit Memo need to be a control.
Example :
Properties 1 as 'Yes' & While adding credit memo as ' 01 Warehouse' or if Properties 2 as 'Yes' & while adding credit memo as '02 warehouse'
Please help me to provide SP_TN for this case.
Hi Mohamed
Try below query
IF @object_type = N'14' AND ( @transaction_type = N'A')
Begin
DECLARE @MyCursorOP CURSOR
declare @LineNumOP VarChar(20)
declare @WhsCode VarChar(200)
declare @Prop1 VarChar(200)
declare @Prop2 VarChar(200)
SET @MyCursorOP = CURSOR FAST_FORWARD
FOR SELECT T1.LineNum,T1.WhsCode,T2.QryGroup1,T2.QryGroup2
from ORIN T0
inner join RIN1 T1 on T0.DocEntry = T1.DocEntry
inner join OCRD T2 on T0.CardCode = T2.CardCode where T0.DocEntry = @list_of_cols_val_tab_del
OPEN @MyCursorOP
FETCH NEXT FROM @MyCursorOP
INTO @LineNumOP,@WhsCode,@Prop1,@Prop2
WHILE @@FETCH_STATUS = 0
BEGIN
if ((@WhsCode <> '01 Warehouse' and @Prop1 = 'Y') or (@WhsCode <> '02 Warehouse' and @Prop2 = 'Y'))
BEGIN
SELECT @Error = 12
SELECT @error_message = 'Warehouse code doesnt matches with BP Property at line -'+convert(nvarchar(200),(@linenumop+1))
END
FETCH NEXT FROM @MyCursorOP
INTO @LineNumOP,@WhsCode,@Prop1,@Prop2
END
CLOSE @MyCursorOP
DEALLOCATE @MyCursorOP
End
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Could you please help me for this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can try this
Declare @WhsCode as nvarchar(100)
Declare @Prop1 as varchar(100)
Declare @prop2 as varchar(100)
if @object_type = 14 and @transaction_type in ('A' , 'U')
Begin
select @Whscode = t1.whscode,@Prop1 = t2.QryGroup1 , @Prop2= t2.QryGroup2
from orin t0 inner join rin1 t1 on t0.docentry = t1.docentry
inner join ocrd t2 on t0.cardcode = t2.cardcode where t0.docentry =list_of_cols_val_tab_del
if (@Whscode <> '01' and @prop1 = 'Y') or (@whscode <> '02' and @Prop2 = 'Y')
Begin
Set @Error = -10
Set @Error_Message = 'Please Match Warehouse With BP Property'
End
End
Hope this will help you.
Regards
Narayani
User | Count |
---|---|
85 | |
7 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.