Skip to Content
author's profile photo Former Member
Former Member

CRM: How to read entity from Cross Root Object

Hi Frds,

In an assignment block I do have BuilOpportunity table context node. I need to read entity from BTOpport object of each line item.

BuilOpportunity has root object BuilHeader

BTOpportH has root object BTOrder

Question: How can I get entity (BTOpportH) from cross root object.

Please advice.

Thanks,

Rajan

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Jul 25, 2016 at 06:42 AM

    Hi,

    You can create an Instance of BT by using the Partner from BuilHeader.

    And then navigate to BTOpportH of BTOrder.

    DATA: LR_CORE TYPE REF TO CL_CRM_BOL_CORE,

    LR_QS TYPE REF TO CL_CRM_BOL_DQUERY_SERVICE,

    LS_PARAM TYPECRMT_NAME_VALUE_PAIR,

    LT_PARAM TYPE CRMT_NAME_VALUE_PAIR_TAB,

    LR_RESULT TYPE REF TO IF_BOL_ENTITY_COL.

    LR_CORE = CL_CRM_BOL_CORE=>GET_INSTANCE( ).

    LR_CORE->LOAD_COMPONENT_SET( 'BT' )

    LR_QS =?= CL_CRM_BOL_DQUERY_SERVICE=>GET_INSTANCE( 'BTQOpp_AC' )

    * Not sure if this query object will work , if not you can always use BTQ1Order

    Pass the Search Parameter :

    ls_param-name = 'BU_PARTNER'.

    ls_param_value = 'Pass the Bp Number from the BuilHeader '

    Append LS_PARAM to LT_PARAM.

    LR_QS->SET_QUERY_PARAMETERS( LT_PARAM ).

    LR_RESULT = LR_QS->GET_QUERY_RESULT( ).

    Thanks

    Deepak

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 25, 2016 at 10:50 AM

    Hi Rajan,

    Steps-

    1. Get opportunity Id from BuilOpportunity-object_id.
    2. Get bol core instance using CL_CRM_BOL_CORE=>GET_INSTANCE( ).
    3. Load BT component using LOAD_COMPONENT_SET( 'BT' )
    4. Use query object BTQOpp for getting dquery services using CL_CRM_BOL_DQUERY_SERVICE=>GET_INSTANCE( 'BTQOpp'' )
    5. set parameter for dquery service -

    attribute 'OBJECT_ID' and value = opportunity id from step 1.

    6. get result od dquery service using get_query_result method. It will give you BTQROpp.

    7. Use get_related_entity( ) and go through below relations to get BTOpportH finally.

    BTADVSOpp->BTOrderHeader->BTHeaderOpportunityExt

    Thank You.

    Best Regards,

    Tushar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 25, 2016 at 06:28 PM

    Hi Frds, Thanks you very much for your response.

    I already use this approach, Is there any other or direct way to fetch the data.

    Thanks,

    Rajan

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Rajan,

      Had you been using the Model "BTBP" then you could have got the desired entity without creating any instance for the BT component.

      But as you mentioned that you only have Buildheader (i.e BP component) , so in order to get the entities of BT , you will have to load the BT component.

      Or alternate you can use CRM_ORDER_READ.

      Thanks

      Deepak

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.