‎2007 Jan 30 3:36 PM
Hi all ,
I have a requirement . I need to get data from mara table with spart = parameter.
i need to get data from ztable where zwevtkby +0(18) = matnr.
How can i write that code .
i have written like this . but with loop and endloop its taking lot of time .Is there any other way so that i can use for all entries.
This code is working fine . But i have huge data in zwplcsctbud . is there any other way so that i can reduce time?
SELECT * FROM mara INTO TABLE t_mara WHERE spart = p_spart.
IF p_spart IS NOT INITIAL.
SELECT * FROM zwplcsctbud INTO TABLE t_zwplcsctbud_i
WHERE zwpldt LT sy-datum
OR ( zwpldt EQ sy-datum
AND zwpltm LE sy-uzeit ).
SELECT * FROM mara INTO TABLE t_mara FOR ALL ENTRIES IN t_zwplcsctbud_i WHERE
matnr = t_zwplcsctbud_i-zwevtbky+0(18) and
spart = p_spart.
LOOP AT t_zwplcsctbud_i .
READ TABLE t_mara WITH KEY MATNR = t_zwplcsctbud_i-zwevtbky+0(18).
IF sy-subrc <> 0.
DELETE t_zwplcsctbud_i .
CLEAR t_zwplcsctbud_i.
ENDIF.
ENDLOOP.
ELSE.
Extracting data from ZWPLCSCTBUD(PLC Scheduled Table Update)
SELECT * FROM zwplcsctbud INTO TABLE t_zwplcsctbud_i
WHERE zwpldt LT sy-datum
OR ( zwpldt EQ sy-datum
AND zwpltm LE sy-uzeit ).
ENDIF.
‎2007 Jan 30 3:39 PM
Hi, i guess you've got two threads with this question. Please close one, thanks!
‎2007 Jan 30 4:09 PM
Deepak ,
But mara-matnr data type and zwplcstctbud-i date type not same . so i can't use . for all entries also.
Message was edited by:
priya katragadda
‎2007 Jan 30 6:11 PM
Hi,
You could probably try a join.
select * from zwplcsctbud as A into corresponding fields of table t_zwplcsctbud_i inner join mara as B
where Azwevtbky+0(18) = Bmatnr
and B~spart = p_spart
and A~zwpldt LT sy-datum
OR ( A~zwpldt EQ sy-datum
AND A~zwpltm LE sy-uzeit ).
Regards
Subramanian