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: 

Range Problems

Former Member
0 Kudos

Hi all, Im having a problem using the range in my select, the problem is that the range contains 114 ranges... after the select statement the program cant retrieve all the data that satisfies my selection criteria using the range. Is there any possibilities to load/generate all values inside the given range? Is there a function module for that because it seems that the program is having a problem comparing the values found in the dbtable against the range since there are a lot of ranges to be check. Pls help. me. below is the program code for select:

SELECT gl_sirid "Record number of the line item record

rvers "Version

ryear "Fiscal Year

rtcur "Currency Key

poper "Posting period

rbukrs "Company Code

rprctr "Profit center

racct "Account number

hsl "Amount in transaction currency

hsl "Amount in company code currency

kostl "Cost Center

paobjnr "Profitability Segment Number (CO-PA)

pasubnr "Profitability segment changes (CO-PA)

drcrk "Debit/Credit

FROM glpca

INTO TABLE i_glpca

WHERE ( rvers EQ c_000v OR "Actual

rvers EQ c_001v OR "Budget

rvers EQ c_100v OR

rvers EQ c_200v OR

rvers EQ c_300v )

AND ryear EQ v_pyear "Fiscal year

AND poper EQ v_pperiod "Posting year

AND rbukrs IN r_ccode "Company code

AND rprctr IN r_prctr "Profit center

AND ( racct IN r_ebit1

OR racct IN r_ebit2

OR racct IN r_ebit3

OR racct IN r_ebit4

OR racct IN r_ebit5

OR racct IN r_ebit6

OR racct IN r_ebit7

OR racct IN r_ebit8

OR racct IN r_ebit9

OR racct IN r_pers

OR racct IN r_occu

OR racct IN r_depre

OR racct IN r_capxe

OR racct IN r_capxn

OR racct IN r_cnets

OR racct IN r_intcn

OR racct IN r_intcc )

AND kokrs EQ c_0030.

4 REPLIES 4

Former Member
0 Kudos

hi,

try with this

define one more range like r_accounts and populate all the ranges into r_accounts like

APPEND LINES OF r_ebit2 TO r_accounts

APPEND LINES OF r_ebit3 TO r_accounts

.

.....

select..........where racct in r_accounts

cheers,

sasi

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Try to make the all the same type of ranges in one range.

append lines of r_ebit2 to r_ebit1.

append lines of r_ebit3 to r_ebit1.

...

Then in select

select.....

WHERE ....other conditions

AND ( racct IN r_ebit1 ).

Since you mentioned or in that paranthesis,I hope this should work.

Just make a try.

Kindly reward points by clicking the star on the left of reply,if it helps.

former_member221770
Contributor
0 Kudos

Hi Jason,

Try and put all your ranges into one big range.

eg.


ranges: r_racct for glpca-racct.
....

loop at r_ebit1.
  clear r_racct.
  r_racct-sign   = r_ebit1-sign.
  r_racct-option = r_ebit1-option.
  r_racct-low    = r_ebit1-low.
  r_racct-high   = r_ebit1-high.
  append r_racct.
endloop.

* Do this for allyour ranges... 
....

* Then you can rewrite your query as follows:
SELECT gl_sirid "Record number of the line item record
rvers "Version
ryear "Fiscal Year
rtcur "Currency Key
poper "Posting period
rbukrs "Company Code
rprctr "Profit center
racct "Account number
hsl "Amount in transaction currency
hsl "Amount in company code currency
kostl "Cost Center
paobjnr "Profitability Segment Number (CO-PA)
pasubnr "Profitability segment changes (CO-PA)
drcrk "Debit/Credit
FROM glpca
INTO TABLE i_glpca
WHERE ( rvers EQ c_000v OR "Actual
rvers EQ c_001v OR "Budget
rvers EQ c_100v OR
rvers EQ c_200v OR
rvers EQ c_300v )
AND ryear EQ v_pyear "Fiscal year
AND poper EQ v_pperiod "Posting year
AND rbukrs IN r_ccode "Company code
AND rprctr IN r_prctr "Profit center
AND racct  IN r_racct
AND kokrs EQ c_0030.

Hope this helps.

Cheers,

Pat.

PS. Kindly assign Reward Points tot he posts you find helpful.

Former Member
0 Kudos

Why don't you do this before the select statement?


APPEND LINES OF: r_ebit3  TO r_ebit2,
                 r_ebit4  TO r_ebit2,
                 r_ebit5  TO r_ebit2,
                 r_ebit6  TO r_ebit2,
                 r_ebit7  TO r_ebit2,
                 r_ebit8  TO r_ebit2,
                 r_ebit9  TO r_ebit2,
                 r_pers   TO r_ebit2,
                 r_occu   TO r_ebit2,
                 r_depre  TO r_ebit2,
                 r_capxe  TO r_ebit2,
                 r_capxn  TO r_ebit2,
                 r_cnets  TO r_ebit2,
                 r_intcn  TO r_ebit2,
                 r_intcc  TO r_ebit2.
and then do your select as
 racct IN r_ebit2.

Consider changing the select statement, it is really big. You may have performance problems too.

Srinivas