on 10-19-2011 8:27 PM
Hi Experts,
I am doing an enhancement to add supplier text in describe requirement screen. When the item is added to the shopping cart I am doing enhancement at the end of the method in class /SAPSRM/CL_CH_WD_DODM_SC_I_DSC
method /SAPSRM/IF_CLL_DODM_SC_I_DESCR~ADD_DESCRIBED_ITEM_TO_TABLE to add the supplier text to shopping cart item.
There is a standard code in method /SAPSRM/IF_CLL_DODM_SC_I_DESCR~ADD_DESCRIBED_ITEM_TO_TABLE which adds the internal note to the item is like
* set Data to pdo-object
"prepare call
lo_pdo_sc ?= mo_pdo.
"call
TRY.
lo_pdo_sc->add_item( EXPORTING is_item = ls_pdo_item
iv_uname = sy-uname
iv_account_for_ess = iv_ess
IMPORTING es_return = ls_pdo_item_control
CHANGING co_message_handler = mo_pdo_message_consumer ).
* Add internal note as longtext
wd_main_node = mon_cll_set_facade->get_main_node( ).
wd_child_node = wd_main_node->get_child_node( name = 'INTERNAL_NOTE' ).
wd_child_node->get_attribute( EXPORTING name = 'INTERNAL_NOTE' IMPORTING value = lv_internal_note ).
TRY.
CALL METHOD lo_pdo_sc->/sapsrm/if_pdo_do_longtext~update_longtext
EXPORTING
iv_p_guid = ls_pdo_item_control-guid
iv_tdid = 'NOTE'
iv_tdspras = sy-langu
iv_tdformat = 'X'
iv_text_preview = lv_internal_note
* CHANGING
* EV_CHANGED = LV_CHANGED
* CO_MESSAGE_HANDLER =
.
CATCH /sapsrm/cx_pdo_abort INTO lx_pdo_abort.
mo_cll_message_handler->set_abort( io_pdo_abort_exception = lx_pdo_abort ).
ENDTRY.
* update
mo_pdo->submit_update( CHANGING co_message_handler = mo_pdo_message_consumer ).
* because view will be invalidated: clear the mapper reference from the bo_mapper
mo_parent_bo_mapper->deregister_mapper( io_mapper = me ).
* refresh whole application because e.g. Total value of sc has maybe changed.
* updates were performed a step before
mo_parent_bo_mapper->fire_event_refresh( iv_perform_updates = abap_false ).
* close window
lo_window_controller = mo_wd_view_controller->get_embedding_window_ctlr( ).
lo_window = lo_window_controller->get_window( ).
lo_window->close( ).
ev_close_window = abap_true.
I have done the similar code for updating the long text changing the tdid to HTXT but since I am not adding the item to the SC I have just implemented the update_longtext method. The text is being added to the buffer but not saved and reflected in SC.
I have implemented the following in the enhancement.
CALL METHOD lo_pdo_sc->/sapsrm/if_pdo_do_longtext~update_longtext
EXPORTING
iv_p_guid = ls_pdo_item_control-guid
iv_tdid = 'HTXT'
iv_tdspras = sy-langu
iv_tdformat = 'X'
iv_text_preview = lv_internal_note
* update
mo_pdo->submit_update( CHANGING co_message_handler = mo_pdo_message_consumer ).
What should I do to save the changed text?
Hello srinivas,
The longtext which your adding maybe getting cleared in standard.
Once try class /SAPSRM/CL_PDO_BO_SC method
/SAPSRM/IF_PDO_DO_LONGTEXT~UPDATE_LONGTEXT_BUFFER.
may be it will help you.
Regards,
Neelima
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Neelima,
The class and method you have mentioned is not called during the describe req. screen.
In the enhancement code I see the update not happening when submit_method is execute in the enhancement.
* update
mo_pdo->submit_update( CHANGING co_message_handler = mo_pdo_message_consumer ).
I believe the following method is causing the bo reference to be removed. Is there any other way to update the long text from describe requirement screen for supplier or regiester the object to make the update work.?
* because view will be invalidated: clear the mapper reference from the bo_mapper
mo_parent_bo_mapper->deregister_mapper( io_mapper = me ).
hello srinivas,
I am not sure about long text but i have updated PO item in run time.
Please find the code below may be it will be helpful for you.
Try the same for SC.
DATA: lo_bom_po TYPE REF TO /sapsrm/if_cll_bom_po,
lo_bo_po_adv TYPE REF TO /sapsrm/cl_pdo_bo_po_adv,
lo_pdo TYPE REF TO /sapsrm/if_pdo_base,
lo_task_factory TYPE REF TO /sapsrm/if_cll_taskcon_factory,
lo_task_container TYPE REF TO /sapsrm/if_cll_task_container.
DATA : lx_pdo_no_authorization TYPE REF TO /sapsrm/cx_pdo_no_authorizatio,
lx_pdo_wrong_mode TYPE REF TO /sapsrm/cx_pdo_wrong_mode,
lrcl_current_controller TYPE REF TO if_wd_controller,
lrcl_message_manager TYPE REF TO if_wd_message_manager.
lo_task_factory = /sapsrm/cl_ch_wd_taskcont_fact=>get_instance( ).
IF lo_task_factory IS NOT INITIAL.
lo_task_container = lo_task_factory->get_task_container( ).
IF lo_task_container IS NOT INITIAL.
lo_bom_po = lo_task_container->get_bom_po( ).
lo_pdo = lo_bom_po->/sapsrm/if_cll_bo_mapper~get_pdo( ).
lo_bo_po_adv ?= lo_pdo.
ENDIF.
ENDIF.
TRY.
CALL METHOD lo_bo_po_adv->/sapsrm/if_pdo_bo_po~update_item
EXPORTING
it_item = lt_pd_item.
CATCH /sapsrm/cx_pdo_no_authorizatio INTO lx_pdo_no_authorization .
RAISE EXCEPTION TYPE /sapsrm/cx_pdo_abort EXPORTING previous = lx_pdo_no_authorization.
CATCH /sapsrm/cx_pdo_wrong_mode INTO lx_pdo_wrong_mode .
RAISE EXCEPTION TYPE /sapsrm/cx_pdo_abort EXPORTING previous = lx_pdo_wrong_mode.
ENDTRY.
" don't forget to submit the changes
lo_pdo->submit_update( ).
Regards,
Neelima
Hi Neelima,
Thanks for the code, I can see that the similar to previous code in this also the statement lo_pdo->submit_update( ) is failing and not updating the data. Do i need to do any mapping with the class /SAPSRM/CL_CH_WD_DODM_SC_I_DSC during runtime?
During debug I found in the object lo_pdo as mentioned in your sample code and the standard object MO_PARENT_BO_MAPPER for the attribute MT_REGISTERED_MAPPER both are same except for an extra entry in the standard object MO_PARENT_BO_MAPPER. The entry is given below.
-> Hashed Table[2x1(8)] /SAPSRM/IF_CLL_DODM_SC_I_DESCR
Any idea as what needs to be done to add this entry in the enhancement?
I tried searching the forum but could not find any similar issue. Any links on this. thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.