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: 

Select Statement

Former Member
0 Kudos

Hi friends,

i have a small problem ... pls any one give the solution...

PONumber Movement

-


-


po100 351

po100 101

po110 351

po120 351

po120 101

po130 351

po140 351

is a table (say ZTAB01)

now i want to retrieve the PONumbers having only 351 movements ( ie., po110, po130 and po140 ) ti an itab and ponumbers of both movements 351 & 101 (ie po100,po120)

How to write the select on this scenario.

advance tanks,

sekhar.

5 REPLIES 5

naimesh_patel
Active Contributor
0 Kudos

For only 351 movement

SELECT PO
INTO TABLE IT_PO_351
FROM ZTAB
WHERE MOVEMENT = '351'.

For both 351 and 101.

SELECT PO
INTO TABLE IT_PO_BOTH
FROM ZTAB
WHERE MOVEMENT IN ('101' , '351').

Regards,

Naimesh Patel

Former Member
0 Kudos

loop at itab into wa .

if ( movement = 351 or 101 ) and ( po = 100 or 110 ).

endif.

endloop.

Message was edited by:

Karthikeyan Pandurangan

Former Member
0 Kudos

Hi

Ur select query shud be

Select <PO number>

from ZTAB01

into table itab

where <movement> = '351'.

Select <PO number>

from ZTAB01

into table itab

where <movement> in (351,101).

Thanks

Vasudha

Message was edited by:

Vasudha L

Message was edited by:

Vasudha L

Former Member
0 Kudos

select ponumber from ZTAB01

into corresponding fields of table itab1

where movement eq '351'.

select ponumber from ZTAB01

into corresponding fields of table itab1

where movement in (351, 101) .

Former Member
0 Kudos

Hi Sekhar,

Try this.

types : begin of struct,

po_num type ztab01-ponumber,

end of struct.

data : itab_num1 type standard table of struct with header line,

itab_num2 type standard table of struct with header line,

itab_temp type standard table of struct with header line.

********for the first case.

select ponumber from ztab01

into table itab_num1

where movement = 351.

*************for the second case.

select ponumber from ztab01

into table itab_temp "temporary internal table.

where movement = 101.

now to get ponumbers for the second case do this.

loop at itab_num1.

read table itab_temp with key po_num = itab_num1-po_num.

if sy-subrc = 0.

move itab_temp to itab_num2.

append itab_num2.

clear itab_num2.

endif.

clear itab_temp.

clear itab_num1.

endloop.

I hope this will solve your problem.

Reward points if it helps.