Application Development 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: 

validate my select stmt please

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

change the follwoing in where as

*j_3astcu NE SPACE*

AND j_3astcu = gt_soldto1-store_no )

rest in where condition you know better

Former Member
0 Kudos

I used

OR ( j_3astcu

NE

SPACE

but it is not working

0 Kudos

Why you have 'OR' in the where condition?

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

0 Kudos

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.

Former Member
0 Kudos

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.

0 Kudos

" 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 )