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

Select options in Objects

Former Member
0 Likes
1,151

Hi ,

I am trying to pass select-options values from my ABAP editor to Class metod.

its giving error like *The IN operator with "S_KUNNR" is followed neither by an internal table *.

I am not getting how to pass ranges values to method.

Get_data is my method. Importing s_kunnr type SELOPT.

 SELECT kunnr
         name1
         ort01
         adrnr FROM kna1
         INTO TABLE  it_kna1
    WHERE kunnr in  s_kunnr. 

can you let me know how to pass range values .

Regards,

sarath.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,001

youhave to define your import parameter as RANGE, then you may pass select options.

in your class have types: t_kunnr_range type range of <data element of kunnr >

in your paramters of method have s_kunnr_range type t_kunnr_range.

while calling method do not forget to this.. Object->method( s_kunnr_range = s_sel_kunnr )

where s_sel_kunnr is defined as slection-options for kunnr on screen.

WELCOME TO OBJECTS!

CHEERS

8 REPLIES 8
Read only

BH2408
Active Contributor
0 Likes
1,001

HI ,

what ever u r importing that value we need to give.

ex.

methods:

getmara IMPORTING matgr TYPE C

EXPORTING l_tab TYPE ANY TABLE.

in

Method: getmara.

select matnr (some fileds ) from mara

where matkl = matgr.

endmethod.

Regards,

Bharani

Read only

former_member195698
Active Contributor
0 Likes
1,001

Your IMPORTING PARAMETER is "Work Area" and not an "Internal Table" as the type refers to a Structure.

You need to define your Importing parameter using "Table Type". Then only you can use IN OPERATOR with your select Option

Read only

MarcinPciak
Active Contributor
0 Likes
1,001

Hi,

Please refer to see how to pass and type your select options.

Regards

Marcin

Read only

Former Member
0 Likes
1,002

youhave to define your import parameter as RANGE, then you may pass select options.

in your class have types: t_kunnr_range type range of <data element of kunnr >

in your paramters of method have s_kunnr_range type t_kunnr_range.

while calling method do not forget to this.. Object->method( s_kunnr_range = s_sel_kunnr )

where s_sel_kunnr is defined as slection-options for kunnr on screen.

WELCOME TO OBJECTS!

CHEERS

Read only

Former Member
0 Likes
1,001

Hi ,

I solved my problem like this. As I am using global class.

for GET_DATA method.

importing s_kunnr type PIQ_SELOPT_T.

In editor.


SELECT-OPTIONS: s1_kunnr FOR kna1-kunnr.
DATA s_kunnr TYPE piq_selopt_t.
DATA wa_kunnr TYPE selopt.

 wa_kunnr-sign = 'I'.
  wa_kunnr-option = 'BT'.
  wa_kunnr-low = s1_kunnr-low.
  wa_kunnr-high = s1_kunnr-high.
  APPEND wa_kunnr TO s_kunnr.

Regards,

sarath.

Read only

Former Member
0 Likes
1,001

thanks for the replay

Read only

0 Likes
1,001

you are wrong.

like thsi you can enter only first line of select-options.

Remember select options is an internal table.

if you try to give more values with = ., <, > your logic will fail .

Read only

Former Member
0 Likes
1,001

Hi Sarath,

While passing select options from your ABAP code to class method , pass like this

call method get_data exporting s_kunnr[] . Do remember to put square braces .

and in ur class method Import it via Type ANY

Thanks and Regards ,

Harsharandeep Singh