on 05-30-2007 11:47 AM
Hi,
we need to create a new custom field in the shopping cart item ( this is easy).
But we want to evaluate it using the BBP_DOC_CHANGE_BADI only for a default value. Is there a way to know if a user is creating or updating the shopping cart?
Please help me.
Thanks
Lara
Hi
<u>You can use the Business Add-Ins BBP_DOC_CHANGE_BADI to make changes to the document, after user entry and before saving the document to the database. These changes are subject to the document-specific checks.
The parameter FLT_VAL acts as a filter value that assigns the BAdI implementation to a particular document type. You can use the BAdI to change the following documents:
Shopping cart (filter value BUS2121 - shopping cart EC)</u>
<b>For BBP_DOC_CHECK_BADI - see the following Sample code</b>
method IF_EX_BBP_DOC_CHECK_BADI~BBP_DOC_CHECK .
DATA: ls_header TYPE bbp_pds_sc_header_d,
lt_item TYPE TABLE OF bbp_pds_sc_item_d,
ls_item TYPE bbp_pds_sc_item_d,
ls_message TYPE bbp_smessages_badi.
* example for checks only when orderering shopping cart
if iv_mode = 'T' OR " check shopping cart
iv_save = 'X'. " order shopping cart
* get items
CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
EXPORTING
i_guid = iv_doc_guid
i_with_itemdata = 'X'
IMPORTING
e_header = ls_header
TABLES
e_item = lt_item.
LOOP AT lt_item INTO ls_item
WHERE del_ind = SPACE.
* example message: warning if price is 0
IF ls_item-price IS INITIAL.
CLEAR ls_message.
ls_message-msgty = 'E'.
ls_message-msgid = 'BBP_PU'.
ls_message-msgno = '001'.
ls_message-msgv1 = 'Price is 0'.
ls_message-item_guid = ls_item-guid. "assign message to item
APPEND ls_message TO et_messages.
ENDIF.
ENDLOOP.
endif. " iv_mode / iv_save
* example for checks only when park shopping cart
if iv_mode = 'T' OR " check shopping cart
iv_park = 'X'. " park shopping cart
endif. " iv_mode / iv_park
endmethod.
<b>iv_mode filed here, contains the status of the shopping cart (created, changed, ordered, completed etc).</b>
Hope this will help.
Regards
- Atul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atul,
you are very brilliant!!!
Thanks a lot!!!
Lara
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If you need to check the value for the custom field whenever a user changes the SC,you can use the BADI's "BBP_DOC_CHANGE_BADI" or "BBP_DOC_CHECK_BADI".
In the CHECK badi,you can specifically trigger the BADI for CHANGE mode using the import parameter "IV_MODE"(C for Create,U for Change and S for Save )
BR,
Disha.
Pls reward points for useful answers.
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.