cancel
Showing results for 
Search instead for 
Did you mean: 

How to read the characteristics values(Runtime) before a purchase order /sales order is created

former_member557694
Discoverer
0 Kudos

Hello Experts,

We have a requirement where, in the variant function module i have to fetch the characteristics and their values before the purchase order/sales order/object is created. which means we need to fetch the run time characteristics values.

Inside the variant function module we are first fetching the instance number(CUOBJ) from the stack as the instance number was not available in any of the interface parameters of the variant function. Then using the method cl_cbase=>GET_CURRENT_CBASE_BY_INSTANCE we were fetching the characteristics details, but in case we are in the process of creation of a PO/sales order the instance number fetched from stack is having a number starting with 9999 which means it is a temporary instance, and in case of temporary instance the above method raises exception saying invalid instance.

So if you can help me read the characteristics values before the object is created will really be great.

Thanks,

Deepak

Accepted Solutions (0)

Answers (1)

Answers (1)

Flavio
Active Contributor
0 Kudos

Hi Deepak,

I can try to answer you about Sales Order creation (VA01 transaction), anyway I think it will almost be the same for Purchase Order.

To my knowledge, at Sales Order creation, the configuration object CUOBJ should be available and hence characteristic values should also be available.

Just try the following:

in the include MV45AFZZ, put a brek-point at, for instance, USEREXIT_PRICING_PREPARE_TKOMP.

Then, create a sales order (VA01), insert the material and enter the configuration.
The break point should activate immediately. It will be triggered again when exiting the configuration (that is, when characteristics have been given a value).
Check the content of the internal table VBAP, the field VBAP-CUOBJ should be available.
If it is the case, add your custom code to retrieve the configuration value, for instance using the FM CUCB_GET_CONFIGURATION.
Instance, in the FM parameters, is the VBAP-CUOBJ.

Characteristic values are within the FM configuration structure.

Hope this could be of some help.

Thanks and bye,

Flavio