Skip to Content
0
Oct 19, 2011 at 07:27 PM

adding supplier text during runtime in SC

67 Views

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?