2012 Mar 18 8:15 AM
Hi ,
I am having requirement as below ,
1 Read the shopping cart item ie ct_item
and Run all items and
2 Determine and note the product
categories-ID and process-ID of an item in an internal table.
3 If 1st item: continue,
otherwise: check, whether same product category
and process-ID are noted already. If no: is the combination of WGR_ID_ADD and
PROCID_ADD as per table ZSRM_WGR_SORTEN is allowed and If no: Display an error
message
I done coding as below , please check is it
correct and suggest if changes required,
METHOD check_category.
DATA: ls_item TYPE bbp_pds_sc_item_d,
ls_message TYPE bbp_smessages_badi,
lt_zsrm TYPE TABLE OF zsrm_wgr_sorten,
lt_item TYPE bbpt_pd_sc_item_d,
varcatid TYPE comt_category_id,
varprocind TYPE zprocind,
varnumint TYPE bbp_item_no.
SELECT * FROM zsrm_wgr_sortenINTO TABLE lt_zsrm
FOR ALL ENTRIES IN ct_item
WHERE wgrid_add =
ct_item-category_id AND
procid_add = ct_item-procind.
lt_item = ct_item.
SORT lt_item BY category_id
procind.
LOOP AT lt_item INTO ls_item WHERE del_ind =
space.
IF sy-tabix = 1.
varcatid = ls_item-category_id.
varprocind = ls_item-procind.
varnumint = ls_item-number_int.
CONTINUE.
ENDIF.
READ TABLE lt_zsrm WITH KEY wgrid_add
= varcatid
procid_add = varprocind BINARY SEARCH TRANSPORTING NOFIELDS.
IF sy-subrc = 0.
IF ls_item-category_id =
varcatid AND ls_item-procind = varprocind
.
ls_message-msgno = '002'.
ls_message-msgty = 'E'.
ls_message-msgid = 'ZSRM_SC'.
ls_message-msgv1 = ls_item-number_int.
ls_message-msgv2 = varnumint.
APPEND ls_message TO et_messages.
CLEAR ls_message.
CLEAR varcatid.
CLEAR varprocind.
CLEAR varnumint.
ENDIF.
ENDIF.
varcatid = ls_item-category_id.
varprocind = ls_item-procind.
varnumint = ls_item-number_int.
ENDLOOP.
ENDMETHOD
.
Many Thanks ,
Moderator message: multiple user IDs, same spec dumping before and after SCN migration, locked again and again, please stop it already.
Message was edited by: Thomas Zloch
Hi ,
I am having requirement as below ,
1 Read the shopping cart item ie ct_item
and Run all items and
2 Determine and note the product
categories-ID and process-ID of an item in an internal table.
3 If 1st item: continue,
otherwise: check, whether same product category
and process-ID are noted already. If no: is the combination of WGR_ID_ADD and
PROCID_ADD as per table ZSRM_WGR_SORTEN is allowed and If no: Display an error
message
I done coding as below , please check is it
correct and suggest if changes required,
METHOD check_category.
DATA: ls_item TYPE bbp_pds_sc_item_d,
ls_message TYPE bbp_smessages_badi,
lt_zsrm TYPE TABLE OF zsrm_wgr_sorten,
lt_item TYPE bbpt_pd_sc_item_d,
varcatid TYPE comt_category_id,
varprocind TYPE zprocind,
varnumint TYPE bbp_item_no.
SELECT * FROM zsrm_wgr_sortenINTO TABLE lt_zsrm
FOR ALL ENTRIES IN ct_item
WHERE wgrid_add =
ct_item-category_id AND
procid_add = ct_item-procind.
lt_item = ct_item.
SORT lt_item BY category_id
procind.
LOOP AT lt_item INTO ls_item WHERE del_ind =
space.
IF sy-tabix = 1.
varcatid = ls_item-category_id.
varprocind = ls_item-procind.
varnumint = ls_item-number_int.
CONTINUE.
ENDIF.
READ TABLE lt_zsrm WITH KEY wgrid_add
= varcatid
procid_add = varprocind BINARY SEARCH TRANSPORTING NOFIELDS.
IF sy-subrc = 0.
IF ls_item-category_id =
varcatid AND ls_item-procind = varprocind
.
ls_message-msgno = '002'.
ls_message-msgty = 'E'.
ls_message-msgid = 'ZSRM_SC'.
ls_message-msgv1 = ls_item-number_int.
ls_message-msgv2 = varnumint.
APPEND ls_message TO et_messages.
CLEAR ls_message.
CLEAR varcatid.
CLEAR varprocind.
CLEAR varnumint.
ENDIF.
ENDIF.
varcatid = ls_item-category_id.
varprocind = ls_item-procind.
varnumint = ls_item-number_int.
ENDLOOP.
ENDMETHOD
.
Many Thanks ,
Moderator message: multiple user IDs, same spec dumping before and after SCN migration, locked again and again, please stop it already.
Message was edited by: Thomas Zloch
2012 Mar 18 2:18 PM
Hi,
did you generate, activate and test it?
Come back with results.
Regards Clemens
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |