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: 

Selection Table not working

Former Member
0 Kudos

Hi everybody,

ive created a table in my data-dictionary which i want to use in an sql-statement combined with "where sparte IN myselectiontable", but this doesnt work for me.

ive created this structure in the datadic for my selectiontable and a corresponding tabletype.


SIGN char(1)
OPTION char(2)
LOW z_sparte
HIGH z_sparte

low and high are the same type es the databasefield i want to use the selectiontable on.

later on the table based on this structure is filled by me with the following data, because i want to get only the lines of my database where "sparte" is equal to "J" or "S".


SIGN    OPTION   LOW    HIGH

I            EQ            J
I            EQ            S

but no matter what the content of my selectiontable is, its just being ignored, i alwys get the same result.

thanks for your help.

15 REPLIES 15

christine_evans
Active Contributor
0 Kudos

I think you need to put your values into the LOW column rather than the HIGH column.

0 Kudos

sorry this is a formatting problem, the values are in the LOW-field, the HIGH-field is empty

0 Kudos

Post your selection code.

edit. I have a feeling you defined your own SELECT-OPTIONS structure and you are using that instead of the standard SAP SELECT-OPTIONS structure.

0 Kudos

hi, youre talking about my sql-statement?


SELECT sparte  FROM zebit_hcr_btabn into CORRESPONDING FIELDS OF TABLE sparten
   WHERE termtdat BETWEEN from AND to AND prod = o_produkt AND
  action = 'B' OR action = 'Z' AND sparte IN o_sparten_sichtbar.

with o_sparten_sichtbar being my selection table with the structure above.

0 Kudos

Do what Thomas suggested and see what happens.

Or:

RANGES: ra_sparte FOR zebit_hcr_btabn-sparte.

ra_sparte will have the same fields as you defined in your own structure.

Edited by: Maen Anachronos on Oct 15, 2008 3:36 PM

0 Kudos

i defined it manually in the source of my class-attributes, it didn't change anything. in the debugger the table seems to be correctly filled.

edit: the ranges command is not allowed in the definition of my class.

im trying to use this in a BSP, i have serveral dynamicly generated checkboxes. i want to generate a selection-table out of them so i can do a selection on the database based on the checkbox-data.

Edited by: dsp on Oct 15, 2008 3:45 PM

Edited by: dsp on Oct 15, 2008 3:50 PM

0 Kudos

> the ranges command is not allowed in the definition of my class.

Correct, because it uses implicit header lines. Try my suggestion

> DATA: ... TYPE RANGE OF ...

ThomasZloch
Active Contributor
0 Kudos

why don't you define the selection range like this:

DATA: r_sparte TYPE RANGE OF z_sparte.

Thomas

Former Member
0 Kudos

Make sure you APPEND the tablw with correct values and put your values in LOW. If you are selecting a range of data to be selected then use LOW + HIGH.

-Aman

0 Kudos

the generation of the selectiontable, "sel_sparten_sichtbar" being the selectiontable in this case


some looping....
clear wa_o_sparten_sichtbar.
wa_o_sparten_sichtbar-sign = 'I'.
wa_o_sparten_sichtbar-option = 'EQ'.
wa_o_sparten_sichtbar-low = wa_i_sparten_sichtbar-sparte.
APPEND wa_o_sparten_sichtbar TO sel_sparten_sichtbar.
endloop.

thomas: tried it out, it didn't change anything.

0 Kudos

Can you have a look at this code.

REPORT  ztest3.
DATA: BEGIN OF sel OCCURS 10,
        sign(1)   TYPE c,
        option(2) TYPE c,
        low       TYPE s_carr_id,
        high      TYPE s_carr_id,
      END OF sel.
DATA: lt TYPE TABLE OF spfli.


sel-sign = 'I'. sel-option = 'EQ'. sel-low = 'LH'. APPEND sel.
sel-sign = 'I'. sel-option = 'EQ'. sel-low = 'AA'. APPEND sel.

BREAK-POINT.
SELECT * FROM spfli INTO TABLE lt WHERE carrid IN sel.
BREAK-POINT.

-Aman

0 Kudos

i everybody,

i solved the problem, the reason for this was the sql-statement. the "<field> IN <selectiontable>" has to be right after the "WHERE" in the select, or it wont work like it should. this now works fine for me:


SELECT abrstatus sparte prod COUNT(*) AS summe FROM zebit_hcr_btabn INTO CORRESPONDING FIELDS
  OF TABLE int_overview_sparte  WHERE sparte in o_sparten_sichtbar  and termtdat BETWEEN from AND to AND prod = o_produkt AND action = 'B' OR action = 'Z' GROUP BY abrstatus sparte prod ORDER BY abrstatus ASCENDING.

thanks everybody for your help.

0 Kudos

Well done!

But i'm still wondering as i haven't seen that happen before that you need to put it right after the WHERE. Is it possible that the result was affected by:

action = 'B' OR action = 'Z' AND sparte IN o_sparten_sichtbar.

And that it would have worked if you used:

( action = 'B' OR action = 'Z' ) AND sparte IN o_sparten_sichtbar.

Just being curious.

0 Kudos

I betcha that was the actual problem...

0 Kudos

you we're right, that was the problem.