cancel
Showing results for 
Search instead for 
Did you mean: 

Add field to Opportunity Search Criteria

Former Member
0 Kudos

Hello,

Within the Opportunity Search the Results list shows the 'CREATED_A'T' field, this field is not available on the Search Criteria.  is there a way to include this in the Search Criteria ?

Regards

Chan

Accepted Solutions (1)

Accepted Solutions (1)

ajaya_kumar
Active Participant
0 Kudos

Hi Chan,

I guess your requirement can be addressed using standard field 'CREATED_AT_RANGE'.

Try the following steps:

1. Refer the document : http://scn.sap.com/docs/DOC-26636

2. Follow this document till step 3 only.

3. Instead of fieldname ZZCONTDATE you need to give 'CREATED_AT_RANGE', No need to start the fieldname withh ZZ or yy, give the exact name 'CREATED_AT_RANGE' with type datum.

Handling for this field is already there at backend.

Let me know if it works for you.

Regards,

Ajay

Former Member
0 Kudos

Hi Ajay

I have appended the structure and included the component as a date.  I didn't create a Design Layer as the field has become available for selection in the Search view.  I then selected this field as Search Criteria and selected a date for which I know Opportunities exist, but it doesn't seem to take this date into consideration when filtering the data as it is showing all Opportunities.

Regards

Chan

ajaya_kumar
Active Participant
0 Kudos

Hi Chan,

Please check if you have given the field name as  'CREATED_AT_RANGE' in structure enhancement. Also, check what value is getting passed for this selection parameter. for example if you are searching Create At  = 25 Apr 2012, then check in debug mode value for  'CREATED_AT_RANGE' should be equal to 20120425.

It worked for me in debug mode.

Also, you can put a break point on line number 2520 in program (se38): LCRM_BSP_OIC_1O_SEARCHF04 and check.

Regards,

Ajay

Former Member
0 Kudos

Hi Ajay,

Field is defined as suggested, see below:

Other than the program you suggest to look at the where else did you set the debug point ?

We are on CRM 2007, the program LCRM_BSP_OIC_1O_SEARCHF04 may be different to our version as line 2520 does not exist.

Regards
Chan

ajaya_kumar
Active Participant
0 Kudos

Ok, you are on CRM 2007.

the you can try the following:

Goto se37 and open FM 'CRM_BSP_OIC_1O_SEARCH_FROM_RF'

Then double click on Perform  extend_query_for_multivalues

inside this perfom, try to search for *CREATED_AT* or something similar and you will find a CASE WHEN condition with *CREATED_AT*, use this as fieldname in your structure enhancement.

I dont have access to SAP CRM 2007 system other wise I would have given you the exact details.

Hope this would help you.

Regards,

Ajay

Former Member
0 Kudos

I've checked the program and in the CASE WHEN condition there is no field liek *CREATED_AT*, only CREATED_BU exists. 

Regards
Chan

Former Member
0 Kudos

Hi Chan,

Did you debug the EH_ONSEARCH method of your view?

ok let me put my views after debug...

1.When you click on EH_ONSEARCH it collects all the selection parameters..including CREATED_AT(custom field)

2.IT goes to class CL_CRM_QOPP_RUN_BTIL and method GET_DYNAMIC_QUERY_RESULT

  if you see line number 98,you can see paramter conversion

3.please see CRMD_ORDERADM_H ...POSTING DATE and CREATED_AT fields contains same value

now what we can do is

EH_ONSEARCH

conver your paramter name to VALID_FROM

and send the value..

so system will check take it as start date range and gets the values of orders created from that particular date..

i know it returns  the values created from that date and we need only the values created on that date...for this also you can achieve further more and find exact attribute which gets the values based on posting date field..

so try converting u r paramter name t POSTING_DATE it would work...

please look at class CL_CRM_Q1O_SEARCH and method PREPARE_FILTER_TABLES line number 194..

sure you will get a clue...first u change in debug mode to diff parameter names then u can change directly in code at eh_onsearch level..

Former Member
0 Kudos

Hi Sivaram,

Thanks for your precise explanation,  Changing the parameter name to 'POSTING_DATE' works fine for all Search operators for this field, e.g, 'is', 'between' etc.  This is fine in debug mode but as I am not familiar with BSP progamming, any hints as to how I could code this by redefining method EH_ONSEARCH ?

Regards
Chan

Former Member
0 Kudos

Hi Chan

Sorry for late reply.

It make sense if we code at genil level for this conversion.

SO try this apraoch

Pleas create a custom class which is having super class as CL_CRM_QOPP_RUN_BTIL  .

make the above class and maintain at the view  CRMC_OBJ_BTIL_C along with object name.

now in custom class redfeine the method IF_CRM_QUERY_RUNTIME_BTIL~GET_DYNAMIC_QUERY_RESULT

and there just to add our custom code at line number 98..

as like start_date_range..just place the piece of code  for created_at -->posting date conversion..

please let me know if it now works.

Former Member
0 Kudos

Hi Sivaram,

Thanks for your solution, but I am not familiar with genil or Bol programming, not sure where to create the custom class, through BSP workbench, SE80 ?

Regards

Chan

Former Member
0 Kudos

Please go to SE24

Give a name ZCL_CRM_QOPP_RUN_BTIL and click on Create.

In next screen please go to Attributes tab and click on Super Class and enter CL_CRM_QOPP_RUN_BTIL as super class.

Save and activate.

now please place the cursor at our method (make sure you remove the check box Filter)  and click on REDEFINE mthod avlable at class.

Before redefining copy the code in that ,after redfeining paste the same code and change/insert the code at line number specified above.

now pleas go to view (given above) and make an entry with BTQopp and the new z class...

Former Member
0 Kudos

When I copy the code from the methid I get a syntax error on activation, see below.

Regards
Chan

Former Member
0 Kudos

please change it to super->validate_fields( lt_selection_paramters ).

kavindra_joshi
Active Contributor
0 Kudos

Hi Chan,

In your class you don't have the method validate_fields. Either copy the method validate_fields from where you have copied the code or else implement the same method yourself.

Once you do this you would be good to go.

Regards

Kavindra

Former Member
0 Kudos

Thanks Kavindra,

I have created the validate_fields method all the objects are now activated.

Regards
Chan

Former Member
0 Kudos

I have created the method validate_fields as per Kavindra's post  and all objects are now activated.  Moving on the the final stage then, which view and where do I enter the new class ?

Regards
Chan

Former Member
0 Kudos

Hi Chan,

We need to enter the clas anme and object name in view CRMC_OBJ_BTIL.

I trust you have copy pasted code from super class to sub class for validate_fields( ).

Former Member
0 Kudos

Hi Sivaram,

Yes, I copied and pasted the code form the superclass.  Thanks for your patience so far, what trasnaction do I use to maintain the view ?

Regards
Chan

Former Member
0 Kudos

SPRO->CRM->CROss Application Components->generic Interaction Layer->Component Specific Steetings->Busines Transactions->Define Custom Handler Classes for Business Transaction Model Nodes.

Please make an entry

External Object Name as BTQOpp

Structure name as  --Z class

then re start the webui..put debug point in custom class and run the search and check our luck .

Former Member
0 Kudos

I've assigned the Z class to BTQOpp and re-started the WEBUI, but when I enter some criteria and press search I get a BSP error as below:

Regards

Chan

Former Member
0 Kudos

Hi Chan

Sorry ,I forgot.

Please give class name as ZCL_CRM_QOPP  only in the SPRO path given above.Please do not include RUN_BTIL.

Please do not change class nate etc at se24....only change in the SPRO path

Message was edited by: Sivaram Pushpala

Former Member
0 Kudos

Thanks Sivaram,

It's working now I'll do some more testing but it seems to be ok.  Many thanks for your patience and support.  Appreciate it.

Regards
Chan

Former Member
0 Kudos

Hi Ajay,

My issue is solved , many thanks for your input to this.  Please follow thread with Sivaram for solution.

Regards
Chan.

Former Member
0 Kudos

Hi Kavindra,

My issue is solved , many thanks for your input to this.  Please follow thread with Sivaram for solution.

Regards
Chan.

Former Member
0 Kudos

Ok good to know its working.

if you have time make a document and post in WIKI ,so it will be helpful for so many people like us

Answers (1)

Answers (1)

kavindra_joshi
Active Contributor
0 Kudos

Extend the query input structure with the new field. If the field is not available in the BOL structures then extend the relevant structures so that this information is captured as well.

Former Member
0 Kudos

Hi Kavindra,

I'm not too familiar with BSP , could you elaborate on how I find the neccessary structures to extend.

Chan

Former Member
0 Kudos

Hi

First you need to add the field to below structures

Search Structure : CRMST_QUERY_OPP_BTIL

Search Result Structure: CRMST_QUERY_R_OPP_BTIL

Next step is you need to write your own logic in API to retrieve the result based on your custom field.

As per your requirement as it is CREATED_AT which is standard field..please try to change the paramter name to CREATED_AT_DATE on EH_ONSERCH while passing the paramters to search query.

Please debug from EH_ONSEARCH method you will get the whole logic how it works,what to do etc..

Former Member
0 Kudos

Hi Sivaram,

The SAP standard field is already avalable in the the Results list, so do I only need to extend the  Search Structure : CRMST_QUERY_OPP_BTIL and check the

code on EH_ONSEARCH ?

Regards
Chan

Former Member
0 Kudos

Yes,

Please click on F2 and get component details and view details

you can find the EH_ONSEARCH method in view impl class.

put a debug point in that method.

Are you familiar with component work bench.?i given answer with assumption of you know about webui framework..if not let me know i ll provide step by step answer

Former Member
0 Kudos

HI ,

I am familiar with the Workbench component, I will look into it.

Regards
Chan

Former Member
0 Kudos

HI ,

I am familiar with the Workbench component, I will look into it.

Regards
Chan