Skip to Content
avatar image
Former Member

validate my select stmt please

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 20, 2008 at 02:47 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • " 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 )
  • avatar image
    Former Member
    Oct 17, 2008 at 01:47 AM

    change the follwoing in where as

    *j_3astcu NE SPACE*

    AND j_3astcu = gt_soldto1-store_no )

    rest in where condition you know better

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 17, 2008 at 02:11 AM

    I used

    OR ( j_3astcu

    NE

    SPACE

    but it is not working

    Add comment
    10|10000 characters needed characters exceeded

    • 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.