on 03-20-2012 11:25 AM
Hello experts,
I am looking for an expression to check if an item exists from a Catalog entry in shopping cart.
There is standard expression to check An item exists from a free entry (0V_SC_XSTFRTXTLNTM).
I want to execute similar expression fro catalog. I want to check for catalog.
If an item exists from a Catalog in SC.
Please advise/suggest. Thank you.
Hello Experts,
Has anyone worked on the similar condition ?
I want to check if catalog item exists in SC or not. To achieve this I need to write 2 expressions.
1. one function module expression that returns catalogid which is (mdm catalog 3.0) in our example.
Therefore I created Z function module expression.. Copied the FM '/SAPSRM/WF_BRF_0EXP001' into 'Z. I later called FM 'BBP_PD_SC_GETDETAIL' get the item details and header details.
data line_item type c.
CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
EXPORTING
I_GUID = lv_document_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 = IT_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-CATALOGID = 'MDM Catalog 3.0'.
line_item = 'X'.
else.
line_item = ''.
endif.
ENDLOOP.
if line_item = 'X'.
* ev_value = 'MDM Catalog 3.0'.
* TRANSLATE ev_value TO UPPER CASE.
ev_value = 'X'.
else.
ev_value = ''.
endif.
2. second one of boolean type with the condition overall value >=501 AND (catalogid is mdm or not)
Overall value >= 501 AND ( an item exists from Catalog = 'X' )
But at portal, I do get systm's auto approval. It should not be the case. Has anyone tried to work on similar condition? Please advise/suggest where i need to change/add any code.
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey,
Abhijit Kamatkar wrote:
I have tried to do so by creating z class of /sapsrm/CL_WF_RULE_CONTEXT. But that is not great idea. If you know please share.
I think it is a good idea to copy such a class, however, copy /SAPSRM/CL_WF_RULE_CONTXT_SC to ZCL_WF_RULE_CONTXT_SC.
In this class define your own public instance method to retrieve the catalogid, make a copy of the existing method /SAPSRM/IF_WF_RULE_CONTXT_SC~CONTAINS_ACCOUNT_ASSIGNMENT for the parameter interface (also you can use some of the contents of that method), call this CONTAINS_CATALOG for example. This method should return a boolean value if the catalogid is available or not (basically the coding you created).
In BRF create 3 new constant expressions:
With the above constants build a new expression ZEX_CONTAINS_CAT that looks the same as the standard 0B_SC_ACCTASSCAT_AS.
Finally create a new expression of type 0FB001 (ZEX_CHECK_SC or a more suitable name!) with return type boolean. In the formula wizard enter the expression ZEX_CONTAINS_CAT AND ( total value >= '501' ).
To square things up - to trigger the process level enter the ZEX_CHECK_SC in the evaluation id of the process level.
In the code you posted above there is a small coding issue: if there are 2 items in the shopping cart and the first comes from MDM and the second is a free text the code will return false. To prevent this EXIT the loop when you find the correct catalogid.
Regards,
Robin
Robin,
THank you very much for your reply. I said using /sapsrm/CL_WF_RULE_CONTEXT is not great idea because I have already tried it using zcl_wf_rule_contxt_sc.only difference is instead of using 0B_SC_ACCTASSCAT_AS, I used (0V_SC_XSTFRTXTLNTM). Problem remained the same. Approval is going for auto approval. As a catalogid constant i am taking MDM CATALOG 3.0 (with spaces ...referred table BBP_PDIGP )for ZC_C3_C_CATLOG. Is there anything wrong there ? Because in debugging I clearly sees ev_value = 'X'. It clearly means that flag is set once when catalogid = MDM Catalog 3.0.
Please share your experience. Thank you for your help.
Best regards.
Hi,
The only standard delivery expression that we have for SC item catalog is:
Determination of the catalog ID (if the same for all items)
0V_SC_CATALOGID Char
Description:
Determination of the catalog ID of all line items relevant for the current approval step. For item-based approval only items to be approved are considered. The catalog ID is only returned if it is unique for all items; otherwise the result variable is initial.
Thanks,
Melina
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Melina thank you very much for your reply. I will try with this standard expression. I have not understood these ex[ressions entirely. My following question might be out of box or irrelevant but if i decide to create my own z expression like (0V_SC_XSTFRTXTLNTM------An item exists from a free entry) for catalog; is it possible to do so or it would be a wrong idea ? If yes, how would I find SC guid ? Right now I know that
CALL METHOD lo_context_provider->get_document will give me GUID. But if I want to know other details like where these results are stored ? I know that ev_value contains result but for (0V_SC_XSTFRTXTLNTM--- An item exists from a free entry) there must be some mechanism that tells to the expression that this item is from freetext. Where these details are stored ? Which variables ? I have tried to do so by creating z class of /sapsrm/CL_WF_RULE_CONTEXT. But that is not great idea. If you know please share.
Thank you.
Best regards.
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.