Skip to Content
0
Jul 17, 2015 at 12:52 PM

custom BO : Insert additonal only in item node.

70 Views

In a custom BO, we have header node and item (status) node (relationship 1-n). For the first time, While inserting data i fill both header and item node and able to populate data correctly.

Now, My requirement is to add only items (status) and while doing so i am getting an error. Please find the below code. Any suggestion/document will help . Thanks.

CREATE DATA lref_status.

lref_status->key = /bobf/cl_frw_factory=>get_new_key( ).

lref_status->rdoc = ls_header-rdoc.

lref_status->st_date = sy-datum.

lref_status->st_time = sy-uzeit.

lref_status->status = '02'.

lref_status->message = 'Status record updated'.

ls_mod-node = zif_bopf_ief_c=>sc_node-ief_status.

ls_mod-change_mode = /bobf/if_frw_c=>sc_modify_create.

ls_mod-source_node = zif_bopf_ief_c=>sc_node-ief_header.

ls_mod-source_key = ls_header-key.

ls_mod-key = lref_status->key .

ls_mod-data = lref_status.

APPEND ls_mod TO lt_mod.

CLEAR : ls_mod , lref_status .

TRY.

CREATE OBJECT lo_driver.

CALL METHOD lo_driver->mo_svc_mngr->modify

EXPORTING

it_modification = lt_mod

IMPORTING

eo_change = lref_change

eo_message = lref_message.

"Check for errors:

IF lref_message IS BOUND.

IF lref_message->check( ) EQ abap_true.

lo_driver->display_messages( lref_message ).

RETURN.

ENDIF.

ENDIF.

"Apply the transactional changes:

CALL METHOD lo_driver->mo_txn_mngr->save

IMPORTING

eo_message = lref_message

ev_rejected = lv_rejected.

IF lv_rejected EQ abap_true.

lo_driver->display_messages( lref_message ).

RETURN.

ENDIF.

CATCH /bobf/cx_frw INTO lx_bopf_ex.

lv_err_msg = lx_bopf_ex->get_text( ).

WRITE :/ lv_err_msg.

ENDTRY.

Error :

Category ABAP Programming Error

Runtime Errors DATREF_NOT_ASSIGNED

ABAP Program /BOBF/CL_FRW==================CP

Application Component AP-RC-BOF-RNT

Date and Time 17.07.2015 08:41:26

254 READ TABLE lt_new_node

255 WITH KEY node = <ls_mod>-source_node

256 key = <ls_mod>-source_key

257 TRANSPORTING NO FIELDS.

>>>>> IF sy-subrc <> 0 AND