Skip to Content

Warning message of variant configuration

Hi, experts.

I have an issue with the function of variant configuration.

I would like to set a warning message when an inappropriate value is set in certain characteristic.

Is it possible ?

Best regards.

Takeshi

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • Best Answer
    Dec 19, 2016 at 11:00 AM

    Hi Takeshi,

    Yes, it is possible. We would need a 'User-Defined function', here the link to the documentation:

    User-Defined Functions

    This function is linked to an ABAP one, that will make use of the MESSAGE statement. Here a simple trial of how it should look like:

    The code is simply checking the value of characteristic 'TEST_1' and, if it is above 100, it will generate a warning, like this:

    Instead of a pop-up, by changing the message type to 'W', the message can appear in the screen bottom:

    I do hope this could be of aome help; feel free to ask me in case further details are needed.

    Thank you and best regards,

    Flavio

    Add comment
    10|10000 characters needed characters exceeded

    • Hi, Flavio.

      Would it be possible to elaborate what is required after creating a function module ?

      I created the same function module as your example, but I could not find what kind of object to match with.

      It might be functions and object dependence editor according to SAP Help portal.

      Is my recognition right ?

      I would appreciate if you kindly give me some advice.

      Best regards.

      Takeshi

  • Dec 20, 2016 at 07:38 AM

    Hi Takeshi,

    Yes, you are perfectly right, we need an object dependency (a procedure) to consume the user defined function.

    In my simple example above, I've used the following:

    • user defined function (CU67):


      It has the characteristic we want to check as input parameter, and a dummy characteristic as returning parameter (we don't actually use it in our process, but it must be part of the function interface; it is simply a flag, here).
      In the header, we refer to the ABAP fuction:

    • Object dependency: a procedure

      with the following code, consuming the CU67 function above:

    • The above dependency is then inserted in the configuration profile, so that it will be processed during configuration.

    Hope this is helpin in clarifyng the topic. If you need further info, just let me know.

    Thank you and best regards,

    Flavio

    Add comment
    10|10000 characters needed characters exceeded

    • Hi, Flavio.

      Thank you for your quick reply.

      I'm glad to tell you my attempt to implement a warning message in the function of variant configuration was achieved successfully.

      I owe everything to you.

      I greatly appreciate your taking the time and detailed explanation.

      Best regards.

      Takeshi

  • Dec 19, 2016 at 07:52 AM

    Takeshi,

    This is possible via development. You can write a function (SE37) which works according to your logic, and then assign this function yo your characteristic.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi, Kıvanç.

      Thank you for your quick reply.

      It appears to be impossible to make warning message pop up with standard functions but I can understand it is possible to achieve it with SE37.

      I would attempt to implement that.

      Thank you for your helpful answer.

      Best regards.

      Takeshi

  • Feb 18 at 09:36 PM

    Dear Flavio,


    I found your explanations very interesting.

    I am trying to find a solution, if we have 2 incompatible characteristics ( to be more specific 2 values of 2 characteristics are incompatible) and we choose them in the config model, I need a pop up message( via function) that says " These are incompatible".

    I would be grateful if you could help me.

    Thank you in advance,

    BR,

    Vasiliki Antoniou

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Vasiliki Antoniou,

      Here is a simple example, assuming the two characteristics being TEST_CHAR_01 and TEST_CHAR_02, and the incompatible set of values is 'B' for the first one and 2 for the second one.

      The function module (SE37) code is this:

      FUNCTION ztest_fcio.
      *"----------------------------------------------------------------------
      *"*"Local Interface:
      *"  IMPORTING
      *"     REFERENCE(GLOBALS) TYPE  CUOV_00
      *"  TABLES
      *"      QUERY STRUCTURE  CUOV_01
      *"      MATCH STRUCTURE  CUOV_01
      *"  EXCEPTIONS
      *"      FAIL
      *"      INTERNAL_ERROR
      *"----------------------------------------------------------------------
      
        TYPE-POOLS: cudbt.
        DATA: w_instance  TYPE cudbt_instance,
              lv_val      TYPE cudbt_val,
              lv_value01  TYPE atwrt,
              lv_value02  TYPE atflv,
              lv_text     TYPE string.
      
      * Initialise the instance number
        IF globals-self IS INITIAL.
          w_instance = 1.
        ELSE.
          w_instance = globals-self.
        ENDIF.
        REFRESH match.
      * Get first char value
        CALL FUNCTION 'CUPR_GET_VAL'
          EXPORTING
            instance       = w_instance
            characteristic = 'TEST_CHAR_01'
          IMPORTING
            val            = lv_val
          EXCEPTIONS
            not_found      = 01
            OTHERS         = 02.
        IF sy-subrc <> 0.
          RAISE internal_error.
        ELSE.
          lv_value01 = lv_val-atwrt.
        ENDIF.
      * Get second char value
        CALL FUNCTION 'CUPR_GET_VAL'
          EXPORTING
            instance       = w_instance
            characteristic = 'TEST_CHAR_02'
          IMPORTING
            val            = lv_val
          EXCEPTIONS
            not_found      = 01
            OTHERS         = 02.
        IF sy-subrc <> 0.
          RAISE internal_error.
        ELSE.
          lv_value02 = lv_val-atflv.
        ENDIF.
      
        IF lv_value01 = 'B' AND lv_value02 = 2.
          lv_text = 'These are incompatible'.
          MESSAGE lv_text TYPE 'I'.
        ENDIF.
      
      ENDFUNCTION.

      The function module is linked into a 'User defined function' (CU65).

      The 'User defined function' is called into an object dependency (a procedure, using the pfunction call)

      The procedure is inserted in the configuration profile.

      In simulation (CU50) the following result is obtained, when selecting 'B' as value for the first characteristic, and 2 as the value for the second characteristic:

      This is just a basic and simple example, that can be enhanced in accordance with your needs.

      Hope this could be of some help.

      Cheers,

      Flavio

      img0010.png (15.1 kB)
      img0011.png (5.8 kB)
      img0012.png (24.7 kB)
  • Feb 28 at 07:22 AM

    Hello Flavio,

    I tried this example, which is very explanatory, but it does not work. Maybe I have some problems with function module, something wrong in import - export parameters? I will try to do a debug.

    Thank you very much again!

    Best regards,

    Vasiliki Antoniou

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 05 at 06:44 PM

    Hi Vasiliki Antoniou,

    Hope you've found the reason why the example didn't work.

    The ABAP FM has a standardized interface (link).

    Do you have any error message?

    Just let me know if I could be of any help...

    Thanks and bye,

    Flavio

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 09 at 09:26 PM

    Dear Vasiliki Antoniou,

    If 2 parameters are incompatible, that should be handled in dependency procedure or using variant tables. I wonder why you are going ahead with CU67 FM in this case. That shows the dependency formula is failing and trying to cover up with FM, which is not desirable.

    The FM is used for many other purposes, as flavio has explained.

    Thanks

    Prem

    Add comment
    10|10000 characters needed characters exceeded