Skip to Content
avatar image
Former Member

Problem updating new values to a node in runtime in BOBF

Hi all,

I was trying to implement a determination for a node : 'QUANTITY',

by obtaining the values from the node 'OBJECT_REFERENCE'.

I retrieved the values of 'object_reference' node by 'retrieve_by_association'

now I need to update the 'QUANTITY' node.

It fails as no values are currently existing for the node : QUANTITY.

So, I think I need to use the method io_read~create() to make this happen.

Please give me advice, provide a sample snippet of create(), or a correct update() call if possible.

Eagerly waiting for you experts

This is the code snippet I have been using;

    io_read->retrieve_by_association(
    EXPORTING
      iv_node                 = /iam/if_i_issue_c=>sc_node-root
      it_key                  = it_key                                        
      iv_association          =  /iam/if_i_issue_c=>sc_association-root-objref
      iv_fill_data            = abap_true
      is_parameters           = lr_objref_parameter
    IMPORTING
      et_data                 = li_objref    ""---> HERE i HAVE THE OBJECT REFERENCE DETAILS
      et_failed_key           = et_failed_key
*    et_key_link             = lt_trq_cfir_link
  ).


*
*
*CALCULATIONS AND CALLS FOR DATA MANIPULATIONS
*
*


**GET THE QUANTITY NODE DETAILS
    CALL METHOD io_read->retrieve_by_association
      EXPORTING
        iv_node        = /iam/if_i_issue_c=>sc_node-root "
        it_key         = it_key 
        iv_association = /iam/if_i_issue_c=>sc_association-root-quantity " Association
        iv_fill_data   = abap_true    " Data element for domain BOOLE: TRUE (='X') and FALSE (=' ')
      IMPORTING
*       eo_message     = lo_message   " Interface of Message Object
        et_failed_key  = et_failed_key
        et_data        = li_quantity
*       et_target_key  = lt_target_key.
      .




* Read Attachment Record


""HERE LI_QUANTITY IS INITIAL, AS THERE IS NO DATA EXISTING FOR THESE NODES.


    LOOP AT li_quantity ASSIGNING FIELD-SYMBOL(<ls_quantity>).
      APPEND INITIAL LINE TO li_changed_fields ASSIGNING FIELD-SYMBOL(<ls_changed_fields>).
      <ls_changed_fields> = 'QUANTITY'.


**      APPEND INITIAL LINE TO lt_changed_fields ASSIGNING <ls_changed_fields>.
**      <ls_changed_fields> = 'YYUPL_TIME'.


      GET REFERENCE OF <ls_quantity> INTO lref_quantity.
      lref_quantity->quantity = '148.056'."sy-datum.
*      lref_quantity->yyupl_time = sy-uzeit.


      io_modify->update( EXPORTING iv_node           =  is_ctx-node_key
                                   iv_key            = <ls_quantity>-key
                                   iv_root_key       = <ls_quantity>-root_key
                                   is_data           =  lref_quantity
                                   it_changed_fields =  li_changed_fields  ).




    ENDLOOP.



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Mar 30, 2017 at 09:34 AM

    Hi Nadeem,

    so, your determination is defined at the ROOT node. It shall read by association (RBA) from node OBJREF and write to QUANTITY? (This is what I understand from your code - though OBJREF does not seem to be used at all.)

    If you want to create an instance of a non-ROOT node, you have to specify the parent node and key, and the association you want to use for creation. So, you would do something like this:

    io_modify->create(
      iv_source_node_key = is_ctx-node_key  "or /iam/if_i_issue_c=>sc_node-root
      iv_source_key      = lv_key           "probably a row from it_key
      iv_assoc_key       = /iam/if_i_issue_c=>sc_association-root-quantity
      iv_node            = /iam/if_i_issue_c=>sc_node-quantity
      is_data            = lref_quantity
    ).

    I am not sure if this matches your requirements because I am not sure if I correctly interpret the intend of your code snippet.

    Kind Regards,

    Ivo

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 05, 2017 at 10:42 AM

    The iv_source_key is required when creating a subnode instance. It has to be filled with the upper node key (e.g. parent node). Same for iv_source_node_key which is filled with the node-key of this node.

    Add comment
    10|10000 characters needed characters exceeded

  • May 15, 2017 at 10:42 AM

    iv_root_key must be an _instance_ key - node a node key. You do not have to provide iv_root_key at all. BOPF will fill it for you. By providing it, you can slightly improve performance in some situations. The drawback is that BOPF does not check it. If you set the wrong root_key, the instance is not properly attached to its parent and will be lost in space.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 04, 2017 at 08:56 AM
    lot of Thanks Ivo!!

    Yes, I am trying to get the values from the objref node to quantity node.

    Here; there are no entries in the quantity node.

    So, I need to create isn't it?!

    But what about the parameter : iv_source_key = lv_key
    I think We need to create a new key using the belw method;

    Still it didn't work. Do I have to use do_modify(), or anything else?! no return message or exception were there. But the 'Quantity' node was not updated.

    /bobf/if_tra_service_manager-get_new_key( ).
    Add comment
    10|10000 characters needed characters exceeded