‎2010 Apr 16 10:36 AM
Dear Friends,
I am trying to set a validation rule using set.
The requirement is I have a set of Marketing G/L accounts and a set of Cost centres related to Marketing. Now if I post a transaction to any of Marketing G/L account and try to post entry to any cost centre OTHER THAN that in Marketing cost centre set, this validation should stop me. This will help me to prevent entries going to wrong cost centres.
I tried a lot in OB28. I am stuck up at how to put "check" in validation.
Can anybody help?
Thanks and Regards,
Chandrashekhar
‎2010 Apr 16 10:46 AM
Create a SET in GS01 T-Code.
Sample Code:
SELECT SINGLE * FROM setheader WHERE setname = 'ZCASH_EXPOSURE_ACCTS'.
IF sy-subrc = 0.
CONCATENATE setheader-setclass
setheader-subclass
setheader-setname
INTO v_setid.
CALL FUNCTION 'G_SET_TREE_IMPORT'
EXPORTING
client = sy-mandt
fieldname = 'HKONT'
setid = v_setid
tabname = 'BSIS'
TABLES
set_values = i_setvalues.
LOOP AT i_setvalues.
MOVE 'I' TO range_hkont-sign.
MOVE 'BT' TO range_hkont-option.
MOVE i_setvalues-from TO range_hkont-low.
MOVE i_setvalues-to TO range_hkont-high.
APPEND range_hkont.
ENDLOOP.
‎2010 Apr 16 10:54 AM
You have to use GGB0 & add the check in the prerequisite.
If you are using the callup point '0002' then you have the fields BSEG-HKONT (G/L account) & BSEG-KOSTL(Cost Center) which you can use in prerequisite.
@Manas: Did you understand the OP's question at all ?
Edited by: Suhas Saha on Apr 16, 2010 3:28 PM
‎2010 Apr 16 11:00 AM
Hi Suhas,
Thanks for your immediate reply.
Can you please tell me what check should i add in GGB0.
I tried using BSEG-KOSTL IN <set name> but the result is that I am not able to post to ANY cost centre...!!
Please help.
Thanks and Regards,
Chandrashekhar
‎2010 Apr 16 11:09 AM
if I post a transaction to any of Marketing G/L account and try to post entry to any cost centre OTHER THAN that in Marketing cost centre set, this validation should stop me.
In the prereuisite you should check:
BSEG-HKONT IN ZGL_SET "G/L Account in the GL Set
AND BSEG-KOSTL NOT IN ZCOST_CENTER "Cost Center is outside the Cost Center setBR,
Suhas
‎2010 Apr 16 11:17 AM
Hi Suhas,
I tried the same.
The message i am getting is "The formula was composed upto the first syntax error".
Any other way out?
Thanks and Regards,
Chandrashekhar
‎2010 Apr 16 11:19 AM
Take help of some functional consultant, they should be able to help you. The UI is a bit cranky, but you have to live with it
Suhas
‎2010 Apr 16 11:39 AM
Hi Suhas,
I am functional consultant.
I tried using a single value of cost centre in "check". It worked fine. But when I try to use a "set" of cost centre it is not working.
Is there any problem with the set itself?
Thanks and Regards,
Chandrashekhar
‎2010 Apr 16 11:48 AM
>
> I am functional consultant.
Oops sorry, my bad !!!
Does this work fine for the check on the GL a/c set ?
‎2010 Apr 16 11:52 AM
Hi Suhas,
It's ok.
Is there anything that I have to say "TRUE" or "FLASE" with regard to condition in "check" ?
Let me know.
Thanks and Regards,
Chandrashekhar
‎2010 Apr 16 12:01 PM
The prerequisite check always checks if the statement is true. If it is false the validation wont trigger.