cancel
Showing results for 
Search instead for 
Did you mean: 

get entity BTPartner

Former Member
0 Kudos

Hi,

I am trying to get the GUID for my contact in context node BTPARTNERCONTACT in the lead component.

I am writing the following code in the get_partnerno:

method GET_PARTNERNO.

DATA: current TYPE REF TO if_bol_bo_property_access.

  • value = 'BTPartner not bound'. "#EC NOTEXT

IF iterator IS BOUND.

current = iterator->get_current( ).

ELSE.

current = collection_wrapper->get_current( ).

ENDIF.

value = cl_crm_uiu_bt_partner=>get_partner2( current ).

DATA : lr_part TYPE REF TO cl_crm_bol_entity,

lv_mode_en TYPE string,

ET_ADSMTP TYPE bapiadsmtp,

iv_partner type BU_PARTNER.

lr_part ?= typed_context->partner->collection_wrapper->get_current( ).

*THIS LINE IS GIVING AN EXCEPTION ANY IDEA????

lv_mode_en = lr_part->get_property_as_string( iv_attr_name = 'PARTNER_GUID' ).

CALL FUNCTION 'BUPA_ADDRESS_GET_DETAIL'

EXPORTING

  • IV_PARTNER =

IV_PARTNER_GUID = lv_mode_en

  • IV_ADDRNUMBER =

  • IV_ADDRGUID =

  • IV_VALDT = SY-DATLO

  • IMPORTING

  • ES_ADDRESS = ADDRESS.

TABLES

ET_ADSMTP = ET_ADSMTP.

lr_part->set_property( iv_attr_name = 'e_mailsmt' iv_value = ET_ADSMTP-E_MAIL ).

.

endmethod.

I am getting an exception here

lr_part ?= typed_context->partner->collection_wrapper->get_current( ).

is this the correct way 2 get an entity?

Please help!!!

Regards

Shilpi

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Shilpi,

In this method the Current refers to the entity BTPARTNERCONTACT.

You need to back trace from BTPARTNERCONTACT to BTPARTNER and for that you need to use the method get_partner( ).

You cannot do this using me->typed_context since this is not a part of your context node it is a part of your controller class.

I hope this helps.

Regards,

S Sarma.

Former Member
0 Kudos

Thanks for ur response.

What if i have 2 fetch BTPARTNERCONTACT only?

What should be my code?

Regards

Shilpi

prasenjit_sharma
Active Contributor
0 Kudos

If you are coding inside the Get-method then 'ME' does not give u reference to the controller class. Then me->typed_context... etc u cannot use. Check in the debug mode how u can get reference to the controller class then u can use that. in the debug mode, check the object me and see how u can reference controller class from there.

may be something like me->view_controller.

Regards

Prasenjit

Former Member
0 Kudos

Hi,

What exactly is me?

If we are using ME inside the get method of a context class then it refers to the context class whereas when use ME inside an event handler it refers to the controller class?

I am extremely new to all this !

In debugging mode how do we reach ME and how do we analyse?

Appreciate ur patience and thanks for responding.

Regards

Shilpi

Former Member
0 Kudos

Also what is typed_context?

yevgen_trukhin
Advisor
Advisor
0 Kudos

Hello Shilpi,

ME is a keyword which refers to the current instance of the class. A controller has an access to the context. typed_context is the reference to the context. This is typical MVC architecture. You can find a lot of MVC info on google.

Best Regards,

Yevgen

Former Member
0 Kudos

Hello Shilpi,

This is not the correct way to get the partner entity. I think you are trying to access a method of lr_part when it is not initialised that is the reason why you get the error.

What you can do is use is you need to get the parent entity relation and back trace it till you reach the partner.

Once you reach the partner entity you can get the guid.

In cl_crm_bol_entity there is a method to GET_PARENT( ) use this method to do so.

Regards,

S Sarma

Former Member
0 Kudos

lr_part1 ?= ME->TYPED_CONTEXT->workaddress->COLLECTION_WRAPPER->GET_CURRENT( ).

Class ZL_BT108H_L_DETAIL_CN10,Method GET_PARTNERNO

Field "WORKADDRESS->COLLECTION_WRAPPER->GET_CURRENT(" is unknown. It is

not contained in one of the specified tables nor is it defined by a

"DATA" statement. "DATA" statement.

Why am i getting this error?

Regards

Shilpi