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

plz chk the code wats wrong in it

Former Member
0 Likes
1,057

DATA : lv_gbstk TYPE c VALUE 'A'.

SELECT vbeln "order number

FROM vbuk

INTO TABLE ct_ordnsnt

FOR ALL ENTRIES IN lt_ztsd2marc

WHERE vbeln <> lt_ztsd2marc-ordnr

AND gbstk = lv_gbstk.

its taking all values of vbeln .

DATA : lv_gbstk TYPE c VALUE 'A'.

SELECT vbeln "order number

FROM vbuk

INTO TABLE ct_ordnsnt

FOR ALL ENTRIES IN lt_ztsd2marc

WHERE vbeln <> lt_ztsd2marc-ordnr

AND gbstk = lv_gbstk.

its taking all values of vbeln .

8 REPLIES 8
Read only

Former Member
0 Likes
1,004

That means lt_ztsd2marc is empty and the second issue could be <> condition.

First check if the table is empty, the you should not use FOR ALL ENTRIES.

IF NOT lt_ztsd2marc[] IS INITIAL.

SELECT vbeln "order number
FROM vbuk
INTO TABLE ct_ordnsnt
FOR ALL ENTRIES IN lt_ztsd2marc
WHERE vbeln <> lt_ztsd2marc-ordnr
AND gbstk = lv_gbstk.

ENDIF.

Regards,

Ravi

Note - Please mark all the helpful answers

Read only

0 Likes
1,004

hi

i mean gbstk = lv_gbstk. is not workin in the code bcz my lt_ztsd2marc is havin data.but its not pickin those gbstk whic r equal to A

Read only

Former Member
0 Likes
1,004

hi,

check if lt_ztsd2marc is empty, that is the prerequest for using for all entries.

santhosh

Read only

Former Member
0 Likes
1,004

hi,

as you are using

for all entries in itab..

check whether the previous itab is initial.

if it is initial it will select all records .

eg:

if not previous_itab[] is initial.

select query of itab....

for all entries in previous_itab

endif.

hope this helps.

Regards

Abdullah

Read only

Former Member
0 Likes
1,004

hi Neha,

if not lt_ztsd2marc[] is initial.
 SELECT vbeln "order number
FROM vbuk
INTO TABLE ct_ordnsnt
FOR ALL ENTRIES IN lt_ztsd2marc
WHERE vbeln <> lt_ztsd2marc-ordnr
AND gbstk = lv_gbstk.
endif.

Regards,

Santosh

Read only

Former Member
0 Likes
1,004

Hi Neha,

The code seems to be correct but before writing this just check weather lt_ztsd2marc has some value or not.

Thanks

Vikranth Khimavath

Read only

0 Likes
1,004

try

SELECT vbeln "order number

FROM vbuk

INTO CORRESPONDING FIELDS OF TABLE ct_ordnsnt

FOR ALL ENTRIES IN lt_ztsd2marc

WHERE vbeln <> lt_ztsd2marc-ordnr

AND gbstk = lv_gbstk.

perhaps handy next time to include the data declarations or the errors you get with this query.

kind regards

arthur

Message was edited by:

A. de Smidt

Read only

Former Member
0 Likes
1,004

3 major drawbacks of the "for all entries" clause :

1. duplicate rows are automatically removed

2. if the itab used in the clause is empty , all the rows in the source table will be selected .

3. performance degradation when using the clause on big tables.

May be the second point is ur problem ,

but u r saying there r entries in the table , so try like this

SELECT vbeln "order number
FROM vbuk
INTO TABLE ct_ordnsnt
WHERE  gbstk = lv_gbstk.

then filter the entries using lt_ztsd2marc- table