Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How do we know if the Update function module is executed?

Former Member
0 Likes
2,586

Hi Experts,

I have a requirement of showing the corresponding purchase requisition number when we create the sales order. I have Created an Implicit enhancement at the end of the subroutine BELEG_SICHERN in the program SAPMV45A. This is the subroutine that shows the sales order number creation status message at the status bar. I am supposed to query the VBEP here to pull the Purchase Requisition No. However the problem is that the process of creating the Purchase requisition is an asynchronous process and it is done via an update function module ( ME_UPDATE_REQUISITION ). I am not always getting the corresponding purchase requisition number due to this. I have done a work around by adding a 1 sec delay. Just wanted to check if there is any other method to wait till the update function module is done with the PR creation so that I get the PR number always.

Thanks,

Ajith Cheruvally

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,767

You could wrap your code in a RFC enabled function, and CALL it IN BACKGROUND TASK, so it will be executed after the execution of high-priority update function modules.

Alternative 1 : The end of high-priority update FM will release the locks of the transaction, so a call to the relative ENQUEUE FM with WAIT option could also do the job (Better than a WAIT for 1 second).

Alternative 2 : If you only want to update some customer table, you could also create a low-priority ("VB2") update function module and CALL it IN UPDATE TASK.

Regards,

Raymond

6 REPLIES 6
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,768

You could wrap your code in a RFC enabled function, and CALL it IN BACKGROUND TASK, so it will be executed after the execution of high-priority update function modules.

Alternative 1 : The end of high-priority update FM will release the locks of the transaction, so a call to the relative ENQUEUE FM with WAIT option could also do the job (Better than a WAIT for 1 second).

Alternative 2 : If you only want to update some customer table, you could also create a low-priority ("VB2") update function module and CALL it IN UPDATE TASK.

Regards,

Raymond

Read only

0 Likes
1,767

Thanks for the quick reply Raymond,

The objective is to concatenate the the newly generated Purchase Requisition Number along with the sales order number and show at the VA01 status bar message. So, we need to be able to get the PR number before the VA01 screen displays the newly created sales order number.

I think I have to try the alternative 1 suggested by you.. not sure how to do it though .. any other thoughts?

Thanks in advance,

Ajith Cheruvally

Read only

0 Likes
1,767

A third alternative could be coded in an implicit enhancement at start of BELEG_SICHERN, just set us_syncro so COMMIT will be executed with a WAIT option. But don't forget to bypass buffer when reading database.

Also did you look for PR number in xvbep internal table ?

Regards,

Raymond

Read only

0 Likes
1,767

Thanks Raymond,

I will give a try.

Since you asked about the xvbep internal table, yes.. I had checked it and I am able to see the PR number there. But I was not sure whether to use it before the update is really committed.

Thanks again for your help on this.

Ajith Cheruvally

Read only

0 Likes
1,767

If the commit and wait does not raise an error (SM13) you can use the value of xvebp. And if the update task fails, then the order number too will be false too...

Regards,

Raymond

Read only

0 Likes
1,767

Thanks Raymond,

I am considering implement enhancement-section     beleg_sichern_21 spots es_sapmv45a because the us_syncro flag has been used in other parts of the program as well and we could avoid any conflicts. I will replace the code with just the addition of setting this flag in the beginning and then clearing it.

ENHANCEMENT ZEM_SHOW_PR_WITH_SO.    "inactive version

CONSTANTS : c_dcps_order  TYPE c LENGTH 4 VALUE 'ZPRT'" DCPS Order

IF vbak-auart = c_dcps_order. " The sales order being created is DCPS Order

   us_syncron = abap_true.

ENDIF.  

     if ( call_function = space or

          ( us_syncron = charx and

            call_activity ne gc_activity_lord ) ) or

        ( call_activity eq gc_activity_lord and

          gf_no_commit is initial ).

       if us_syncron = space.

         commit work.

       else.

         commit work and wait.

       endif.

     else.

       if call_activity ne gc_activity_lord.

*       Do not set these indicators if the LORD-API

*       saves w/o COMMIT

         g_no_init_config_data = charx.

         g_no_dequeue_sd_sales = charx.

       endif.

     endif.

IF vbak-auart = c_dcps_order. " The sales order being created is DCPS Order

  clear us_syncron.

ENDIF.   

ENDENHANCEMENT.

Do you think this is okay?

Thanks,

Ajith Cheruvally