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: 

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

Former Member
0 Kudos

Hi Experts,

This is copy of my prv. thread, with more clarity

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* (star - wild card)

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

thanq

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You will have to select all possible product hierarchies based on your select option (so_EXCLUDE_Materials_of_product_heirarchy) from table T179 into another range table. Then use this range table in your logic to exclude product hierarchies.

Pseudo code below:


ranges: r_exclude_product_hierarchy for t179-prodh.
move: 'I' to r_exclude_product-sign,
         'EQ' to r_exclude_product-option.
select prodh into r_exclude_product-low
from t179
where prodh in so_exclude_materials_of_product_heirarchy
and stufe = '9'  "<--Replace the appropriate level of product hierarchy here...

       append r_exclude_product.

endselect.
clear r_exclude_product.
.
.
.
If mara-prodh in r_exclude_product_hierarchy.
...
else.
....
endif.

3 REPLIES 3

Former Member
0 Kudos

You will have to select all possible product hierarchies based on your select option (so_EXCLUDE_Materials_of_product_heirarchy) from table T179 into another range table. Then use this range table in your logic to exclude product hierarchies.

Pseudo code below:


ranges: r_exclude_product_hierarchy for t179-prodh.
move: 'I' to r_exclude_product-sign,
         'EQ' to r_exclude_product-option.
select prodh into r_exclude_product-low
from t179
where prodh in so_exclude_materials_of_product_heirarchy
and stufe = '9'  "<--Replace the appropriate level of product hierarchy here...

       append r_exclude_product.

endselect.
clear r_exclude_product.
.
.
.
If mara-prodh in r_exclude_product_hierarchy.
...
else.
....
endif.

Former Member
0 Kudos

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

Former Member
0 Kudos

Check my answer in your other thread.

Rob