on 12-19-2016 6:38 AM
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
Hi Takeshi,
Yes, it is possible. We would need a 'User-Defined function', here the link to the documentation:
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Flavio.
Thank you for your reply.
Your example is what I exactly would like to realize.
Unfortunately it would be unfeasible to accomplish it with standard functions, but I attempt to implement what you exemplified with screenshots.
Thank you for your detailed and helpful reply.
Best regards.
Takeshi
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
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:
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:
Hope this is helpin in clarifyng the topic. If you need further info, just let me know.
Thank you and best regards,
Flavio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes sure, the same approach can be applied here: the two characteristics can be in the function input, and their value combination can be checked for triggering the pop-up message.
Just let me know if you need any help with this, I can easily build a basic example, if you wish.
Many thanks and ciao,
Flavio
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
96 | |
10 | |
9 | |
5 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.