Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Automatically create subnode for root node (on Change?) in BOPF

SaschaW
Participant
0 Kudos

Hello BOPF-Experts,

i' m really new to BOPF and have a special question.

I want to create a subnote automatically when i chance a Value on the Root-Node Structure.

For example i have a root node with a field in the structure where i can enter a String(e.g. name).

After i have enterd that string the subnotes should automatically be created. (e.g. a subnode for each Businesspartner with that name and some more infos in the structure)

My idea was to create a determination for the root node (for update). In the Excecute Methode of the implemented class in try to create the subnode. But if i the business Object over BOBT ist dumps (after i changed the value in the root node).

In the dump description there aren't any helpful informations

"MESSAGE_TYPE_X"

"/BOBF/CL_FRW==================CP" bzw. /BOBF/CL_FRW==================CM013

"SET_APPLICATION_ERROR"

My Excecute method:

method /BOBF/IF_FRW_DETERMINATION~EXECUTE.

    "Alle passenden QUEUE Subnodes erstellen

     DATA lr_queue           TYPE REF TO zs_komb_queue.

         DATA(LO_SERVICE_MANAGER) = /BOBF/CL_TRA_SERV_MGR_FACTORY=>GET_SERVICE_MANAGER( zif_con_bupa=>sc_bo_key ).

    CREATE DATA lr_queue.

    lr_queue->key = lo_service_manager->get_new_key( ).

    lr_queue->root_key = is_ctx-root_node_key.

    io_modify->create(

      EXPORTING

      iv_node            = zif_con_bupa=>sc_node-adress

        iv_key             = lr_adress->key

*       iv_node_cat        =

*       is_data            = lr_adress

*        it_changed_fields  =

*       iv_assoc_key       = zif_con_bupa=>sc_association-mappe-bupa_to_adress

        iv_source_node_key = zif_con_bupa=>sc_node-bupa

        iv_source_key      = is_ctx-root_node_key

        iv_root_key        = is_ctx-root_node_key

*      IMPORTING

*        ev_key             =

    ).

   endmethod.

What should i consider for my requirement?

I know there are not so much infos, but if anybody knows how i can solve my prolem or have a better idea to solve my requirement.

Would be great

Thank you!

1 ACCEPTED SOLUTION

SaschaW
Participant
0 Kudos

Thanks all for helping.

I found the problem by myself.

My Root node was persistent and my item node was transistent.

If ic chanced the rood node to transistent also, it worked

4 REPLIES 4

ivo_vollrath
Active Participant
0 Kudos

Hi Sascha,

in many cases there should be some helpful information in the "Application Information" section of the ST22 dump.

When looking at your code I see that you do not provide iv_assoc_key. Filling this parameter (as well as iv_source_node and iv_source_key) is required in order to create an instance of a node which is not the ROOT. It will also be necessary to provide a valid reference to is_data.

Kind Regards,

Ivo

0 Kudos

Hi Ivo,

thanks for your reply.

Do i need an own association or can i take the "standard" item association?

So i tried with this association and the the dump is still the same.

iv_source_node_key and iv_source_key is aleready filled. In the debugger is see that the values of these fields are correct. (By the way, what is the difference between iv_source_node_key and iv_source_key?).


My Coding in the Excecute method looks like this:

      DATA lr_queue           TYPE REF TO zs_komb_adress. "Combined Structure

      DATA(LO_SERVICE_MANAGER) = /BOBF/CL_TRA_SERV_MGR_FACTORY=>GET_SERVICE_MANAGER( zif_con_bupa=>sc_bo_key ).

     CREATE DATA lr_queue.

     lr_adress->key = lo_service_manager->get_new_key( ).

     lr_adress->root_key = is_ctx-root_node_key.

     lr_adress->parent_key = is_ctx-root_node_key.

     lr_adress->street = "teststreet 1".

     io_modify->create(

       EXPORTING

         iv_node            = zif_con_bupa=>sc_node-queue

         iv_key             = lr_adress->key

*        iv_node_cat        =

         is_data            = lr_adress

*        it_changed_fields  =

         iv_assoc_key       = zif_con_bupa=>sc_association-root-item

         iv_source_node_key = zif_con_bupa=>sc_root-mappe

         iv_source_key      = is_ctx-root_node_key

         iv_root_key        = is_ctx-root_node_key

       IMPORTING

         ev_key             = DATA(l_res_key)

     ).

My Adress Node (Item/Subnode from Root) is a persistent node with only a persistent structure.

I ve no idea why it still dumps?

greetings

Sascha

0 Kudos

Hello Sascha,

you can use the standard association created for your subnode. As I understand from your coding your subnode is called 'queue'.

In this case I think you should have an association from your root node to the node 'queue'.

  iv_assoc_key       = zif_con_bupa=>sc_association-root-queue


If you renamed your root node you have to replace root by your name in the line above.


IV_SOURCE_NODE_KEY is the key of the source node of your design-model. This key is generated during design time and stored in the constant interface (sc_node).

IV_SOURCE_KEY is the key of your instance corresponding to the DB_KEY in the database table.


Did you manually change the constant interface? How did you get the sc_root entry? In my opinion the loc should look like this:

iv_source_node_key = zif_con_bupa=>sc_node-<parent_of_queue>

<parent_of_queue> is probably root in your example.



Best regards

Chris

SaschaW
Participant
0 Kudos

Thanks all for helping.

I found the problem by myself.

My Root node was persistent and my item node was transistent.

If ic chanced the rood node to transistent also, it worked