Skip to Content

CRM BOL Programming to insert new Condition Type with value

Hi,

Requirement is to insert a new Condition Type along with rate for a CRM Service Order created via tr code CRMD_ORDER through PROXY .

From the PROXY to create Service Order we have written a BOL code to insert new condition type and rate for each line item to be created .

Here is the code in brief :

lr_core = cl_crm_bol_core=>get_instance( ).

lr_core->start_up('BT'). CHECK lr_core IS BOUND.

lr_entitynew ?= lr_core->get_root_entity( iv_object_name = 'BTOrder' iv_object_guid = ls_header ).

CHECK lr_entitynew IS BOUND.

lr_entitynew = lr_entitynew->get_related_entity( 'BTOrderHeader' ).

lr_entitynew = lr_entitynew->get_related_entity( 'BTHeaderItemsExt' ).

CHECK lr_entitynew IS BOUND.

TRY.

CALL METHOD lr_entitynew->get_related_entities EXPORTING iv_relation_name = 'BTOrderItemAll' RECEIVING rv_result = lr_coll.

CATCH cx_crm_genil_model_error.

ENDTRY.

CHECK lr_coll IS BOUND.

lr_entity = lr_coll->get_first( ).

WHILE lr_entity IS BOUND.

lr_entity = lr_entity->get_related_entity( 'BTItemConditionSet' ). .....................

..........................................................................................................

lr_entity->switch_to_change_mode( ).

IF lr_entity->is_changeable( ) = abap_true. TRY.

lr_entity_zadd = lr_entity->create_related_entity( iv_relation_name = 'BTCondICondLineAll').

CATCH cx_crm_genil_duplicate_rel

CATCH cx_crm_genil_model_error. ENDTRY. ENDIF.

The line in BOLD having lr_entity_zadd getting ZERO reference sometimes when it goes inside a loop for every line item . Is there any issue in the code ?

Although If WAIT statement is added before then lr_entity_zadd getting value .

It would very nice if anyone can provide their valuable feedback .

Regards

Amit

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

0 Answers

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.