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

Commit work needed after CALL TRANSACTION

Former Member
0 Likes
9,078

Hi,

I have a program where I am creating a sales order using call transaction.

And after the call transaction, i am using a select statement to select the newly created sales order for validation purpose.

Before using this select statement do i need to use the COMMIT STATEMENT. Please suggest.

Thanks and Regards,

Phani kumar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,985

Hi,

After call transaction va01

use the following code instead of select statement to get the newly created sales order.

if sy-subrc = 0.

GET PARAMETER ID 'AUN' FIELD w_new_sales_order_no.

endif.

w_new_sales_order_no will give you the newly created sales order no.

Regards,

Usha.

10 REPLIES 10
Read only

Former Member
0 Likes
3,985

Hello Phani,

As per my understanding, you should not be needing COMMIT WORK after a Call transaction.

However, u should make the system wait for 1-2 seconds before to select the data from DB. This is because sometimes, the DB updates and Lock release mechanism takes some time and in the meantime, your select will not return you any data.

Hope this helps.

Regards,

Himanshu

Read only

former_member188827
Active Contributor
0 Likes
3,985

if you are using BDC recording,you dont need to use "commit Work".

Read only

Former Member
0 Likes
3,985

Hi ,

Problem in ur case can be commit work is executed and immediately select will try to fetch the newly created data but that time cannot gurantee you that the newly created sales orders are present after commit work into table VBAK.

In call transaction the drawback is we cannot dont have a seesion log .

In Session method u can try this ..

Session log is generated after the processing

A code needs to be written fetching hte QID by passing session name

Now whether this session is processed (s) or error (E) or not at all run needs to be identified based on qstate of that field for that QID .

Use a while statement to check the status of the QID .

Table APQI

QID

QSTATE

If Qstate is S then it is processed => ur database is loaded with values .

So your program will sleep for some time till this qstate is processed and based on which u need to do a select for qstate S as success.

You can make a distinction of qstate from session log and checking the qstate of the three states for a start to proceed..

Br,

Vijay.

Read only

Former Member
0 Likes
3,985

Hi,

If you are using CALL TRANSACTION method then you dont need to use COMMIT WORK statement.

regards,

sakshi

Read only

0 Likes
3,985

Hello Sakshi,

I have created a BDC a program for Transaction :OLI9BW where i need to pass commit explicitly in BDC param

Structure              : CTU_PARAMS                   

Short Description : Parameter string for runtime of CALL TRANSACTION USING

If it's not required then why SAP has provided commit param in CTU_PARAMS

Thanks,

Anoop Singh Bhandari

Read only

Former Member
0 Likes
3,985

Hi ,

Actually the system automatically executes the commit immediately before and after CALL TRANSACTION USING statement.

Regards,

Read only

Former Member
0 Likes
3,986

Hi,

After call transaction va01

use the following code instead of select statement to get the newly created sales order.

if sy-subrc = 0.

GET PARAMETER ID 'AUN' FIELD w_new_sales_order_no.

endif.

w_new_sales_order_no will give you the newly created sales order no.

Regards,

Usha.

Read only

Former Member
0 Likes
3,985

Hi Phani,

You can try WAIT UP TO (n) SECONDS command after your BDC if it works for you.

Even after this you are not getting the desired result you can try for the do loop with exit statement to make sure

that you are getting the details of the successfully created sales order

Do.

select single vbeln from vbak into lv_vbeln where vbeln = ( take the recently created sales order no)

IF ( sy-subrc = 0 ).

EXIT. " leave DO loop

ELSE.

WAIT UP TO 1 SECONDS.

ENDIF.

enddo.

But be careful with this it may become infinte loop so you can also give the maximum time limit for this do loop.

Is there any specific issue for making BDC for Sales order, you can use the BAPI_SALESORDER_CREATEFROMDAT2 or the FM SD_SALESDOCUMENT_CREATE for the Sales order creation.

Thanks,

Pawan

Edited by: PawanG on Sep 23, 2010 9:11 AM

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
3,985

>

> Before using this select statement do i need to use the COMMIT STATEMENT. Please suggest.

Hello Phani,

As already mentioned by other you don't need an explicit COMMIT WORK after the CALL TRANSACTION.

In your case you should set the BDC Update Mode to 'S' (synchronous update equivalent to COMMIT WORK AND WAIT). [http://help.sap.com/abapdocu_70/en/ABAPCALL_TRANSACTION_BDC_OPTIONS.htm#&ABAP_ADDITION_3@3@]

BR,

Suhas

Read only

Former Member
0 Likes
3,985

to avoid this problem and further to avoid coding like:


WAIT UP TO X SECONDS.

you could use a dirty assign on SAPMV45A XVBAK and XVBAP.