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

validate my select stmt please

Former Member
0 Likes
823

In my below select stmt,

I don't want to select when j_3astcu is SPACE

I mean when gt_soldto1-store_no is SPACE i don't want that value to be selected ?

how can I apply this logic below ?

IF NOT gt_soldto1[] IS INITIAL.

SELECT * " kunnr name2 j_3astcu

FROM kna1

INTO corresponding fields of TABLE gt_kna1

FOR ALL ENTRIES IN gt_soldto1

WHERE ( name2 LIKE 'Store#%'

OR name2 LIKE 'Store%' )

OR ( j_3astcu <> SPACE

AND j_3astcu = gt_soldto1-store_no )

  • AND LAND1 = 'US'.

OR LAND1 = 'US'.

ENDIF. " IF NOT gt_soldto[] IS INITIAL.

HELP ME PLEASE.

THANKS IN ADV.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
776

Will the below stmt helps?

SELECT * " kunnr name2 j_3astcu

FROM kna1

INTO corresponding fields of TABLE gt_kna1

FOR ALL ENTRIES IN gt_soldto1

WHERE ( name2 LIKE 'Store#%'

OR name2 LIKE 'Store%' )

OR ( j_3astcu NE SPACE

AND j_3astcu = gt_soldto1-store_no )

OR LAND1 = 'US'.

(   j_3astcu  NE SPACE
AND  j_3astcu = gt_soldto1-store_no )

Instead of deleting ?

Sorry .

THANKS IN ADV.

Will the below stmt helps?

SELECT * " kunnr name2 j_3astcu

FROM kna1

INTO corresponding fields of TABLE gt_kna1

FOR ALL ENTRIES IN gt_soldto1

WHERE ( name2 LIKE 'Store#%'

OR name2 LIKE 'Store%' )

OR ( j_3astcu NE SPACE

AND j_3astcu = gt_soldto1-store_no )

OR LAND1 = 'US'.

(   j_3astcu  NE SPACE
AND  j_3astcu = gt_soldto1-store_no )

Instead of deleting ?

Sorry .

THANKS IN ADV.

6 REPLIES 6
Read only

Former Member
0 Likes
776

change the follwoing in where as

*j_3astcu NE SPACE*

AND j_3astcu = gt_soldto1-store_no )

rest in where condition you know better

Read only

Former Member
0 Likes
776

I used

OR ( j_3astcu

NE

SPACE

but it is not working

Read only

0 Likes
776

Why you have 'OR' in the where condition?

paste your statement again, and tell what you want to do with that

Read only

0 Likes
776

remove that space check from where condition. after the select delete if you want

SELECT * " kunnr name2 j_3astcu
FROM kna1
INTO corresponding fields of TABLE gt_kna1
FOR ALL ENTRIES IN gt_soldto1
WHERE ( name2 LIKE 'Store#%'
OR name2 LIKE 'Store%' )
OR  j_3astcu = gt_soldto1-store_no 
OR LAND1 = 'US'.
if sy-subrc eq 0,
 delete gt_kna1 where j_3astcu = ''.
endif.

Read only

Former Member
0 Likes
777

Will the below stmt helps?

SELECT * " kunnr name2 j_3astcu

FROM kna1

INTO corresponding fields of TABLE gt_kna1

FOR ALL ENTRIES IN gt_soldto1

WHERE ( name2 LIKE 'Store#%'

OR name2 LIKE 'Store%' )

OR ( j_3astcu NE SPACE

AND j_3astcu = gt_soldto1-store_no )

OR LAND1 = 'US'.

(   j_3astcu  NE SPACE
AND  j_3astcu = gt_soldto1-store_no )

Instead of deleting ?

Sorry .

THANKS IN ADV.

Read only

0 Likes
776

" OR condition will help you..? i am doubtful. if it true or false , it will select the record
OR ( j_3astcu NE SPACE
AND j_3astcu = gt_soldto1-store_no )