Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem with select stmt

Former Member
0 Likes
772

Hi Everyone,

i have to display branch address in a window in a script. everything's fine with the script, the prob. is with the select stmt.

this is a delivery challan... so initially the code was like this

SELECT SINGLE * FROM TVBUR

WHERE VKBUR = LIKP-VKBUR.

SELECT SINGLE * FROM ADRC

INTO B_ADRC

WHERE ADDRNUMBER = TVBUR-ADRNR.

now the problem is that there is no data in the field LIKP-VKBUR, so the alternative i thought is to get the data from VBRP table, and the common field b/w them both is VSTEL(shipping point).....

so can u pls help in writing the select stmt..

Thanks in advance,

CAPC

7 REPLIES 7
Read only

Former Member
0 Likes
738

use inner join concept -

select afield1 into d_var from vkbur as A inner join vbrp as B on AVSTEL = B~VSTEL

where afield2 = 'abc' and bfield3 = 'xyz'. "use Where condition if required

or

select single vkbur into d_vkbur

from vbap where vbeln in (

select vgbel from lips where

vbeln = likp~vbeln ).

select single * from tvbur where vkbur = lv_vkbur.

Read only

0 Likes
738

Thanks for the reply....

but after that how do i retrieve the information from adrc??

coz the condition is based on tkbur(table)...

thanks,

capc

Read only

jrgkraus
Active Contributor
0 Likes
738

Hello,

the VKBUR is normally found in the predecessor document, which is normally a sales order. I assume that the delivery document has only one predecessor. In this case, you could write:


* Don't forget to declare the variable in the
* declaration part of your code
data lv_vkbur type vkbur.
(...)
select single vkbur into lv_vkbur
          from vbap where vbeln in ( 
             select vgbel from lips where 
                       vbeln = likp~vbeln ).

select single * from tvbur where vkbur = lv_vkbur.

I hope this will solve your problem.

Regards Joerg

Read only

Former Member
0 Likes
738

can i use this stmt

SELECT SINGLE * FROM TVBUR

WHERE VKBUR = LIPS-VKBUR.

instead of

SELECT SINGLE * FROM TVBUR

WHERE VKBUR = LIKP-VKBUR.

i mean lips in place of likp, would it work...

thanx in advance,

CAPC

Read only

Clemenss
Active Contributor
0 Likes
738

Hi,

usually the delivery originates from an order. A delivery item comes from a specific order. If you use anything from standard, then check VBDKL-VBELN or go through document flow VBFA. A direct link from delivery item to order is VBAK-VBELN = LIPS-VGBEL.

In VBAK you will find the VKBUR and VKORG where you can fetch the address of.

Regards,

Clemens

Read only

Former Member
0 Likes
738

can u pls give me the diff. b/w header and item

Read only

Former Member
0 Likes
738

thanks this is finished