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

Parallel Processing issue - Quotation is getting created on debugging & not on direct execution of program

Former Member
0 Likes
1,405

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

1 ACCEPTED SOLUTION
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,307

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

13 REPLIES 13
Read only

Lakshmipathi
SAP Champion
SAP Champion
0 Likes
1,307

Moved from SAP ERP SD Sales to ABAP Development.  Posted a technical query in functional forum and how you will get correct suggestions.  Please post your query in the relevant forum to get suitable suggestions. 

G. Lakshmipathi

Read only

Former Member
0 Likes
1,307

Hi

In programme are you COMMIT the transaction or not.Please check

   CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,309

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

Read only

0 Likes
1,307

Hi Nabheet,

Can you explain it...

Whether i need to add WAIT UNTIL in FORM get_data

Read only

former_member191728
Active Participant
0 Likes
1,307

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

Read only

0 Likes
1,307

I have added the commit after calling 'BAPI_QUOTATION_CREATEFROMDATA2'.

But still the document is not getting commited.

Read only

0 Likes
1,307

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

Read only

0 Likes
1,307

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.

Read only

0 Likes
1,307

Does wait until flag gets set after sucessful call...? Have you tried BAPI_TRANSACTION_COMMIT with wait option checked

Read only

0 Likes
1,307

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

Read only

0 Likes
1,307

Yes..the wait flag got set after sucessful call.

Even i am using BAPI_TRANSACTION_COMMIT with wait option

Any suggestion....

Read only

0 Likes
1,307

The BAPI_TRANSACTION_COMMIT is in your Z FM only if not make it there and check.

Otherwise we add a wait.

Nabheet

Read only

tolga_polat
Active Participant
0 Likes
1,307

This message was moderated.