cancel
Showing results for 
Search instead for 
Did you mean: 

Adding new fields to BuPaSearchB2B

Former Member
0 Kudos

Hi all:

I have a big problem, i've added 3 fields (BirthDate, Sex, BirthPlace),in view BuPaSearchB2B and i added an append to the structure in genil, but when i search a Business Partner using this fields it is not working, am i missing something?, i have looked into different threads, but none have helped me solve my problem, does any one have faced the same situation?, hope you might help me.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Andres,

The easy way is to <b>filter the resultset according to the new fields values</b>.

There are many statements as "query_service->get_query_result( )". You need to debug and find which one is triggering in your case.

This statement gives you teh entity collection. Then you could filter the entity collection according to your additional search fields and finally you have filtered resultset of entities according to your new search criteria.

Try this and let me know if face any issue.

Cheers,

Ankur

Former Member
0 Kudos

Hi Ankur:

I've found the query name wich is "BuilHeaderSearch" query type 3, do you have any example on how to do this, i'm beginer in ABAP, so if you have any code example on how to filter the entity collectio i would be very grateful.

Thanks in advance.

Former Member
0 Kudos

Andres,

I am assuming that you have added "BirthPlace" field on your view.

Try the below code, it filters results based on BIRTHPLACE search field.

After the statement:

bo_col ?= query_service->get_query_result( ).

lv_no_hits = bo_col->size( ).

Add code:

                • Begin of changes **********

If lv_no_hits > 0.

data: lv_rel type ref to IF_BOL_BO_PROPERTY_ACCESS.

lv_rel = bo_col->get_first( ).

data lv_birthplace type string.

if lv_birthplace_cw is not initial.

while lv_rel is bound.

lv_birthplace = lv_rel->get_property_as_string(

'BIRTHPLACE' ).

if lv_birthplace ne lv_birthplace_cw.

bo_col->remove( lv_rel ).

endif.

lv_rel = bo_col->get_next( ).

endwhile.

endif.

Endif.

                • End of changes **********

This way youcould try all your 3 parameters one by one.

It is better to have some understanding of ABAP, BSP before starting ICWC.

You could try reading the ICWC cookbook, I'll mail you if you dont have.

Cheers,

Ankur

Former Member
0 Kudos

Hi Ankur:

I've tried the code you gave me, but when i execute it the variable lv_no_hits is equal to 0, so i can filter the resultset because it is returning empty, do have any idea on how can i execute the query without parameters so the resultset does not return empty and i could be able to apply the filters?

Thanks in advance

Former Member
0 Kudos

Andres,

If hits are zero, that means the searchc riteria you have given in ICWC doesn't contain any records. So you couldn't filter them further.

What you could do is, try some search criteria on ICWC and when you see some results in resultset, then apply this code to filter by "Birthplace" and it'd surely work.

We have also implemented this way. Let me know if you face some issue.

Cheers,

Ankur

Former Member
0 Kudos

Hi Ankur:

I've done what you told me, but i have 2 questions:

Where do you declare variable lv_birthplace_cw?

How can filter only by the birthdate, without using another search criteria.

Thanks in advance.

Former Member
0 Kudos

Andres,

Answer for Ques 1.

==============

  • 2c. Search by Customer

*************************

lv_wrapper =

typed_context->SearchCustomer->get_collection_wrapper( ).

query_service ?= lv_wrapper->get_current( ).

              • BEGIN of CHANGES **************

data:

lv_birthplace_cw type string.

lv_birthplace_cw =

query_service->IF_BOL_BO_PROPERTY_ACCESS~GET_PROPERTY_AS_STRING(

'BIRTHPLACE' ).

              • END of CHANGES **************

<b>lv_birthplace_cw</b> is the value for BIRTHPLACE field on screen which is filled by user before the Search process.

This code is retreiving this value from Query Service, however you could also use your view context node to get the value from "BirthPlace field on screen".

Answer for Ques 2.

==============

You could left other fields empty and provide value only to BIRTHPLACE field. This would intially fetch all results and would then be filtered by this code. However I'd not suggest to use this way since it would be large no of results and you may see peroformance issues. You need to decide on some fields being mandatory in ICWC.

I hope you now would be able to filter the results. Let me know if you face some issue.

Cheers,

Ankur

Former Member
0 Kudos

Hi Ankur:

Thanks on the answer it helped me a lot to understand the query, but i still can't filter the data, i've looked into method get_query_result and inside this method a method called 'get_query_params' is called and this method retrieves the birthdate wich is why the resultset is empty, so my question is how can i do to the 'get_query_result' method does not retrieve any params and it gives results, so i can filter the resultset?.

Thanks in advance.

Former Member
0 Kudos

Andres,

<b>'get_query_params'</b> is used to retrieve the Query parameters which you have set.

It doesn't matter whether Birthplace is there because while executing the BIRTHDATE wouldn't participate in search since you have just added it in view and not modified and passed this to the API (actual search).

Are you sure you had BP results before adding field.

Cheers,

Ankur

Former Member
0 Kudos

Hi Ankur:

Thanks a lot, i succesfuly filtered the info i needed, i haven't replyed because i wasn't in the office, now i have a litle problem, sometimes when i do the filtering, the recordset gets empty and the view fails sending an exception of "reference ZERO", so do you have any idea on how to solve this, it ocurred to me that it would work if i could add an empty row to the recordset when the size of this is equal to 0, but i don't know how to do it can you help me?

Thanks in advance.

Former Member
0 Kudos

Andres,

This is due to fltering of results explicitly. The system finds out matches and tries to navugate to searchresult view but between this the additional filtering for BIRTHPLACE is done and resultset becomes empty. Hence it shows the exception.

I guess you are replacing the standard controller with your own and calling super->eh_onsearch() and then filtering the results.

You need to disable the call to super->eh_onsave() and paste the code explicitly in your methd. Place the custom filter code right after the query result is retrived.

Cheers,

Ankur

Former Member
0 Kudos

Andres,

Were you able to solve the issue. If yes please reward/close the thread.

Cheers,

Ankur

Former Member
0 Kudos

Hi Ankur:

Thanks a lot on your help, i've just finished and it worked just fine.

Thanks & Regards

Former Member
0 Kudos

hi,

I am working in crm 7.0

we have a similar requirement. Adding po_box field in search BP view. The component we are enhancing is iuicmd. I have included po_box field in search node. I took reference of code mentioned in the thread and implemented as below... i am facing some issues...

******* 
*------BEGIN CHANGES------- 
******* 
  IF lv_hits > 0. 
*   filter query result for po_box 

    data: lv_rel      type ref to   IF_BOL_BO_PROPERTY_ACCESS, 
          lr_qResult  type ref to   IF_BOL_ENTITY_COL, 
          lv_poBox    type          string, 
          lv_poBox_cw type          string. 

    lr_qResult ?= lr_qs->get_query_result( ). 
    lv_rel = lr_qResult->get_first( ). 

    lv_poBox_cw = lr_qs->IF_BOL_BO_PROPERTY_ACCESS~GET_PROPERTY_AS_STRING('PO_BOX'). 

    if lv_poBox_cw is not initial. 
      while lv_rel is bound. 
        lv_poBox = lv_rel->get_property_as_string('PO_BOX'). 

        if lv_poBox ne lv_poBox_cw. 
          lr_qResult->REMOVE(lv_rel). 
        endif. 

        lv_rel = lr_qResult->get_next(). 
      endwhile. 
    endif. 

  endif.

It is giving error while syntax check.. It is pointing at statement remove and asking to check spelling. I don't think spelling is wrong... Kindly help me.

Former Member
0 Kudos

above spelling issue is solved.... but i am getting compatability issue at remove statement.

"LV_REL" is not type compatabile with formal parameter "IV_entity"

Kindly help how to proceed.

Thanks!

Edited by: Ekta on Jul 14, 2010 9:01 AM

Answers (0)