Skip to Content
0
Former Member
Jun 11, 2015 at 08:06 AM

Change configuration data in VA01/VA02

555 Views

Hello, everyone.

I have a task to alter position configuration data (the one that's shown in Extras - Configuration) when order is saved in VA01/VA02.

What I do is the following:

  1. Make use of USEREXIT_SAVE_DOCUMENT_PREPARE;
  2. Fetch current position configuration using CUCB_GET_CONFIGURATION FM and passing VBAP-CUOBJ for the INSTANCE parameter;
  3. Make necessary changes in the configuration;
  4. Make sure the OWNER field of the configuration is filled correctly: OBJECT_TYPE = 'VBPS', OBJECT_KEY = VBAP-VBELN && VBAP-POSNR;
  5. Save changes using CUCB_SET_CONFIGURATION.

The code seems to work fine for the existing positions. However, when a position is added, the configuration changes are not saved after saving the order. My guess is that CUCB_SET_CONFIGURATION needs position to exist already in the database.

So, the question is: are there any workaounds or other solutions?

I know, I can move all my code to a custom RFC-enabled FM and call it with a STARTING NEW TASK addition. The FM body will then wait until order is saved and update the configuration data. But RFC-call causes an implicit commit, which is apparently undesired inside a user-exit.

Thank you in advance.