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

Inserting Field in Table

Former Member
0 Likes
974

Hi..

I have added a new field FIELD_1 (domain CHAR10) to a already existing Z table, recreated the "Table Maintenance Generator" and transported the table to Test server. Test data exists on test server with some records having FIELD_1 populated and others having FIELD_1 blank.

The following query when executed on test server fetches no records though many records satisfying the WHERE condition exists.

SELECT *

FROM ZDODATA

INTO IT_ZDODATA

WHERE FIELD_1 EQ SPACE.

Also, it should be noted that the below query fetches proper records as expected.

SELECT *

FROM ZDODATA

INTO IT_ZDODATA

WHERE FIELD_1 NE SPACE.

Why does the first query fail to fetch records?

Regards,

Anoop

1 ACCEPTED SOLUTION
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
921

Hi,

Here f3 is the field added recently.This is giving the results as expected.

data itab type standard table of zzzz_test.

data wa type zzzz_test.

select * from zzzz_test into table itab where f3 is null.

8 REPLIES 8
Read only

Former Member
0 Likes
921

1) for the first query since you are selecting a field whose value is space it does not fetch anything

2) for the second query you are selecting which has some value so it fetch the data

Read only

0 Likes
921

try "regeneration of the table maintenance" again checking all the options that come for deletion.

Ideally there should be no issues in the queries as queries are correct.

Read only

emjay
Active Participant
0 Likes
921

Try to replace the first query like

SELECT *

FROM ZDODATA

INTO IT_ZDODATA

WHERE FIELD_1 IS INITIAL.

Hope this helps.

EmJay

-


Assign Points if useful

Read only

Former Member
0 Likes
921

The Statement

SELECT *

FROM ZDODATA

INTO IT_ZDODATA

WHERE FIELD_1 IS INITIAL

gives syntax error: The operator IS can only be used in "f IS NULL" or "f IS NOT NULL".

However, WHERE FIELD_1 IS NULL serves my purpose.

Thanks & Regards,

Anoop

Read only

Former Member
0 Likes
921

u can put like this

The Statement

SELECT *

FROM ZDODATA

INTO IT_ZDODATA

<b>WHERE FIELD_1 eq space.

or

WHERE FIELD_1 ne space.</b>

Regards

Prabhu

Read only

Former Member
0 Likes
921

If the first query is not fetching the records, then it means the records which you think are null, doesn't contain SPACE value in them. Please, check it out by urself wat exactly the value of tht particular field instaed of SPACE. You can definately use INITIAL. try it out.

If solved, then please close the thread.

Thanks

Ashwani

Read only

Former Member
0 Likes
921

Check whether the <b>fieldl_1 is NULL.</b>

Hope this quey got answered in the earlier thread.

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
922

Hi,

Here f3 is the field added recently.This is giving the results as expected.

data itab type standard table of zzzz_test.

data wa type zzzz_test.

select * from zzzz_test into table itab where f3 is null.