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: 

Select statement in ABAP

ashwin_mundkur
Advisor
Advisor
0 Kudos

Hi,

I have a table with couple of GUID fields. Primary key is the main GUID. I have another field by name temp_guid which can have the normal guid values or 00000000000000000000000000000000. I want to write a select statement as follows:

My table name : X

Field required : temp_guid

Select temp_guid FROM X where del_ind = gc_no AND temp_guid is NOT (??)

I dont want to select those rows where temp_guid has the value 00000000000000000000000000000000.

I tried with IS NOT NULL. It doesnt seem to be working. Any help would be appreciated.

thanks,

Ashwin

1 ACCEPTED SOLUTION

stamik
Explorer
0 Kudos

Hi,

well, probably the most correct thing to do, is to declare a constant of the same type as temp_guid, with the value '00000000000000000000000000000000' and use it in the select statement with the NE condition.

..otherwise the condition would depend on the type of temp_guid..

regards,

Stano

5 REPLIES 5

stamik
Explorer
0 Kudos

Hi,

well, probably the most correct thing to do, is to declare a constant of the same type as temp_guid, with the value '00000000000000000000000000000000' and use it in the select statement with the NE condition.

..otherwise the condition would depend on the type of temp_guid..

regards,

Stano

0 Kudos

Hi Stano,

I was aware of this option. I was thinking whether we have a standard syntax to get the values. I will go ahead with the comparison for values.

thanks,

Ashwin

andreas_mann3
Active Contributor
0 Kudos

try sth like this:

data h_guid type guid.

clear h_guid.

...

select ....

and temp_guid <> h_guid...

greetings

Former Member
0 Kudos

Give this a try:

REPORT ztest LINE-SIZE 80 MESSAGE-ID 00.

RANGES: r_gui FOR x-temp_guid.

CLEAR   r_gui.
MOVE '00000000000000000000000000000000' TO r_gui-low.
MOVE 'EQ'     TO r_gui-option.
MOVE 'E'      TO r_gui-sign.        "<=== Note
APPEND  r_gui.

SELECT temp_guid
  FROM x
  WHERE del_ind = gc_no
    AND temp_guid IN r_gui.

Rob

Former Member
0 Kudos

Hi,

Declare a range.

range r_xx for x_temp_guid.

*population.

r_xx-sign = 'E'. "Exclude

r_xx-option = 'EQ'.

r_xx-low = '00000000000000000000000000000000'.

append r_xx.

*select statement

Select temp_guid FROM X where del_ind = gc_no AND temp_guid in r_xx.

You will get it.

regards,

Subbu