Skip to Content
0
Former Member
Sep 19, 2007 at 02:29 AM

how to write select statement ?

167 Views

Hi,

i have requirement like below :

In selection screen we have material number as selection options and plant as single entry.

Based on the input.

We have to extract the material number and plant based on MTART = AA or UT in MARA table and STLAN = 1 in MAST table.

how to write a select statment to pick values from selection option and extract those material and plant which fullfill above conditions.

Please let me know..

its urgent

please help..

i have written code like below..

types: begin of x_it_mat,

matnr type mkal-matnr,

werks type mkal-werks,

stlan type mast-stlan,

end of x_it_mat.

types: begin of x_it_mat1,

matnr type mkal-matnr,

werks type mkal-werks,

mtart type mara-mtart,

end of x_it_mat1.

data : it_mat type table of x_it_mat,

wa_mat like line of it_mat.

data : it_mat1 type table of x_it_mat1,

wa_mat1 like line of it_mat1.

TABLES: MKAL , MAST , MARA.

SELECTION-SCREEN BEGIN OF BLOCK matnr

WITH FRAME TITLE TEXT-001.

select-options :

so_matnr for mkal-matnr.

SELECTION-SCREEN END OF BLOCK matnr.

SELECTION-SCREEN BEGIN OF BLOCK plant

WITH FRAME TITLE TEXT-002.

parameter p_werks type mkal-werks.

SELECTION-SCREEN END OF BLOCK plant.

select matnr

werks

stlan

from mkal INTO table it_mat

where matnr in so_matnr

and werks = p_werks.

after this how to write another select statement to extract material by satisfiying above 2 conditions..