Skip to Content
avatar image
Former Member

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Apr 07, 2010 at 12:15 PM

    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

    Add comment
    10|10000 characters needed characters exceeded