cancel
Showing results for 
Search instead for 
Did you mean: 

Obtain partner id...

gary_king2
Participant
0 Kudos

Having selected one profile from a list at the sign-on of the IC I would then like to identify the partner ID for the org unit associated with that choice. In other words I've signed in using a certain profile which points to an organisation unit, like plumber,electrician or painter. It possible that someone could belong to all three org units but I need to determine which one has been chosen today, for the current IC Session. Hope that makes sense.

There must be a FM (maybe an RH*) or some way of determining this. I know it is determined whenever a service ticket is edited, but the BSP code gets so complicated to track that I can't work out the exact bit of code that determines this.

Gary

Accepted Solutions (1)

Accepted Solutions (1)

former_member202020
Participant
0 Kudos

Hi Gary,

I am not too sure but I guess we need to make the setting in the corresponding Partner determination procedure.

Go to the corresponding Partner det procedure->Partner Functions in Procedure->Select a partner function and click on Lens button.

Change the Access Sequence in the Partner Determination section (in the lower half) to 0009. (Organisational Data: Employee for an Org Unit)

Regards,

Uma.

gary_king2
Participant
0 Kudos

Uma,

Are you saying that code as posted above will not work unless the access sequence is changed in config, according to your instrcutions?.

Also, what knock-on effect might that have should I make this change?. You can tell I am not a functional person.

Over and above this, it's actually the Responsible Group that I am after. So I would have though that whatever the procedure/code the determination/procedure code would have to be defined.

Gary

Edited by: Gary King on Feb 19, 2009 4:56 PM

former_member202020
Participant
0 Kudos

Hi Gary,

No my suggestion was not in relation with the code posted.

As we know,the partner IDs come as per their partner determination procedures. And the access sequence tells the system how the partner is obtained. So when we mention the access sequence as 0009(Org Unit:Employee for Org Unit), for any partner function, say, Person Responsible, the system will determine the corresponding Employee for Org Unit as person responsible. If it was set to 0004(User) then the Person Responsible would have been the logged in user itself.

I am not a func person either but I thought this would work. Please let me know if it helps.

Regards,

Uma.

gary_king2
Participant
0 Kudos

Umi,

The system determines the partners perfectly within the IC.

My problem is that I have a single profile assigned to multiple organisation units. So, when signing in I see (for example) two lines to choose from, both have the same profile name, but obviously have a different description because they belong to different Org units.

I am trying to default the 'Assigned to' field of the inbox search to be the responsible group, based on the profile entered at sign-in.

I would have thought that countless people would have done this before me, but that does not seem to be the case.

Regards

Gary

BGarcia
Active Contributor
0 Kudos

Hi Gary,

If you're working in CRM 4 or 5, all you have to do is to manipulate the method DO_INIT_CONTEXT of your custom controller class for view AuiSearch.hm.

There you'll find the following piece of code:


******** Assigned To - Fixed Domain Values *******************************
  IF g_assignedto_dd[] IS INITIAL.
    g_assignedto_dd = cl_crm_aui_service=>get_empl_assigned( ).
  ENDIF.

Inside this IF statement, you can make your default selection. You have to call the respective node context to do that. Something like:


   me->typed_context->searchauiitems->set_assignedto( ATTRIBUTE_PATH = '' value = '0001' ).

The problem here is that the controller internal table g_assigned_to doesn't store the organization id. It only stores the position in the dropdown box, and the organization name. Something like this (you can also check this by debugging it):

VALPOS | DDTEXT

0000

0001 Me

0002 My Groups

0003 Organization 1

0004 Organization 2

So, I think the best way to do this, is to find the respective org. unit name associated with the profile selected by the agent (the code in my first reply will help you to find the organization ID, the name you may find in BUT000 or any FM that read partner info), find the respective entry (valpos) in internal table g_assigned_to, and make the selection automatically.

If you are working with CRM2007, I'm not familiar how the controller classes are built. I cannot help you there, but check if same logic will not work there.

Kind regards,

Garcia

Edited by: Bruno Garcia on Feb 20, 2009 9:17 AM

gary_king2
Participant
0 Kudos

Thank you very much Bruno. Strangely enough, in combination with looking through the 'Advanced BSP Programming' book and a few IC cookbooks I did discover this solution myself. However, your reply was very welcome to receive as I had not looked into the DO_INIT_CONTEXT method until this morning, so was nice confirmation that I was looking in the right area.

Last nights reading made me realise how little BSP I knew, and how weak my ABAP Objects knowledge was, something I have started to rectify.

Anyway, points have been awarded and I'm very much in debt to you.

Best regards

Gary King

Answers (1)

Answers (1)

BGarcia
Active Contributor
0 Kudos

Hi Gary,

In CRM version 4 and 5, I normally use class CL_CRM_IC_SERVICES to help getting that information. In version 2007 and 7.0, I don't know if still exists, but there must be a similliar class to achieve that.

But if it helps, here it is a piece of code that exemplifies that.


  DATA ls_position        TYPE CRMT_IC_ORG_UNIT
  DATA lv_partner_guid    TYPE but000-partner_guid.
  DATA lv_partner_no      TYPE but000-partner.

*- Get Org model position
  ls_position = CL_CRM_IC_SERVICES=>GET_ORG_UNIT( ).

*- Get partner ID
  CALL FUNCTION 'CRM_ORGUNIT_GETBUPA'
    EXPORTING
      iv_orgunit         = ls_position-objid
    IMPORTING
      ev_bu_partner_guid = lv_partner_guid.

  CALL FUNCTION 'BUPA_NUMBERS_GET'
    EXPORTING
      iv_partner_guid = lv_partner_guid
    IMPORTING
      ev_partner      = lv_partner_no.

Kind regards,

Garcia

gary_king2
Participant
0 Kudos

Bruno,

When executing the code that you originally sent to me:

*- Get Org model position
  ls_position = CL_CRM_IC_SERVICES=>GET_ORG_UNIT( ).

ls_position is returned an OBJID of 99000934 and a OTYP of 'S', so I assume this is a link to a structure of some type. The next bit of code which calls FM 'CRM_ORGUNIT_GETBUPA' returns a GUID of zero's.

I was wondering if this 990000934 value actually links to a position of a list or to one of the related entries in the g_assignedto_dd itab.

Have you ever seen this issue before or maybe know a table where I can reference the objid and otype?

With regards

Gary King

BGarcia
Active Contributor
0 Kudos

Hi King,

My mistake... it reads the position where the profile that the agent choosed, is assigned (you can confirm the id by consulting the organizational model at t-code PPOSA_CRM).

So, had another step to read the upper organizational unit, like this:


DATA ls_position        TYPE CRMT_IC_ORG_UNIT.
DATA lv_partner_guid    TYPE but000-partner_guid.
DATA lv_partner_no      TYPE but000-partner.
DATA lt_objec           TYPE TABLE OF objec.
DATA ls_objec           TYPE objec.

*- Get Org model position
  ls_position = CL_CRM_IC_SERVICES=>GET_ORG_UNIT( ).

*- Get upper object (organization)
CALL FUNCTION 'RH_STRUC_GET' 
  EXPORTING
    ACT_OTYPE        = ls_position-otype
    ACT_OBJID        = ls_position-objid
    ACT_WEGID        = 'EBP-UP'
    ACT_TDEPTH       = 2
  TABLES
    RESULT_OBJEC     = lt_objec
  EXCEPTIONS
    NO_PLVAR_FOUND = 1
    NO_ENTRY_FOUND = 2
          .

READ TABLE lt_objec INTO ls_objec WITH KEY otype = 'O'.

*- Get partner ID
CALL FUNCTION 'CRM_ORGUNIT_GETBUPA'
  EXPORTING
    iv_orgunit         = ls_objec-objid
  IMPORTING
    ev_bu_partner_guid = lv_partner_guid.

CALL FUNCTION 'BUPA_NUMBERS_GET'
  EXPORTING
    iv_partner_guid = lv_partner_guid
  IMPORTING
    ev_partner      = lv_partner_no.

The last two function module calls may be unecessary, since the object ls_objec also returns the descriptions of the objects readed, and maybe you can compare to the ones that are in the dropdown box.

Can you check if it helps you?

Kind regards,

Garcia

Edited by: Bruno Garcia on Feb 20, 2009 1:13 PM

gary_king2
Participant
0 Kudos

Bruno, You're a Star !

I had been looking for a method do that for simply ages.

I owe you a large beer.

With regards

Gary King

former_member206299
Contributor
0 Kudos

hi Bruno ,

My requirement is to read the partner no.i am getting the partner no in the set_s_struct method in the custom controller .i want to get the partner no in the z view i added.Can u tell me how to call this custom controller method in the newly created z view.