on 09-04-2007 5:05 PM
While creating a shopping cart I want to throw an error message if we give price equal to 0 ie. I want an validation whenever the price is given 0. the shopping cart shouldn't accept such a value. Kindly help
Hi,
Please use bbp_doc_check badi for bus2121
Kind regards,
Yann
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Yann,
I have already used Badi bbp_doc_check badi for bus2121. But it checks for the items already existing in the shopping cart where we can pass the GUID and do the validation. But my requirement is that when creating the item in the shopping cart the validation should be made and an error message should be shown. I mean no item should be created with price = 0. Kindly help.
Sateerth
Hi,
FM "BBP_PD_SC_GETDETAIL is used to get the details of SC. My requirement is that when I create a line item whrere price is 0 the error message should be displayed. can you please provide me a FM for this. I have already implemented BBP_DOC_CHECK_BADI in se19. I have to now write the method.
Hi,
In the method "bbp_sc_change" of the BADi,write the code in the foll way:
First Use the FM "BBP_PD_SC_GETDETAIL" to get the SC details for each line item.The item details will be in table "E_ITEM".
Then read each line item for whcih price is 0 and throw an error message
loop at et_item into wa_item_price where price eq 0.
Your Error Message.
endloop.
BR,
Disha.
Pls reward points for useful answers.
Hi,
That is all right . FM "BBP_PD_SC_GETDETAIL" to used to get the SC details for each line item. But what I want is that when I create a line item in the shopping cart at that time I want to throw an error message.I mean if the user enter price = 0 then the shopping cart shouldn't accept it. That means there should be no line item with price = 0 in the shopping cart.
Sateerth
Hi,
As explained earlier ,using the BADI "BBP_DOC_CHECK_BADI" only you can check/validate the data while creating the SC.So just pass the SC GUID to the FM and get the details for the Price field.If the price field is blank then throw the error message.
BR,
Disha.
<b>Pls reward points for useful answers.</b>
Hi Das,
For your better understanding, technically there is cart created as soon as you click the shop button but it is not complete (Shopping cart creation as you understand) until you order it..
If you would like to validate the shopping cart based on the price then use the logic explained by Disha. When you throw a hard error then the shopping cart cannot be ordered ( cannot be created).
So your problem of throwing an error on 0 price before the shopping cart is created is achieved.
Let me know if you have further questions..
Regards
Rakesh
Ps. Please close the thread if your question is answered..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi rakesh,
I am just sending you what I have done? Just let me know if i have done anything wrong?
method IF_EX_BBP_DOC_CHECK_BADI~BBP_DOC_CHECK.
DATA: wa_item TYPE BBP_PDS_SC_ITEM_D.
DATA: it_item TYPE STANDARD TABLE OF BBP_PDS_SC_ITEM_D.
DATA: it_error type standard table of BBP_SMESSAGES_BADI.
DATA: wa_error type BBP_SMESSAGES_BADI.
CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
EXPORTING
I_GUID = IV_DOC_GUID
I_OBJECT_ID =
I_ATTACH_WITH_DOC = ' '
I_WITH_ITEMDATA = 'X'
I_ITEM_SORTED_BY_HIERARCHY =
I_WITHOUT_HEADER_TOTALS =
I_READ_FROM_ARCHIVE = ' '
IMPORTING
E_HEADER =
EV_IS_PD =
ET_ATTACH =
TABLES
E_ITEM = IT_ITEM
E_ACCOUNT =
E_PARTNER =
E_CONFIRM =
E_LONGTEXT =
E_LIMIT =
E_ORGDATA =
E_TAX =
E_PRIDOC =
E_HCF =
E_ICF =
E_MESSAGES =
E_ACTVAL =
E_ACC_ACTVAL =
E_HEADER_REL =
E_ITMLIM_REL =
E_STATUS =
.
*LOOP at it_item into wa_item.
*IF wa_item-price = 0.
wa_error-message = text-001.
append wa_error to it_error.
*ENDIF.
*ENDLOOP.
*ET_MESSAGES[] = IT_ERROR[].
**ENDIF.
endmethod.
Hi,
Seems to be OK, but add to wa_error message type (E=error, S=success, I=info).
or
You can create a message class in transaction SE91 (for example ZMY_SC)
In this message class create message with number (for example: numer 001, message The price is zero!)
In your code write something like this:
LOOP at it_item into wa_item.
IF wa_item-price = 0.
call function 'BBP_PD_MSG_ADD'
exporting
i_msgty = 'E'
i_msgid = 'ZMY_SC'
i_msgno = 001
exceptions
log_not_found = 1
others = 2.
ENDIF.
ENDLOOP.
Regards,
Marcin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.