cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting a value from a multi-value characteristic

former_member42743
Active Contributor
0 Kudos

None are set to start.

We have a multi-value characeristic, lets call it BKG_COLORS.  The choices are RED, YELLOW, BLUE, GREEN

We have another characteristic, lets say FORE_COLORS.  The choices are also RED, YELLOW, BLUE, GREEN as well

In the material master classification view we limit the choices for FORE_COLORS to RED and BLUE.

A batch of product is to be made and we select RED as the FORE_COLORS and BLUE and YELLOW as the BKG_COLORS.

A change is made.  A user goes in and selects BLUE for the FORE_COLORS instead of RED.  The system should now deslect BLUE as BKG_COLORS since it was picked as the FORE_COLORS.  We can't deselect YELLOW as a BKG_COLORS.

How can I deselect the color BLUE?

Vice versa, if my FORE_COLOR is BLUE, and I now go in an manually select BLUE for BKG_COLORS, I need BLUE deselected as my FORE_COLOR.

So typically I could set my colors using the command:

$SELF.BKG_COLORS = FORE_COLORS,    (Sets BKG_COLORS to same as FORE_COLORS)

But I need something like:

$SELF.BKG_COLORS <> FORE_COLORS,  (Select only those in BKG_COLORS that are not selected in FORE_COLORS.

But <> that isn't working.

I've gone through the help file but haven't seen anything that appears to do this.

Any ideas?

Craig

Accepted Solutions (1)

Accepted Solutions (1)

ravi_kumar204
Active Participant
0 Kudos

Dear Craig,

You can use constraints to achieve this functionality. Check the below link

Constraints: Restricting the Allowed Values - Variant Configuration (LO-VC) - SAP Library

Example code for the given condition.

(300)<CLASSNAME>.BKG_COLORS NE (300)<CLASSNAME>.FORE_COLORS

OR

You can write pre conditions to restrict allowed values of FORE_COLORS.

In both cases if users select wrong cstic value, inconsistency will be triggered. User needs to change values.

Regards,

Ravikumar B

former_member42743
Active Contributor
0 Kudos

Wouldn't restricition come into play in the begining?  I.e. once colors are assigned, and I change one or the other, will it update the existing one?

Also, the examples show a restriction to a list in another characteristic.  I'm looking to restricit to only those values NOT in the other characteristic.

I.e. the two characteristics should be set up in a way that their selected values are mutually exclusive of each other.  If it's selected in one, it has to be deselected in the other.

Craig

Ritz
Active Contributor
0 Kudos

Craig S,

Its a interesting topic , I can understand putting restriction on values for first time and it can easily achived through writing precondition and once 2 values for first characteristic is selected the another characteristic will have only 2 choices left to select. As suggested above Constraints suits to get it. done.If there is any inconsistence as per code system will not allow you to save till the time user set it up correctly.

The part i dont understand is why you have change requirement in this, why a user will go back again and will try to change a value for one characteristic and expect system to flip it in next characteristic , why not user make changes till the time its a consistent configuration.

It will be great , if you can explain business requirement too, for what product you need such setup of VC, and even if you achive this ( using a magic function ) now how you will handle it once there is a introduction of new value for these characteristic, I am sure in real it will not be just 2 characteristic and 4 values and what will be maintenance frequency to update this ?

Please reply, lets see how far we can help you.

Thanks

Ritesh

former_member42743
Active Contributor
0 Kudos

I tried to use color to simplify the requirement.  Guess I failed at that!!!

The real requirement is allowable countries.

A product, in particular pharmaceuticals can have many reasons why suddenly a batch is no longer valid  for a sepcific country, all though it normally is.  Or it can suddenly become valid for a country that it normally isn't, (like a new market approval comes through for a product,  previosuly manufactured batches in inventory can in some cases now be released for that new country)

We have SD batch determination checks that verifes that 1) the destination country is approved in "approved for" characteristic.  2) we also check that the country is not selected in "not approved for".

Only certain people can actually release a product to a country.  (i.e. regulatory).  But none-QA people are allowed to block a batch of material from going to country.  I.e. for an export block, customs issue, sudden new label requirements from a country, etc....

When a none QA person, blocks a batch from a country, we need the "good for country" characteristic to have that country deslected now.  Now to get that batch to that country, QA has to update the "Good for country" characteristic which should now go out and deselect that country in the "Not good for country".

i.e. the "good for country" and "not good for country" characteristics must always be mutually exclusive of each other.

We want to do it this way so that only QA has the ability to release a batch to a country, i.e. only QA can access the "good for country" characteriistic.  But other departments can block a batch to a country via access to "not good for country" characteristic.

This is not an uncommon requirement for pharma compaines and is very manually intensive at most places.

Craig

former_member42743
Active Contributor
0 Kudos

I tried to use the following in a procedure but I can't even get it past the syntax check.  Any idea what is wrong in the syntax?  I've gone through it a lot and researched the error messages to no avail.

$DEL_DEFAULT($SELF,COUNTRY_OK_FOR,$SELF.COUNTRY_NOT_OK_FOR)

I was using this for the SAP help files as guide.  I don't see anything I'm missing.

$DEL_DEFAULT ($SELF, <characteristic>, <string>)

example: $DEL_DEFAULT ($SELF, HEIGHT, 1.5 * $SELF.WIDTH)

Could it be the use of _ in my characteristics?  SAP warns about using - but not _

Craig

Ritz
Active Contributor
0 Kudos

Craig,

I tried to do a quick test for the conditions you explained with thought of.

If user change one charactertic & pick the value which is already set in another characterstic it could be clear using Del_Dafault, after too much struggle with syntax , finaly synta check work for below.

$DEL_DEFAULT ($SELF,ALL_CN,  'IN')if ($SELF.NALL_CN =  'IN').

copy paste it CU02 and change characterstic name and value, it will work.

But my test results were negative, its not deleting the value IN set for All_CN which is allowed country when i assign same value IN for NALL_CN which is not allowed characterstic.

reason could be default is not setup by system its a manual entered value and thats why couldnt get clear by DFEL_DEFAULT.

Thanks

Ritesh

former_member42743
Active Contributor
0 Kudos

So do you think I could meet this requirement by developing a variant FM and assigning that?

Craig

Ritz
Active Contributor
0 Kudos

Craig S,

Till now we were talking about using standard procedure to use DEL_DEFAULT to do so, but as i told you earlier DEL_DEFAULT deletes values defaulted by SET_DEFAULT, but doesnt work in case of manual assignment.

If you are thinking of creating a function to read a characterstic and change values for another characterstic , it will work.

I think you should also check on how constraints work for this scenario , possibly with inferance there may be an option to delete values, but not sure , need to check on it. Will try to do it during week end , and if it work will update here.

Also, please mark the replies helpful if it helps you.

Thanks

Ritesh

former_member42743
Active Contributor
0 Kudos

I'm  a moderator.. I always go back and mark helpful replies and close my discussions out.  🙂

Craig

Ritz
Active Contributor
0 Kudos

Craig S,


I'm  a moderator.. I always go back and mark helpful replies and close my discussions out.  🙂

That's nice to know .

I tried to do some hands on on the example you shared, and it seems its not advisable to delete or change a value manually setup by user, also when we see this examples practical use in real production environment , my suggestion is it should be controlled by process.

so the most suitable solution to control this would be sales order is created with required configuration, both the characteristic will be updated by respective departments, and save, when there is a change in any of those 2 characteristic, user from that department will go in configuration and change the value for characteristic his department is responsible for, if he picked the value which is used in another department characteristic an Inconsistence will be setup in configuration and user will get pop-up informing same. Once first user is done, second user need to perform changes at his end and once inconsistence is gone , configuration will be useful for further process.

you can use below syntax to write a constraint.

000010 OBJECTS:

000020 (300)RD

000030 Where Var1 = ALL_CN;Var2 = NALL_CN

000040 CONDITION:

000050 Var1 = Var2

000060 RESTRICTIONS:

000070 FALSE

Here RD is class of type 300, and ALL_CN is characteristic for allowed country , NALL_CN is characteristic for Not allowed country.

Check and reply.

Thanks

Ritesh

former_member42743
Active Contributor
0 Kudos

We decided to go with a FM to solve this.

Thanks!!!

Craig

Ritz
Active Contributor
0 Kudos

Thanks Craig S, For sharing your final decision as well as closing thread.

Ritesh

Answers (0)