‎2014 Nov 26 9:34 AM
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
‎2014 Nov 26 9:47 AM
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
‎2014 Nov 26 9:47 AM
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
‎2014 Nov 26 10:38 AM
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
‎2014 Nov 26 12:23 PM
‎2014 Nov 26 1:04 PM
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
‎2014 Nov 26 1:36 PM
‎2014 Nov 27 7:30 AM
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 2 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