cancel
Showing results for 
Search instead for 
Did you mean: 

set property and save

Former Member
0 Kudos

Hello,

i want to add a value to an attribute in BTAdminH:

lr_core = cl_crm_bol_core=>get_instance( ).

  lr_cn = me->get_context_node( gc_cn_btorder ).

  IF lr_cn IS BOUND.
    lr_entity ?= lr_cn->collection_wrapper->get_current( ).
  ENDIF.



*Entität holen
  IF lr_entity IS BOUND.
    lr_bt_adminh = lr_entity->get_related_entity( iv_relation_name = 'BTOrderHeader' ).
  ENDIF.


 lr_bt_adminh->set_property( iv_attr_name = 'ZZORDERADM_H0701'
                                               iv_value = lv_aufnr ).

 lr_core->modify( ).

  DATA: tx TYPE REF TO if_bol_transaction_context.

  tx = lr_bt_adminh->get_transaction( ).
  IF tx->save( ) = abap_true.
    tx->commit( ).
  ELSE.
    tx->rollback( ).
  ENDIF.

The value is not set in ZZORDERADM_H0701 for some reason.

Could one of you experts please check why?

Thanks a lot

Best regards

Manfred

Edited by: ManniF on Apr 7, 2010 1:57 PM

Accepted Solutions (1)

Accepted Solutions (1)

arunprakash_karuppanan
Active Contributor
0 Kudos

Hi,

I'm not sure if the set_property will automatically request for a database lock. just add this block and check...


if lr_bt_adminh->lock( ) eq abap_true.
lr_bt_adminh->set_property( iv_attr_name = 'ZZORDERADM_H0701'
                                               iv_value = lv_aufnr ).
endif.

If this code works, then always lock the transaction before trying to modify it.

Regards,

Arun Prakash

Answers (0)