This website is not affiliated with, sponsored by, or approved by SAP AG.

Line 'entity ?= current' is failing [RESOLVED]

CRM related discussion only

Moderators: Snowy, thx4allthefish, Lost Identity

Line 'entity ?= current' is failing [RESOLVED]

Postby DrSidewalk » Fri Jan 08, 2016 4:27 am

Guys,

We have some code in a get_i_formul method (entity ?= current) which is failing, in that the entity remains INITIAL altough current does have a value.

Code: Select all
   
DATA: current TYPE REF TO if_bol_bo_property_access.

    rv_disabled = 'TRUE'.
    if iterator is bound.
      current = iterator->get_current( ).
    else.
      current = collection_wrapper->get_current( ).
    endif.

  TRY.

  DATA: coll   TYPE REF TO if_bol_entity_col.
  DATA: entity TYPE REF TO cl_crm_bol_entity.
 
    entity ?= current.

.....


I'm aware there are not many details here, but in general what can be the cause of this. I ahve seen this issue before but for life of me can't work out what it can be. Bad day I think. I assume it can only be a few things that can cause this?.
What should I be checking to rectify the issue. In theory the field should be set to editable, but at the moment it remains read-on

Dr Sidewalk
Last edited by DrSidewalk on Fri Jan 08, 2016 8:20 am, edited 1 time in total.
DrSidewalk
 
Posts: 178
Joined: Thu May 03, 2012 9:35 am

Re: Line 'entity ?= current' is failing

Postby Gothmog » Fri Jan 08, 2016 5:47 am

Well, the casting will fail if current is not a ref to cl_crm_bol_entity (or one of its sub-classes).
What is current's actual type ?
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1936
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: Line 'entity ?= current' is failing

Postby DrSidewalk » Fri Jan 08, 2016 8:19 am

Looks like the user had used the wizard to add new fields, but, the wizard had inserted new code into the INIT method, and it was this that was causing grief. Once remarked out all was then okay.
DrSidewalk
 
Posts: 178
Joined: Thu May 03, 2012 9:35 am


Return to CRM :: SAP CRM

Who is online

Users browsing this forum: No registered users and 2 guests





This website is not affiliated with, sponsored by, or approved by SAP AG.