‎2008 Jan 23 5:21 AM
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
‎2008 Jan 23 5:28 AM
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.
‎2008 Jan 23 5:28 AM
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.
‎2008 Jan 23 5:28 AM
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