on 01-10-2014 2:14 PM
Hi All,
I have to add toolbar button in the shopping cart item. when user click on the button
system should copy the Value from the First line Item where the Check Boxes are Enabled and paste the values to the corresponding fields of other Line Items, only if the Check Box is enabled in other Line Items.
I have added the button 'update', but i dont know how to update all the line items. becuse when there is a differnce between item button and details of the items.
Hi Ragavendrian,
Below code for updating the data for the shopping cart item level.
************************************************************************
DATA lo_nd_item_basic_data TYPE REF TO if_wd_context_node.
DATA lo_el_item_basic_data TYPE REF TO if_wd_context_element.
DATA ls_item_basic_data TYPE wd_this->element_item_basic_data.
DATA lt_item_guid_get TYPE bbpt_guid .
DATA ls_item_guid_get LIKE LINE OF lt_item_guid_get .
DATA lt_items_d TYPE bbpt_pd_sc_item_d .
DATA ls_items_d LIKE LINE OF lt_items_d .
DATA lt_items_u TYPE TABLE OF bbp_pds_sc_item_icu .
DATA wa_items_u LIKE LINE OF lt_items_u.
DATA lt_parent_guid TYPE bbpt_guid .
DATA ls_parent_guid LIKE LINE OF lt_parent_guid .
DATA lt_item_guid TYPE /sapsrm/t_pdo_hier_guid_list .
DATA ls_item_guid LIKE LINE OF lt_item_guid .
DATA: lo_bom_sc TYPE REF TO /sapsrm/if_cll_bom_sc,
lo_bo_sc_adv TYPE REF TO /sapsrm/cl_pdo_bo_sc_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.
wd_comp_controller->mo_bom_sc->/sapsrm/if_cll_bo_mapper~fire_event_update( ). " for update the event
wd_comp_controller->mo_bom_sc->/sapsrm/if_cll_bo_mapper~fire_event_refresh( iv_perform_updates = abap_false ). " to update the current screen data to the Buffer .
lo_nd_item_basic_data = wd_context->get_child_node( name = wd_this->wdctx_item_basic_data ).
lo_el_item_basic_data = lo_nd_item_basic_data->get_element( ).
lo_el_item_basic_data->get_static_attributes(
IMPORTING
static_attributes = ls_item_basic_data ). " to get the Structure of the Current line item
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_sc = lo_task_container->get_bom_sc( ).
lo_pdo = lo_bom_sc->/sapsrm/if_cll_bo_mapper~get_pdo( ).
lo_bo_sc_adv ?= lo_pdo. " to make the object of the class /sapsrm/cl_pdo_bo_sc_adv
ENDIF.
ENDIF.
Refresh lt_parent_guid.
CLEAR ls_parent_guid .
ls_parent_guid-guid = ls_item_basic_data-parent . " to pass the Header GUID to the LS_parent GUID
APPEND ls_parent_guid TO lt_parent_guid .
Refresh lt_item_guid .
CALL METHOD lo_bo_sc_adv->/sapsrm/if_pdo_base~get_item_list
EXPORTING
it_parent_guid = lt_parent_guid
IMPORTING
et_item_guid = lt_item_guid. " to get the ITEMs guid from the header GUID
refresh : lt_item_guid_get , lt_items_d , lt_items_u.
LOOP AT lt_item_guid INTO ls_item_guid .
ls_item_guid_get-guid = ls_item_guid-guid .
APPEND ls_item_guid_get TO lt_item_guid_get .
CLEAR ls_item_guid_get .
ENDLOOP .
TRY.
CALL METHOD lo_bo_sc_adv->/sapsrm/if_pdo_bo_sc~get_item_detail " to get the ITEMS detail by passing the ITEMS_GUID .
EXPORTING
it_item_guids = lt_item_guid_get
IMPORTING
et_item = lt_items_d.
CATCH /sapsrm/cx_pdo_abort .
ENDTRY.
LOOP AT lt_items_d INTO ls_items_d . " to pass the Changed item level to the internal table lt_items_u
MOVE-CORRESPONDING ls_items_d TO wa_items_u .
wa_items_u-zzdept_wmark = ls_item_basic_data-zzdept_wmark .
wa_items_u-zzcostctr_wmark = ls_item_basic_data-zzcostctr_wmark .
APPEND wa_items_u TO lt_items_u .
ENDLOOP .
TRY.
CALL METHOD lo_bo_sc_adv->/sapsrm/if_pdo_bo_sc~update_items " pass the changed item to the Method lt_items_u .
EXPORTING
it_item = lt_items_u.
CATCH /sapsrm/cx_pdo_wrong_mode .
CATCH /sapsrm/cx_pdo_no_authorizatio .
CATCH /sapsrm/cx_pdo_abort .
CATCH /sapsrm/cx_pdo_curr_error .
CATCH /sapsrm/cx_pdo_cat_not_allowed .
ENDTRY.
lo_bo_sc_adv->/sapsrm/if_pdo_base~submit_update( ).
wd_comp_controller->mo_bom_sc->/sapsrm/if_cll_bo_mapper~fire_event_refresh( iv_perform_updates = abap_true ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks nishant.bansal
it's realy helpful for me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.