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

RANGE PROBLEM

Former Member
0 Likes
1,594

HALLOW

i declare range like below and i get wrong data

what i miss?

eg. i put in table range low 012007 and high 122007

and when i do the select i get data for 2008

Regards

year is input for year.

RANGES: all_year FOR zzepop-period.

CONCATENATE '01' year INTO mon_beg."Create year range

CONCATENATE '12' year INTO mon_end.

all_year-sign = 'I'.

all_year-option = 'BT'.

all_year-low = mon_beg.

all_year-high = mon_end.

APPEND all_year.

SELECT *

FROM (proj_tab_name)

INTO CORRESPONDING FIELDS OF TABLE proj_tab "from year start project until sy-datum

WHERE proj = project

AND period IN all_year.

Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,574

Hi Ricardo,

One possible solution of ur problem is this.... if u want all records for year 2007...

>SELECT *

>FROM (proj_tab_name)

>INTO CORRESPONDING FIELDS OF TABLE proj_tab

>WHERE proj = project.

>

>LOOP AT proj_tab.

>IF proj_tab-proj+2(4) = '2007'.

>write : / proj_tab-proj.

>ENDIF.

>ENDLOOP.

it will search all the records for year 2007... it the date is stored in MMYYYY format eg 082007

Hope it will solve your problem..

Reward points if useful...

Thanks & Regards

ilesh 24x7

19 REPLIES 19
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,574

basically, your period/year values are backwards, these types of data should always be stored as YYYYPP in the database, hence your range should be in the same format. 200701

Regards,

Rich Heilman

Read only

0 Likes
1,574

hi rich

i change the format like u tell (200701- 200712) but i don't get any data in the select and i have data (project) in table with

period 012007 it supposed to work , i check all the types

and year is char4 and period char 6 (i do concatenate 01 - 12 for all year ,

i don't understand this,

maybe u can give me idea?

Regards

Read only

Former Member
0 Likes
1,574

Hi,

You can try in otherway by taking char(6 ) and use concatenate and offlength.

Regds

Sivaparvathi

Please reward points if helpful..

Read only

0 Likes
1,574

hi siva

i don't understand maybe u can explain it?

Regards

Read only

Former Member
0 Likes
1,574

hi frinds

maybe some one can give an idea?

its urgent

i reward

Regards

Read only

Former Member
0 Likes
1,574

Hi,

Could you please let us know what is the characterisitics of period in select statement.

May be it is not considering the range. You can do thing here :

Remove period from the select statement.

And add below code after select statement.

Delete itab where period not in all_year.

Thanks,

Sriram Ponna.

Read only

0 Likes
1,574

hi sriram

in the debugerr i have value like below

I BT 012008 122008

but in table for the project i ask i have in field period just 122007 (for this project ) all the varibale is type char period char6.

regards

Read only

0 Likes
1,574

hi sriram

i try with delete but its no working

DELETE proj_tab WHERE period NOT IN all_year.

i get subrc ne 0.

Regards

Read only

0 Likes
1,574

Hi,

Go to Se11 and input the table and give the condition what you are using in the program, see whether the table have the data or not, whether it is retrieving any data or not?

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
1,574

Hi Ricardo,

Check below field in DDIC and check how date is stored there...

proj_tab_name-period

nd then provide the mon_beg and mon_end in the same way it is stored in database....

all_year-low = mon_beg.

all_year-high = mon_end.

Hope it will solve your problem..

Reward points if useful..

Thanks & Regards

ilesh 24x7

Read only

0 Likes
1,574

yes ilesh

the have the same type char6,i dont understand way its dont work?

Regards

Read only

0 Likes
1,574

Before you investigate any further, you MUST make sure that the data in the database table is being stored as YYYYPP, if it is not, then you need to change it so that it does. Storing it in any other format is wrong. ONce you have your data correct, you need to setup your selection options the same way, 200701 200712

Regards,

Rich Heilman

Read only

0 Likes
1,574

HI RICH

the data is stored in same format this is the first thing i check,

Regards

Read only

former_member156446
Active Contributor
0 Likes
1,574

MOVE:'I' TO so_bukrs-sign,

'EQ' TO so_bukrs-option,

'US90' TO so_bukrs-low.

APPEND so_bukrs.

if ur trying to delete

move E into sign and say in range...

Edited by: jackandjay on Jan 2, 2008 10:02 AM

Read only

Former Member
0 Likes
1,574

Hi Ricardo,

m not sure but

it might be becoz the data is stored in the database as Char type...

> eg. i put in table range low 012007 and high 122007

> and when i do the select i get data for 2008

here suppose the value is 072008 then it comes between the values low 012007 and high 122007 and due to that u are getting the value of year 2008 also in your internal table...

Reward points if useful...

Thanks & Regards

ilesh 24x7

Read only

Former Member
0 Likes
1,575

Hi Ricardo,

One possible solution of ur problem is this.... if u want all records for year 2007...

>SELECT *

>FROM (proj_tab_name)

>INTO CORRESPONDING FIELDS OF TABLE proj_tab

>WHERE proj = project.

>

>LOOP AT proj_tab.

>IF proj_tab-proj+2(4) = '2007'.

>write : / proj_tab-proj.

>ENDIF.

>ENDLOOP.

it will search all the records for year 2007... it the date is stored in MMYYYY format eg 082007

Hope it will solve your problem..

Reward points if useful...

Thanks & Regards

ilesh 24x7

Read only

0 Likes
1,574

thanks ilesh

i try it and let u now

regards

Read only

0 Likes
1,574

thanks ilesh

u give me idea

Best regards

Read only

Former Member
0 Likes
1,574

Hi Ricardo,

Do below modification in my previous code.....

See bold letters...

By mistake i used diff field name....

SELECT *

FROM (proj_tab_name)

INTO CORRESPONDING FIELDS OF TABLE proj_tab

WHERE proj = project.

LOOP AT proj_tab.

IF proj_tab-period+2(4) = '2007'.

write : / proj_tab-proj, proj_tab-period.

ENDIF.

ENDLOOP.

Hope it will solve your problem..

Reward points if useful....

Thanks & Regards

ilesh 24x7