2013 Nov 21 8:10 AM
Hi,
We are using parallel processing ie CALL FUNCTION 'Z_FUNCTION'
STARTING NEW TASK taskname
DESTINATION 'NONE'
PERFORMING get_data_quot ON END OF TASK in our program.
FORM get_data_quot USING lv_taskname.
RECEIVE RESULTS FROM FUNCTION 'BAPI_QUOTATION_CREATEFROMDATA2'
IMPORTING
salesdocument = v_vbeln
TABLES
return = it_return.
ENDFORM. " GET_DATA_QUOT
In Z_FUNCTION we called 'BAPI_QUOTATION_CREATEFROMDATA2' .
The issue we are facing is that the Quotation is getting created on Debugging mode
but on direct execution it is showing No document created.
Kindly advise me to fix the issue.
Thanks,
Vinodha.R
2013 Nov 21 9:50 AM
Hi Vinodha
Please add the wait until GV_FLAG is X and this flag GV_FLAG is set in
FORM get_data_quot USING lv_taskname..
The reason for this wait is as it is running in parallel so it may happen our process goes on and document is still not created.
Nabheet
2013 Nov 21 9:45 AM
2013 Nov 21 9:49 AM
Hi
In programme are you COMMIT the transaction or not.Please check
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
2013 Nov 21 9:50 AM
Hi Vinodha
Please add the wait until GV_FLAG is X and this flag GV_FLAG is set in
FORM get_data_quot USING lv_taskname..
The reason for this wait is as it is running in parallel so it may happen our process goes on and document is still not created.
Nabheet
2013 Nov 21 10:11 AM
Hi Nabheet,
Can you explain it...
Whether i need to add WAIT UNTIL in FORM get_data
2013 Nov 21 9:54 AM
Hi Vinodha
try writing commit statement after calling
'BAPI_QUOTATION_CREATEFROMDATA2'
sometimes the document will not be created if commit statement is not present
Thanks
Pawan Akella
2013 Nov 21 10:07 AM
I have added the commit after calling 'BAPI_QUOTATION_CREATEFROMDATA2'.
But still the document is not getting commited.
2013 Nov 21 10:12 AM
Vinodha
Please understand that this FM is called in a new LUW. Just do these two things One is commit which you have done. Second is
After the call of BAPI put a wait until GV_FLAG = 'X'---> Global data accessible in all.Then set this flag in subroutine
CALL FUNCTION 'Z_FUNCTION'
STARTING NEW TASK taskname
DESTINATION 'NONE'
PERFORMING get_data_quot ON END OF TASK in our program.
wait until gv_flag ne 'X'.---> It signifies the BAPI has executed.
FORM get_data_quot USING lv_taskname.
RECEIVE RESULTS FROM FUNCTION 'BAPI_QUOTATION_CREATEFROMDATA2'
IMPORTING
salesdocument = v_vbeln
TABLES
return = it_return.
gv_flag = 'X'
ENDFORM. " GET_DATA_QUOT
2013 Nov 21 11:01 AM
Thanks Nabheet...It is working but only if i add WAIT UP TO 2 seconds.
Whether we need to have that WAIT to commit in database.
2013 Nov 21 11:45 AM
Does wait until flag gets set after sucessful call...? Have you tried BAPI_TRANSACTION_COMMIT with wait option checked
2013 Nov 21 12:05 PM
Check with below Code ...
FORM get_data_quot USING lv_taskname.
RECEIVE RESULTS FROM FUNCTION 'BAPI_QUOTATION_CREATEFROMDATA2'
IMPORTING
salesdocument = v_vbeln
TABLES
return = it_return.
IF v_vbeln IS NOT INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.
gv_flag = 'X'
ENDFORM. " GET_DATA_QUOT
Regard's
Smruti
2013 Nov 21 12:28 PM
Yes..the wait flag got set after sucessful call.
Even i am using BAPI_TRANSACTION_COMMIT with wait option
Any suggestion....
2013 Nov 21 12:31 PM
The BAPI_TRANSACTION_COMMIT is in your Z FM only if not make it there and check.
Otherwise we add a wait.
Nabheet
2013 Nov 21 12:45 PM