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

Select statement

Former Member
0 Likes
698

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.

3 REPLIES 3
Read only

Former Member
0 Likes
435

Hi, i guess you've got two threads with this question. Please close one, thanks!

Read only

0 Likes
435

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

Read only

Former Member
0 Likes
435

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