Skip to Content
0

Variant Configuration - Multiple elements set in dependency procedure

Jan 12, 2017 at 01:51 PM

213

avatar image

Hi,

These are characteristics set manually in Sales Order. Characteristic can occurs multiple times and corresponds to SD Price.

How to achieve the same result in dependency type procedure ? It's easy to assign one value like $self.<characteristic> = <value>. But how to assign multiple values ?

Thanks and regards,

Maciej

sdprice.jpg (14.2 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Ritesh Dube Jan 18, 2017 at 02:06 PM
2

Maciej Jarecki,

1) Have you tried using procedure with more then one line syntax.

$SELF.SD_PRICE = 'EDG' IF CHAR1 = 'EDG',

$SELF.SD_PRICE = 'NDG' IF CHAR1 = 'NDG',

$SELF.SD_PRICE = 'LTE' IF CHAR1 = 'LTE',

$SELF.SD_PRICE = 'LTEP' IF CHAR1 = 'LTEP'.

2) If the pricing characteristic is multiple value , instead of using procedure to assign value you can use variant table to map characteristic values with pricing condition value. It will work.

Try it out i am sure it will work for you.

Thanks

Ritesh


edg.jpg (5.7 kB)
Share
10 |10000 characters needed characters left characters exceeded
flavio ciotola Jan 15, 2017 at 09:24 AM
0

Hi Maciej,

A possible solution is to use a variant (user-defined) function that will infer the values for the characteristic, thanks to the FM 'CUPR_SET_VAL'. Here an excerpt from the FM documentation:

I've just implemented a quick trial in my sandbox system, here the steps I followed:

  1. Creation of the user-defined function (CU67)
    Its interface, as we cannot directly use multiple-value characteristics here, will just list a dummy and a flag characteristic:



    The code for it will be something like this:

    FUNCTION ZTEST_FLAVIO.
    *"----------------------------------------------------------------------
    *"*"Local Interface:
    *"  IMPORTING
    *"     REFERENCE(GLOBALS) TYPE  CUOV_00
    *"  TABLES
    *"      MATCH STRUCTURE  CUOV_01
    *"      QUERY STRUCTURE  CUOV_01
    *"  EXCEPTIONS
    *"      FAIL
    *"      INTERNAL_ERROR
    *"----------------------------------------------------------------------
    
      DATA: w_instance  TYPE cudbt_instance,
            i_val       TYPE cudbt_vallist,
            l_val       TYPE cudbt_val.
    
      IF globals-self IS INITIAL.
        w_instance = 1.
      ELSE.
        w_instance = globals-self.
      ENDIF.
    
      l_val-atwrt = 'EDG'.
      APPEND l_val TO i_val.
    
      l_val-atwrt = 'NDG'.
      APPEND l_val TO i_val.
    
      l_val-atwrt = 'LTE'.
      APPEND l_val TO i_val.
    
      l_val-atwrt = 'LTEP'.
      APPEND l_val TO i_val.
    
      LOOP AT i_val INTO l_val.
    
        CALL FUNCTION 'CUPR_SET_VAL'
          EXPORTING
            instance               = w_instance
            characteristic         = 'SD_PRICE'
            val                    = l_val
          EXCEPTIONS
            unknown_instance       = 1
            unknown_characteristic = 2
            internal_error         = 3
            OTHERS                 = 4.
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDLOOP.
    
    ENDFUNCTION.
  2. Creation of an object dependency (Procedure) that will consume the above function.
    Here the code:

  3. This object dependency shall be allocated either to the configuration profile, or to the characteristic itself.
    I've chosen this latter option:

  4. Now, we can try simulating the characteristic value inference, in CU50:

  5. Looks good, and if we check the inference for any value, we will see it's coming from the dependency / variant function:

I do hope this will help in solving your issue.

If you need any further detail, just feel free to ask.

Thanks and ciao,

Flavio


img-153.png (14.2 kB)
img-154.png (8.9 kB)
img-155.png (7.5 kB)
img-156.png (8.3 kB)
img-157.png (26.1 kB)
img-158.png (7.5 kB)
Share
10 |10000 characters needed characters left characters exceeded
fabien maupin Feb 15, 2017 at 11:55 AM
0


The simple syntax bellow does this multiple assignment of values in standard :

*----------------------------------------------------------------------*
* VC ERROR MANAGEMENT                                                  *
*----------------------------------------------------------------------*
* Change History
*FMA-170215- Test Multiple value assignment                   Creation
*----------------------------------------------------------------------*
$self.XX_INF_ERROR = 'VAL 1',
$self.XX_INF_ERROR = 'VAL 2',
$self.XX_INF_ERROR = 'VAL 3'

Result :

The Char XX_INF_ERROR must be declared as Multiple value allowed in CT04.

THE SAP STANDARD WAY IS ALWAYS THE BEST.


Share
10 |10000 characters needed characters left characters exceeded