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

select query

Former Member
0 Likes
570

Hi,

i want to extract single record vbeln from from bsid.

based on that vbeln i need to extract single record swenr smenr from vbak.

based on swenr smenr i need to extract single record smenr swenr snunr xemtxt from vimi01.

i need code for this.

can any body help me in this regard.

5 REPLIES 5
Read only

Former Member
0 Likes
533

HI,

try this

<b>SELECT SINGLE VIMI01SMENR VIMI01SWENR VIMI01SNUNR VIMI01XEMTXT INTO TABLE ITAB FROM VIMI01 INNER JOIN VBAK ON VIMI01SWENR = VBAKSMENR AND VIMI01SWENR = VBAKSWENR INNER JOIN BSID ON VBAKVBELN = BSIDVBELN WHERE.....UR CONDITION.</b>

Regards

SAB

Read only

Former Member
0 Likes
533

Hi,

Try this..


* Get vbeln
SELECT VBELN UP TO 1 ROWS
             V_VBELN
             FROM BSID 
             WHERE ....

* Get vbak
SELECT SINGLE * FROM VBAK INTO S_VBAK
                          WHERE VBELN = V_VBELN.

* Get VIMI01
SELECT SINGLE * FROM VIMI01 WHERE SWENR = S_VBAK-SWENR
                                                               SMENR = S_VBAK-SMENR.

Thanks,

Naren

Read only

0 Likes
533

hi naren,

thanks for ur response,

can u give the work area declarations for this select statements, i want to know how to declare for single records.

thanks in advance

Read only

Former Member
0 Likes
533

Hi,

With the declarations.


DATA: V_VBELN TYPE VBELN.

* Get vbeln
SELECT VBELN UP TO 1 ROWS
             V_VBELN
             FROM BSID 
             WHERE ....
 
* Get vbak
DATA: V_swenr   TYPE VBAK-SWENR,
           V_smenr  TYPE VBAK-SMENR.

SELECT SINGLE SWENR SMENR FROM VBAK INTO (V_SWENR,V_SMENR)
                          WHERE VBELN = V_VBELN.
 
* Get VIMI01
DATA: S_VIMI01 TYPE VIMI01.
SELECT SINGLE * FROM VIMI01 
                          INTO CORRESPONDING FIELDS OF S_VIMI01
                          WHERE SWENR = S_VBAK-SWENR
                           SMENR = S_VBAK-SMENR.

Thanks,

Naren

Read only

Former Member
0 Likes
533

want to extract single record vbeln from from bsid.

based on that vbeln i need to extract single record swenr smenr from vbak.

based on swenr smenr i need to extract single record smenr swenr snunr xemtxt from vimi01.

tr this one,

without internal table,

select single vbeln from bdid into bdid where.........

select single swernr smenr from vbak into vbak where vbeln = bdid-vbeln.

select single smenr swenr snunr xemtxt from vimi01 into vim01 where swernr = vbak-swernr and smenr = vbak-smenr

with internal table..

select single vbeln from bdid into table it_bdid where.........

select single swernr smenr from vbak into table it_vbak for all entries in it_bdif where vbeln = it_bdid-vbeln.

select single smenr swenr snunr xemtxt from vimi01 into table it_vim01 for all entries in it_vbak where swernr = it_vbak-swernr and smenr = it_vbak-smenr

if it it is still not working than my email id is sarvadi.imran06@gmail.com

reward points if helpful

Regards,

Imran Sarvadi