Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

set property and save

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

Tags:
Former Member
replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question