Hello Experts,
I need help on selecting credit memo lines in add mode. Here is my stored prcedure:
Declare @IN_DocEntry nvarchar(50)
,@IN_TranType nchar(1)
Declare @DE Int
select @DE = cast(@IN_DocEntry as int)
Create Table #CreditMemo
(DocEntry int not null
,LineNum int not null
,TargetType int null
,BaseRef nvarchar(16) null
,BaseEntry int null
,BaseLine int null
,LineStatus Char(1) null
,LineTotal numeric(19,6) null)
If exists ( select 1 from RPC1 t0 where t0.DocEntry=@DE)
begin
Insert into #CreditMemo(DocEntry,LineNum,TargetType,BaseRef,BaseEntry,BaseLine,LineStatus,LineTotal)
select DocEntry,LineNum,TargetType,BaseRef,BaseEntry,BaseLine,LineStatus,LineTotal from RPC1 where DocEntry=@DE
end
select * from #CreditMemo
For Instance:
1) say i am in Add Mode on Credit Memo
2) Copied three Invoices on to Credt Memo ( each invoice contains 3 lines, hence 9 lines on Credit Note)
3) Now i would like to select 9 lines which are on Credit Memo and insert into temp table( Note : I haven't added the CM )
When executed the above stored procedure in add mode i get empty list. Please advise me.
Thanks,
Praneeth