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

querying on a field having zero value

vivekkrishnan
Active Participant
0 Likes
596

Dear Friends,

We are using the following query ...

select single SECTION_ID from <Table>

into B

where DEPT_ID = a.

Here dept_id is a non key field. This query is returning sy-subrc as 4 when A = '0000000' . But for other, query is successful.

We have used this table as check table in so many tables and not able to change the primary key.

Plz sugest us how we should change the query.

Regards,

Vivek K

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
577

Hi,

Try this.

IF DEPT_ID = '00000000'.

select single SECTION_ID from <Table>

into B

where DEPT_ID = '00000000' .

ELSE.

select single SECTION_ID from <Table>

into B

where DEPT_ID = a .

ENDIF.

Regards,

Suruchi

Message was edited by:

Suruchi Mahajan

Dear Friends,

We are using the following query ...

select single SECTION_ID from <Table>

into B

where DEPT_ID = a.

Here dept_id is a non key field. This query is returning sy-subrc as 4 when A = '0000000' . But for other, query is successful.

We have used this table as check table in so many tables and not able to change the primary key.

Plz sugest us how we should change the query.

Regards,

Vivek K

3 REPLIES 3
Read only

Former Member
0 Likes
578

Hi,

Try this.

IF DEPT_ID = '00000000'.

select single SECTION_ID from <Table>

into B

where DEPT_ID = '00000000' .

ELSE.

select single SECTION_ID from <Table>

into B

where DEPT_ID = a .

ENDIF.

Regards,

Suruchi

Message was edited by:

Suruchi Mahajan

Read only

vivekkrishnan
Active Participant
0 Likes
577

solved the problem by checking the "NOT NULL" Indicator ...

Thanks,

Vivek

Read only

0 Likes
577

Hi,

Tried hardcoding also it did not work ... Thanks for the reply ...

Regards,

Vivek