cancel
Showing results for 
Search instead for 
Did you mean: 

Variant Configuration - Multible value characteristic

primoz13
Explorer
0 Kudos

Hello SAP Experts!

I am dealing with a multiple value characteristic and i would really be really grateful for any help.

Let´s take an example of CHAR multiple value characteristic with 5 possible values.

characteristic name: MACHINING

possible values: CUTTING, WELDING, THREAD M12, THREAD M16, THREAD M20.

Is there any possibility to make like this that user can choose just one of the THREAD versions. For example user can choose CUTTING, WELDING and THREAD M12. Or CUTTING, WELDING and THREAD M20. User can also choose just one of the THREADS without CUTTING or/and WELDING.

Thank you for your answers and suggestions

Have a nice day!

Primoz

Accepted Solutions (1)

Accepted Solutions (1)

Flavio
Active Contributor

Hello Primoz,

A possible solution could be to use a 'User defined function' that checks the values selected by the user, returning a message if more than one THREAD is chosen.

Here the example, just tried in my sandbox system:

This is reached, as said, with a 'User defined function', here the code:

FUNCTION z_check_machining.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(GLOBALS) LIKE  CUOV_00 STRUCTURE  CUOV_00
*"  TABLES
*"      QUERY STRUCTURE  CUOV_01
*"      MATCH STRUCTURE  CUOV_01
*"  EXCEPTIONS
*"      FAIL
*"      INTERNAL_ERROR
*"----------------------------------------------------------------------

  TYPE-POOLS: cudbt.
  DATA: w_instance  TYPE cudbt_instance,
        i_machining TYPE cudbt_vallist,
        l_val       TYPE cudbt_val,
        l_count     TYPE i.

  IF globals-self IS INITIAL.
    w_instance = 1.
  ELSE.
    w_instance = globals-self.
  ENDIF.

  CALL FUNCTION 'CUPR_GET_VALLIST'
    EXPORTING
      instance               = w_instance
      characteristic         = 'MACHINING'
    IMPORTING
      values                 = i_machining
    EXCEPTIONS
      unknown_instance       = 1
      unknown_characteristic = 2
      not_multivalued        = 3
      not_found              = 4
      internal_error         = 5
      OTHERS                 = 6.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  CLEAR l_count.
  LOOP AT i_machining INTO l_val.
    IF l_val-atwrt CS 'THREAD'.
      ADD 1 TO l_count.
    ENDIF.
  ENDLOOP.
  IF l_count > 1.
    MESSAGE i302(cx) WITH 'More than one THREAD value was selected.'.
  ENDIF.

ENDFUNCTION.

The function interface is just the MACHINING characteristic, as follows:

The function is called by a dependency (Procedure), as follows:

Code:

pfunction Z_CHECK_MACHINING (
                  MACHINING = $self.MACHINING
                                              ).

This dependency can either be added to the Configuration Profile, or to the characteristic itself.

Please check if this could satisfy your requirement. Feel free to ask in case of any doubt.

Many thanks and best regards,

Flavio

primoz13
Explorer
0 Kudos

Hello Flavio,

thank you for your answer and solutuion!

It works great!

I have only one more question:

I made everything like you do. Then i chose THREAD M12 and then THREAD M16 and the information box with the text appears. Till this point everything is perfect.

When i confirm "information box" and when box disappears both two options are chosen. This i would not like to have because user can still select all options of THREADS. Is there any possibility that only one option stays chosen.

Thank you for your answer!

Primoz


Flavio
Active Contributor
0 Kudos

Hello Primoz,

Thank you for your comment, I'm really happy that it works. 🙂

I think the easiest answer to your question could be to change the message type, in the function module, setting it to be an error.

For this, just replace the following line:

MESSAGE i302(cx) WITH 'More than one THREAD value was selected.'

with this

MESSAGE e302(cx) WITH 'More than one THREAD value was selected.'

that is, changed i302 (information) to e302 (error message).

Just tried in my sandbox:

the wrong selections (two times the THREAD value) will lead to an invalid configuration, forcing the user change it.

Do you think this could be a solution for your requirement?

Just let me know...

Many thanks again and best regards,

Flavio

Answers (2)

Answers (2)

keyur_mistry1
Active Participant

Sorry to interrupt on which is already answered.

I just want to say, this can be achieve through the Precondition on features value instead of taking use of "user define function".

On below image I have assign 3 Pre_Condition which will hide the value of other THREAD.

For value 003 take combination of other remaining values. (Here in this case 004 and 005)

For value 004 take combination of other remaining values. (Here in this case 003 and 005)

For value 005 take combination of other remaining values. (Here in this case 003 and 004)

Note: Do not use Specified Syntax.

primoz13
Explorer
0 Kudos

Hello Keyur Mistry,

Thank you for your reply. I tried also your solution and this is solution which i expected. I don't know what I was thinking. I thought that multi value characteristic do not allow preconditions. At the beginning i tried with a precondition but i had problems. (I used syntax without SELF.)

Thank you Keyur Mistry for your solution.

and many thanks to flavio ciotola for all replies and effort.

primoz13
Explorer
0 Kudos

Hello Flavio,

This solution is better than previous one. But still something is missing. I am wondering if FM (Z_CHECK_MACHINING) can have 100% influence on values which user select.

I will explain you on exact case. Like you i also have multiple value characteistic. The only difference is that my characteristic is structurated a bit different (subordinate values), but this has no influence on functioning:

pic-001.png

When I test functionality of your solution i found some troubles.

Firstly i choose M10x40 (everything OK). Then i click M12x40. Error messeage appears. That is also OK:

pic-002.png

Then i confirm the messeage with green check mark. When i come back to configurator both M10X40 are M12X40 selected. Configurator has also green status which is wrong:

pic-003.png

Do you maybe have any other solutions or ideas. Like i said at the beginning i suspect that there is no tool which has an influence on user choice. Tell me if i am wrong.

Just another thing. Every time when i am replying you i have problems with sending my answer. I also can not find a COMMENT button (i am not blind but i really don t have COMMENT BUTTON next to Answer button). All may answers are sent with a day or two delay with moderator involvement or help. As an experienced user of the community maybe you have some solution or answer for me.

Thank you for your kindness and help!

Have a nice day,

Primož

Flavio
Active Contributor
0 Kudos

Hello Primož,

What you are experiencing looks weird... I've tried with subordinate values too, and indeed the error doesn't allow me to choose a second value for thread:

I must clean the values and start again, without any double thread, otherwise the function continues throwing the error, not allowing me to proceed.

About the comment button and the moderator involvement, unfortunately I've no clue.

Thank you and best regards,

Flavio