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 distinct in view

Former Member
0 Likes
5,580

Hi Experts,

I am creating a database view. I am using this view in my search help(created in se11). Now this view is returning recurring values. I want only the distinct values in my search help. Can anyone please suggest how do I go about it?

Regards,

Abdullah

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
3,715

Is it possible that your view isn't constructed properly? For example, when you include a table with language-dependent descriptions and there are multiple languages defined, you might end up with unwanted duplicates.

What are the tables involved in your query, and how have you linked them?

Thomas

Hi Experts,

I am creating a database view. I am using this view in my search help(created in se11). Now this view is returning recurring values. I want only the distinct values in my search help. Can anyone please suggest how do I go about it?

Regards,

Abdullah

14 REPLIES 14
Read only

Former Member
0 Likes
3,715

Hi:

use search help in selection method where you can use distinct to avoid the duplicate records

For details, have a look

[Link|http://help.sap.com/saphelp_nw70/helpdata/en/cf/21ee38446011d189700000e8322d00/content.htm]

Regards

Shashi

Read only

0 Likes
3,715

Dear Shashi,

Can you please elaborate on the same.

The steps I followed are:

1. Create database view.

2. Create search help and in the selection method I specified the view name.

3. Specify the view fields I require in the search help.

The database view is returning duplicate values. So when I click on F4 on the search help, I get the same. How can I suppress the duplicates?

Regards,

Abdullah

Read only

ThomasZloch
Active Contributor
0 Likes
3,716

Is it possible that your view isn't constructed properly? For example, when you include a table with language-dependent descriptions and there are multiple languages defined, you might end up with unwanted duplicates.

What are the tables involved in your query, and how have you linked them?

Thomas

Read only

0 Likes
3,715

Hi Thomas,

My field here is Size/Dimensions (GROES) of Material Master table MARA. In the view selection conditions I have specified, MARA GROES NE ' '

Since size is a non key field of MARA, I am getting duplicates. Which I want to avoid.

Regards,

Abdullah

Read only

0 Likes
3,715

Seems like you cannot do this with a view but must rather program the SELECT DISTINCT statement yourself via a [search help exit|http://help.sap.com/saphelp_nw70/helpdata/en/cf/21ee52446011d189700000e8322d00/frameset.htm].

Thomas

Read only

Former Member
0 Likes
3,715

Hi,

In the view , Just check if the key fields are joined. If the fields are not keys of the table, then you will get duplicate entries.

Read only

Former Member
0 Likes
3,715

Hi,

You can refer to the link below,

I think it will definately work for you.

Thanks & Regards

Sarita Singh Rathour

Read only

0 Likes
3,715

Hi Sarita,

If I was using a select statement, there would have been no issue. I am using it in a search help created using SE11.

Regards,

Abdullah

Read only

Former Member
0 Likes
3,715

Hi,

Use this statement

DELETE ADJACENT DUPLICATES FROM TBL_HELP COMPARING -


.

And pass the TBL_HELP thru this FM.

CALL FUNCTION 'F4UT_PARAMETER_RESULTS_PUT'

Regards,

Suneel G

Read only

0 Likes
3,715

Hi Suneel,

We are in the tyre industry and size will be used on the interface of most MM/SD related Z reports. Creating a search help will be better than coding here. More over if its a select-options, I will have to give the routine twice for field-low and field-high.

Regards,

Abdullah

Read only

Former Member
0 Likes
3,715

Hi,

Please check that you have importing parameter for the search help parameters, this will allow you to restrict values. Also check that you have key fields as part of the search help parameter list as importing as well as exporting parameter.

You can also use search help exit by using the interface same as that of function module F4IF_SHLP_EXIT_EXAMPLE and check the values in the table RECORD_TAB[] to remove duplicate entries.

Regards,

George

Read only

0 Likes
3,715

Hi George,

I am using

 select-options: s_groes for mara-groes matchcode object zgroes modif id chr.

If i opt for coding I will have use something similar to the code below.,


at selection-screen on value-request for s_groes-low.
 perform f_f4_groes.

at selection-screen on value-request for s_groes-high.
 perform f_f4_groes.

I will explore the search help exit.

Regards,

Abdullah

Edited by: Abdullah Ismail on May 12, 2009 3:41 PM

Read only

Former Member
0 Likes
3,715

Hi Abdullah Ismail ,

Use Search help exit to delete the duplicate records.

For information about this refer the below link:

http://www.sapdev.co.uk/dictionary/shelp/shelp_exit.htm

Thanks,

Sudha

Read only

Former Member
0 Likes
3,715

Hi,

Thanks a lot everybody. I used the search help exit and it solved the problem.

Regards,

Abdullah.