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

Problem with OR

Former Member
0 Likes
767

Hi experts,

I want to select data when I inform only DATA_CREACIO:

SELECT ZISH_POS_INTER~FALNR

INTO table i_inter

FROM ZISH_POS_INTER

where ( ( DATA_CREACIO IN rg_erdat )

OR ( DATA_RESPOSTA IN rg_updat ) ).

But the trace, inform me :

10 ZISH_POS_X REOPEN 0 SELECT WHERE "MANDT" = '100'

4.944 ZISH_POS_X FETCH 2.708 0

1.015 ZISH_POS_X FETCH 1.747 1403

what happens? the OR is incorrect?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
739

Hi Markus,

If OR is incorrect it will not fetch any data, in this case SY-SUBRC will be zero.

Regards

Abhii

7 REPLIES 7
Read only

Former Member
0 Likes
740

Hi Markus,

If OR is incorrect it will not fetch any data, in this case SY-SUBRC will be zero.

Regards

Abhii

Read only

0 Likes
739

But when I debugg, the rg_erdat is EQ 20091112.

Why the trace is not inform about this date?

Read only

0 Likes
739

what about rg_updat.

if its blank it will take all the records from Z* table.. as the IN statement satisfies the condition..

Nag

Read only

0 Likes
739

Thanks.

And what I can do if I want only ERDAT or UPDAT informed??

Read only

0 Likes
739

You can try some thing like this

DATA: BEGIN OF ITAB OCCURS 0,

LINE(72) TYPE C,

END OF ITAB.

IF NOT rg_erdat[] IS INITIAL.

MOVE '(DATA_CREACIO IN rg_erdat)' TO ITAB.

APPEND ITAB.

CLEAR ITAB.

MOVE 'OR' TO ITAB.

APPEND ITAB.

CLEAR ITAB.

ENDIF.

IF NOT RG_UPDAT[] IS INITIAL.

MOVE '(DATA_RESPOSTA IN rg_updat) ' TO ITAB.

APPEND ITAB.

CLEAR ITAB.

ENDIF.

  • AND SELECT WOULD BE LIKE

SELECT ZISH_POS_INTER~FALNR

INTO table i_inter

FROM ZISH_POS_INTER

where (ITAB).

Hope this helps... Let me know if u need more info..

Nag

Edited by: Naga Mohan Kummara on Dec 11, 2009 11:03 AM

Read only

Former Member
0 Likes
739

It can be either way around. Try reconsidering the Group-By replication waht you are using in your code.

Read only

Clemenss
Active Contributor
0 Likes
739
SELECT ZISH_POS_INTER~FALNR
INTO table i_inter
FROM ZISH_POS_INTER
where ( ( DATA_CREACIO IN rg_erdat )
OR ( DATA_RESPOSTA IN rg_updat ) ).

This is code.

If one of the ranges is empty, it will fetch all records. A range acts as a filter - if nothing is filtered, everything gos through.

Regards,

Clemens