cancel
Showing results for 
Search instead for 
Did you mean: 

CRM WebClient UI - How to get the current BUAG-ID

former_member605921
Discoverer
0 Kudos

Can i use this code in any component/view/method to get the current buag-id and store it in lv_contacct?

lr_gdc = cl_crm_ui_data_context_srv=>get_instance( ).
lr_bp_entity ?= lr_gdc->get_entity( 'CURRENTBUAG' ).
IF lr_bp_entity IS BOUND.
CALL METHOD lr_bp_entity->get_property_as_value
EXPORTING
iv_attr_name = 'BUAG_ID'
IMPORTING
ev_result = lv_contacct.
ENDIF.

If not, which code would be appropriate?

Thanks in advance.

Accepted Solutions (0)

Answers (2)

Answers (2)

thalesvb
Active Contributor

Hello there,

Yes, you can use that code to fetch current Business Agreement ID as long as you are in same WebUI internal session (this code won't work inside a RFC call, for instance).

Keep in mind that standard considers current Business Agreement the one that is "Confirmed" in Interaction Center (event BuAgConfirmed raised), only after that event it will have CURRENTBUAG filled in data context. This confirmation is automatic when a Business Partner that is confirmed have only one Business Agreement, but if there are more than one BuAg for a BP the IC agent (by standard) must confirm it manually on screen.

Regards

former_member605921
Discoverer
0 Kudos

Hi Thales,

thanks for your response. First of all you should know that im still lacking a basic understanding for the CRM architecture, but i try to learn.

I think since i´m not working with the IC WebClient, but with the WebClient UI the gdc is not getting populated by default, right? So i would have to write the BUAG_ID value in the gdc first (e.g. in the GET_XXX method for BUAG_ID) and then i could get it with the aforementioned code?!

Also i have learned, that i can just use some sort of me->typed_context->ContextNode-name->collection_wrapper->get_current() to get the bol-entity of my current view?

And then i can read properties by using the get_property method?

My Problem is that the desired attribute (BUAG_ID) is not an attribute of the current entity. So the only way to get there is by finding the right relations and navigate from the current entity to an entity that contains the attribute BUAG_ID, right?

Would really appreciate your comments on that.

Best regards