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

report

Former Member
0 Likes
399

hi Experts

i have to keep this in a loop.

i am fetching the fields records for MATNR ,STLNR ,WERKS from the MAST table with the STLAN = 1 and STLAL = 01.

now i ahve to check above the material list with the STKO table with STLNR ,DATUV=SY-datum,LOEKZ NE X and STLST = 1.

plse help me how to do the checking.

with regards

aaryaa

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
379

Hi,

Do as follows:

Select matnr stlnr werks

INTO CORRESPONDING FIELDS OF TABLE itab

FROM MAST

WHERE stlan = '1'

AND STLAL = '01'.

If you want to check whether itab data exist in STKO, and you want to delete the records of unavailable data from itab.

Loop at itab.

Select stlnr into g_f_stlnr

FROM STKO

WHERE stlnr = itab-stlnr

AND datuv = sy-datum

AND loekz <> 'X'

AND stlst = '1'.

If sy-subrc <> 0.

Delete itab.

endif.

Endloop.

2 REPLIES 2
Read only

Former Member
0 Likes
380

Hi,

Do as follows:

Select matnr stlnr werks

INTO CORRESPONDING FIELDS OF TABLE itab

FROM MAST

WHERE stlan = '1'

AND STLAL = '01'.

If you want to check whether itab data exist in STKO, and you want to delete the records of unavailable data from itab.

Loop at itab.

Select stlnr into g_f_stlnr

FROM STKO

WHERE stlnr = itab-stlnr

AND datuv = sy-datum

AND loekz <> 'X'

AND stlst = '1'.

If sy-subrc <> 0.

Delete itab.

endif.

Endloop.

Read only

Former Member
0 Likes
379

Hi,

select matnr werks stlnr from mast into table i_mast (using the where clause).

Now you can select data from STKO (Bom Header) using for all entries in i_mast.

check not i_mast[] is initial.

select (field list) from stko

into table i_stko

for all entries in i_mast

where stlty = 'M' (for material bom)

and stlnr = i_mast-stlnr.

*and any additional conditions.

Regards,

Shyam