Application Development 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: 

Non ALV

Former Member
0 Kudos
75

hi all

am using the below statement using an ALV am getting the desired output but am using the below statements for a non-ALV report the first select statememnt that i mentioned below is executing and retreving the data but the second select statement is not getting executed in a non ALV report.please help.

FORM get_data_from_vbak.

<b><u>First Select statement</u></b>

SELECT vbeln netwr ernam audat bstnk auart

FROM VBAK into TABLE it_vbak

where kunnr IN s_kunnr and

vkorg eq p_vkorg and

vtweg EQ p_vtweg AND

spart EQ p_spart AND

AUART NE 'ZLP'.

if sy-subrc eq 0.

if s_matnr = it_vbap-matnr.

<b><u>Second Select statement</u></b>

SELECT matnr posnr werks FROM vbap

into table it_vbap

FOR ALL entries in it_vbak

where vbeln = it_vbak-vbeln

and matnr = it_vbap-matnr.

endif.

endif.

2 REPLIES 2

Former Member
0 Kudos
44

Hi, seems you should use

and matnr IN s_matnr

or even better if you use INNER JOIN, e.g.

Select … into corresponding fields of table it_vbap

from ( ( ( VBPA as C

inner join VBAK as A on CVBELN eq AVBELN )

inner join VBAP as B on BVBELN eq AVBELN )

inner join kna1 as K on kkunnr eq ckunnr )

where …

Hopefully it will help,

Alexander

Former Member
0 Kudos
44

hi

As per ur requirement these two statement are related. If you get some data in first select statement (it_vbak) then only u have to fetch data through second select statement if i am not wrong. First you are writing condition IF SY-SUBRC eq 0. That is ok. In nested if again you are writing one IF condition like "if s_matnr = it_vbap-matnr". Before fetching data from second select statement (it_vbap) u are checking this condition. So always it should fail. So it should not go at all in second select statement. so remove that condition and write it after second select statement.

Reward if it dose

Thanks

Siva Kumar