cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot read my bol entity

Former Member
0 Kudos

Hello together,

I created a simple bol object. My problem is, I cann't get an instance of my bol object with:

DATA:
lr_entity   TYPE REF TO cl_crm_bol_entity,

lr_entity ?= me->typed_context->Zobject->collection_wrapper->get_current( ).

With current, I can read it


lr_current  TYPE REF TO if_bol_bo_property_access.

lr_current = typed_context->Zobject->collection_wrapper->get_current( ).

The type cast to entity (lr_entity ?= ) makes some troubles. I found in debug mode, that my context node with the my simple object is apperaring as value node. Could this be the problem?

Can anyone help me?

Regards,

Harris

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member192716
Contributor
0 Kudos

Hi,

Zobject is a value node and that is why you are not able to type cast to cl_crm_bol_entity reference type.

Change it to,


Data: lr_entity type ref to cl_bsp_wd_value_node.

Regards,

Arun

Edited by: Arun Kumar on Jun 16, 2010 10:57 AM

Former Member
0 Kudos

Hello Arun,

my simple bol object is a root object. I need methods like "is_locked" from the class CL_CRM_BOL_ENTITY. With the class that you mentioned, I cann't not save my issue.

Regards,

Harris

former_member192716
Contributor
0 Kudos

Hi Harris,

Your simple object is a value node and not a model node. So you can only use a reference object of type cl_bsp_wd_value_node.

Regards,

Arun

Edited by: Arun Kumar on Jun 16, 2010 2:03 PM

Former Member
0 Kudos

Hii Arun,

are the simple objects automatically value nodes? Is it possible, to have a simple object as model node?

Can you say me where to change it to a model node?

Thank you so far,

former_member192716
Contributor
0 Kudos

Hi Harris,

You need to create a custom genil object. Refer this thread,

Regards,

Arun

arunprakash_karuppanan
Active Contributor
0 Kudos

Hi,

If it's a single table, it would be easier to use the simple BOL object generator in the IMG. This wiki will show you how to do it.

[http://wiki.sdn.sap.com/wiki/display/CRM/CreateaZBOLObjectPart1]

Regards,

Arun Prakash

Former Member
0 Kudos

Hello Arun,

I realized my issue with simple objects. As I said before, my problem is, that I can not get an instance of the model node. I have not redefined the IF_BSP_MODEL~INIT method and also not redifined the DO_INIT_CONTEXT method. But anyway, I can not get an instance of my model node.

Do you know an idea, what the problem is?

regards,

Harris

arunprakash_karuppanan
Active Contributor
0 Kudos

Hello,

You must create the instance of the root object yourself. You should then add it to the collection wrapper. While creating, you should fill the attributes of the "create" structure that you specified when creating the BOL. The article below shows how to create a root entity. Replace the build parameters and the BOL object name with your own.

[http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/e0ddd4e6-32f9-2c10-9d88-d993c4b0008d]

Regards,

Arun Prakash

Former Member
0 Kudos

Hii Arun,

Thank you very much.

Have I understood it correctly? The point is, I need to create my root entity first, because the bol object is new created and is also a root object. Thatswhy I need to create my bol entity first.

Is it right?

I created know my bol object with:

l_core      TYPE REF TO cl_crm_bol_core,
          lr_root_col TYPE REF TO if_bol_entity_col,
          l_tx        TYPE REF TO if_bol_transaction_context,
         lr_entity   TYPE REF TO cl_crm_bol_entity,


      lr_root_col ?= l_core->root_create( iv_object_name = 'ZSimple_Object'
                                         iv_create_param = li_param
                                         iv_number = 1
          ).

      lr_entity ?= lr_root_col->get_current( ).

      l_core->modify( ).

Unfortunately, I cann't not give certain guid with the internal table li_param to use by creating my bol object. My intention is to save for example the partner guid by creating my bol object with "root_create" and fill after creating the bol object the other columns of my table.

But the method root_create, generates obviously automatically a guid by creating my bol object, .

Ok, I could insert a second column to my database table to save my partner guid in a different column. Is there a way to give a different guid by creating my bol object?

reagards,

Harris

Edited by: Harris81 on Jun 17, 2010 4:08 PM

arunprakash_karuppanan
Active Contributor
0 Kudos

Hi Harris,

That depends on how the GenIL class has been written. You can certainly make the GUID part of the create structure and pass the value when you execute root_create. Look in the generated GenIL class whether a new GUID is generated or if the incoming GUID is accepted in the method for creating objects. You can influence the behaviour however you want.

Regards,

Arun Prakash

Former Member
0 Kudos

thanks,

problem is solved