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

test run BAPI_GOODSMVT_CREATE

Former Member
0 Likes
5,800

Hi,

In my program I have 2 bapi.

BAPI_PO_CREATE and BAPI_GOODSMVT_CREATE.

When test run in selection screen is flagged, my program will execute TRANSACTION_ABORT to reverse the PO.

May I know how to do test run for BAPI_GOODSMVT_CREATE? There is a TESTRUN parameter in BAPI_GOODSMVT_CREATE but how to do test run for both BAPI_PO_CREATE and BAPI_GOODSMVT_CREATE one after another together? I need to do test run for both BAPI. If not, there may have error in GR but PO already been created.

Appreciate the advice.

Thanks

Rgds

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,781

Hi,

I think it is difficult. Even if you use BAPI_PO_CREATE1 with the test option, you will need PO number and line item number to create the GR. And as far I know, you will not get the PO number unless you do commit work.

And once you commit, you will not be able to rollback the PO if you encounter an error in your GR creation.

Hi,

In my program I have 2 bapi.

BAPI_PO_CREATE and BAPI_GOODSMVT_CREATE.

When test run in selection screen is flagged, my program will execute TRANSACTION_ABORT to reverse the PO.

May I know how to do test run for BAPI_GOODSMVT_CREATE? There is a TESTRUN parameter in BAPI_GOODSMVT_CREATE but how to do test run for both BAPI_PO_CREATE and BAPI_GOODSMVT_CREATE one after another together? I need to do test run for both BAPI. If not, there may have error in GR but PO already been created.

Appreciate the advice.

Thanks

Rgds

9 REPLIES 9
Read only

former_member156446
Active Contributor
0 Likes
3,781

se37 u can use the following menu path way :

function module > test> test sequence

Read only

Former Member
0 Likes
3,781

hi,

in every/almost BAPI's, having testrun parametr. U have to pass X to the testrun .thats all..then bapi returns exceptions into RETURN internal Tables. then check the internal table for errors. testrun or exceute bapi both r same. but in testrun,this will not update anything....i mean further program....

thnks

Yerukala Setty

Read only

mvoros
Active Contributor
0 Likes
3,781

Hi,

unfortunately, not all BAPIs have the test run option. BAPI_PO_CREATE does not have it but BAPI_PO_CREATE1 has it. Have you tried to use BAPI_PO_CREATE1 instead of BAPI_PO_CREATE?

Cheers

Read only

former_member194669
Active Contributor
0 Likes
3,781

You need to use BAPI_PO_CREATE1 instead of BAPI_PO_CREATE . BAPI_PO_CREATE1 have test run option

Read only

Former Member
0 Likes
3,782

Hi,

I think it is difficult. Even if you use BAPI_PO_CREATE1 with the test option, you will need PO number and line item number to create the GR. And as far I know, you will not get the PO number unless you do commit work.

And once you commit, you will not be able to rollback the PO if you encounter an error in your GR creation.

Read only

0 Likes
3,781

Hi Abhijit,

What you said is right. If PO not committed, the PO not able to use in BAPI_GOODSMVT_CREATE.

I do not know why sap design so.

Is there any way that I can overcome this?

Thanks alot for all have replied. point given.

Need advice further.

thanks

rgds

Read only

0 Likes
3,781

you need to follow this seq as I said before:

BAPI_PO_CREATE1

bapi_transaction_commit

BAPI_GOODSMVT_CREATE

bapi_transaction_commit

Read only

0 Likes
3,781

Hi,

1. There is no way you can overcome this.

2. SAP designed it in this way because a GR can be created in reference to a PO and a person who creates a PO should not ethically GR it. Just to help check the frauds.

Read only

0 Likes
3,781

Hi J@Y,

I tested using bapi_po_create1 with test run, the bapi cannot return the PO number though no error. This has stopped me from doing the test run of BAPI_GOODSMVT_CREATE as it returns error Enter Purchase Order.

What abhijit said is correct. only actual run can pass in po number to BAPI_GOODSMVT_CREATE.

seems like this is sap problem.

anyone has such problem?

rgds