Skip to Content
avatar image
Former Member

assign product model (PME) to product

Hi All,

I need to assign particular product model(PME) to product. I am writing the below to handle the functionality . But still that product is not appearing in the PME.

lr_core = cl_crm_bol_core=>get_instance( ).
lr_core->start_up( ).
lr_core->load_component_set( 'CRMPME' ).

lr_query_srv = cl_crm_bol_query_service=>get_instance( 'CrmPmeKbrtQuery' ).

DATA it_parms TYPE crmt_name_value_pair_tab.
DATA wa_parms TYPE crmt_name_value_pair.

wa_parms-name = 'KB_LOGSYS'.
wa_parms-value = 'CRMCLNT100'.
APPEND wa_parms TO it_parms.

wa_parms-name = 'KB_NAME'.
wa_parms-value = 'PRODUCT_MODEL'.
APPEND wa_parms TO it_parms.

wa_parms-name = 'KB_VERSION'.
wa_parms-value = '1.20'.
APPEND wa_parms TO it_parms.

CALL METHOD lr_query_srv->set_query_parameters
EXPORTING
it_parameters = it_parms.


lr_result = lr_query_srv->get_query_result( ).

lr_entity ?= lr_result->get_first( ).


lr_entity_prod1 = lr_entity->create_related_entity( 'CrmPmeKbrtProductRel' ).

ls_prod_rel-kb_logsys = 'CRMCLNT100'.
ls_prod_rel-kb_name = 'PRODUCT_MODEL'.
ls_prod_rel-kb_version = '1.20'.
ls_prod_rel-class_name = '0000000000000000000000000000000005000234'." product
ls_prod_rel-class_type = 'SERV'.

lr_entity_prod1->set_properties( ls_prod_rel ).

lr_core->modify( ).
lr_transaction = lr_core->get_transaction( ).

IF lr_transaction->save( ) EQ abap_true.
lr_transaction->commit( ).
ENDIF.

IF rv_success = abap_true.
rv_success = lr_kb->unlock( ).
ENDIF.

It is going into SAVE objects method of Genil class, but it still not saving ..

thanks,ram

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Nov 17, 2016 at 02:27 PM

    Solved by myself.

    lr_entity_prod2 = lr_entity_prod1->create_related_entity( 'CrmPmeProductKbrtProfileRel' ).

    thanks,ram

    Add comment
    10|10000 characters needed characters exceeded