Skip to Content
avatar image
Former Member

results of query in sql window coming but the same query in procedure not coming

Dear Gurus

I am re posting the same because the earlier post showed some error and I could not see the same in authored list.

Our version is on sp83.

I have procedure created as follows.

create procedure zsd_hade_rep(in p_vkorg nvarchar(4),in p_lfdatf date,in p_lfdatt date,out hade_rep tt_hade_rep)




In this there are many queries. While i debug the procedure this query is not returning any rows.

tgt_qty = select a.vkorg,a.auart,a.kunnr,c.zname1,b.matnr,c.zmaktx,b.WERKS,c.mtart,

  sum(case when (b.VRKME = 'MT' or b.VRKME='TO') then b.zMENG*umziz else b.zMENG*UMZIN end) as conqty, 0 del_qty

  from sapagd.vbak a, sapagd.vbap b, (select a.zkunnr,a.zname1,a.zmatnr,a.zmaktx, b.mtart

  from sapagd.zhd_rep a, sapagd.mara b

  where a.zmatnr = b.matnr

  order by a.zkunnr,a.zmatnr) c

  where a.vbeln = b.vbeln

  and a.vkorg = :p_vkorg

  and a.auart = 'ZTLP'

  and a.GUEBG >= :p_lfdatf

  and a.GUEEN <= :p_lfdatt

  and a.kunnr = c.zkunnr

  and b.matnr = c.zmatnr

  group by a.vkorg,a.auart,a.kunnr,c.zname1,b.matnr,c.zmaktx,b.VRKME,b.werks,c.mtart

So i ran the query in an sql window by passing

and a.vkorg = '1000'

and a.GUEBG >= '20150101'

  and a.GUEEN <= '20151231'

Here i am getting results.

What could be the issue.

Thanks and regards

Arun kumaar Menon.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Jan 13, 2015 at 05:34 AM

    Hi Arun,

    As you said there are many queries in your stored procedure. Why not just keep the query you pasted and test it again? Or you can hardcode the input parameters in your procedure to see if the result comes.

    Best regards,


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks wenjun problem go solved i just used this to_dats( :p_lfdatf)

      Thanks and regards

      Arun Kumar Menon