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

Need logic for process the SELECT-OPTION table for diff. combinations

Former Member
0 Likes
795

Hi Experts,

Pls. give me some hint or idea to get my requitrement, its,

The selection screen contains a select-options field with name of so_EXCLUDE_Materials_of_product_heirarchy field.

I hv a list of 500 materials, in my_inatrenal_tabel.

Am pulling the product heirarchy values for these 500 matreials.

If user enters, some value in this field of so_EXCLUDE_Materials_of_product_heirarchy, I need to EXCLUDE that product heirachy having matreial from my_internal tbale.

My code is as follows,

MOVE sy-tabix to sy_tabix.

READ TABLE t_mara WITH KEY matnr = my_itab-matnr

BINARY SEARCH.

IF sy-subrc IS INITIAL.

IF NOT so_EXCLUDE_Materials_of_product_heirarchy[] IS INITIAL.

IF my_itab-prdha(2) IN so_EXCLUDE_Materials_of_product_heirarchy[].

DELETE my_itab INDEX sy_tabix.

ENDIF.

ENDIF.

ENDIF.

Isuue, is that, if user inputs this select option normally, its working, fine.

but, if he inputs like 1234* (STAR), then, all records r deleting from my-itab.

at that point the select-option table id populated like,

*sign - I*

*option- CP*

*low-value- 1234**

so, pls. let me know the piece of code, to meet my requiremwent.

thanq

Edited by: Srinivas on Jun 16, 2008 3:14 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
774

Srinivas - it looks as if your logic is mostly correct.

But when you use CP in a SELECT-OPTION, you will have to pad the values with the correct number of leading zeroes. You will have to do this manualy.

Rob

Took out the reference to the conversion exit FM. I don't think it will work.

Edited by: Rob Burbank on Jun 16, 2008 7:14 PM

6 REPLIES 6
Read only

former_member156446
Active Contributor
0 Likes
774

Hi looks like option need to be BT

*sign - I*

*option- CP*

*low-value- 1234**

Read only

0 Likes
774

sorry,

wanna high light the options etc. but, it took 2 stars,

again am writing the table contents of select options:

SIGN - I - include

OPTION - CP - meaninf CONTAIN PARTIal??

value - low - 1234*

selection criteria is 1234* (star)

thanq

Read only

0 Likes
774

Hi,

It is CONTAINS PATTERN and not CONTAINS PARTIAL.

Based on your select-options field...s_mat_op write the select query to fetch all the values from the transparent table.

like: select f1 into table i_mara where matnr in s_mat_op.

Now if you want to check for a single field f1 using IN operator like the select-options declaration do as follows:

data: r_f1 like range of mara-matnr.

ws_f1 type line of r_f1.

loop at i_mara.

ws_f1-sign = 'I'.

ws_f1-option = 'EQ'.

ws_f1-low = i_mara-f1.

append ws_f1 to r_f1.

endloop.

if matnr in r_f1.

do something....

else.

delete ......

endif.

Hope this pseudo code helps u understand.

Regards,

Subramanian

Read only

0 Likes
774

Hi,

You can use this code for the field that u want to check.

ranges : r_field for fieldname.

IF NOT fieldname IS INITIAL.

r_field-sign = 'I'.

IF fieldname CA '*'.

r_field-option = 'CP'.

ELSE.

r_field-option = 'EQ'.

ENDIF.

r_field-low = fieldname.

r_field-high = ' '.

APPEND r_field.

CLEAR r_field.

ENDIF.

now in select statements, check field in r_field. it will give u desired reult.

Award me points if it helps.......

Thanks,

Sheel

Read only

Former Member
0 Likes
774

Hi,

Check this code

REPORT Zlike_example .
PARAMETERS: p_name(40) TYPE c .

DATA lv_srch_str(60) TYPE c .
DATA lv_ename LIKE p0001-ename .

CONCATENATE '%' p_name '%' INTO lv_srch_str .

SELECT ename FROM PA0001
INTO lv_ename
WHERE ename LIKE lv_srch_str .

WRITE:/ lv_ename .

ENDSELECT .

Read only

Former Member
0 Likes
775

Srinivas - it looks as if your logic is mostly correct.

But when you use CP in a SELECT-OPTION, you will have to pad the values with the correct number of leading zeroes. You will have to do this manualy.

Rob

Took out the reference to the conversion exit FM. I don't think it will work.

Edited by: Rob Burbank on Jun 16, 2008 7:14 PM