‎2009 Apr 30 11:00 AM
Hi All,
Please tell me how to combine the following 2 select queries:
SELECT SINGLE konda
FROM vbkd
INTO v_konda
WHERE vbeln EQ v_vbelv.
SELECT SINGLE traty
FROM vbkd
INTO wa_output-out_code
WHERE vbeln EQ v_vbelv
AND posnr EQ v_posnr.
in order to access VBKD table only once.(here wa_output is a work area)
Thanks,
Neethu.
‎2009 Apr 30 11:05 AM
SELECT SINGLE konda traty
FROM vbkd
INTO ( v_konda, wa_output-out_code )
WHERE vbeln EQ v_vbelv AND posnr EQ v_posnr.
‎2009 Apr 30 11:27 AM
Hi,
But, for the first select query I dont need the condition posnr EQ v_posnr.
Please tell how to do this.
Thanks,
Neethu
‎2009 Apr 30 11:47 AM
Hi,
Then its not possible... as both have different conditional records, so you will have to write two different queries ...
Tell me are you writing these two queries inside the loop..... or it gets executed only once...
if its once then you will have to write it separately...
if its in a loop then give the code will try to minimize hits to db table.
Regards,
Siddarth
‎2009 Apr 30 11:51 AM
Hi,
I hope there is no other option for your requirement.
Because the requirements are having distinct meaning.
So you have to write two SELECT statements.
But you can try like the following:
SELECT SINGLE konda traty FROM vbkd
INTO ( v_konda, wa_output-out_code )
WHERE vbeln EQ v_vbelv AND posnr EQ v_posnr.
if sy-subrc ne 0.
SELECT SINGLE konda FROM vbkd
INTO v_konda WHERE vbeln EQ v_vbelv.
endif.
Thanks and Best Regards,
Suresh
‎2009 Apr 30 11:06 AM
HI,
Check this code..
SELECT SINGLE konda traty
FROM vbkd
INTO ( v_konda , wa_output-out_code )
WHERE vbeln EQ v_vbelv
AND posnr EQ v_posnr.
‎2009 May 05 5:36 PM
Hi Neethu,
Check this,
SELECT SINGLE vbelv posnr konda traty
FROM vbkd
INTO TABLE it_vbkd
WHERE vbeln EQ v_vbelv.
READ TABLE it_vbkd WITH KEY posnr EQ v_posnr.
Hope this information is help to you.
Regards,
José
‎2009 May 06 10:44 AM
this may work....can you check with this...
SELECT SINGLE akonda btraty
FROM vbkd as a,vbkd as b
INTO ( v_konda, wa_output-out_code )
WHERE a~vbeln EQ v_vbelv
AND b~posnr EQ v_posnr.
AND avbeln = bvbeln