cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_SALESORDER_CREATEFROMDAT2 and BAPI_TRANSACTION_COMMIT in php

Former Member
0 Kudos

Hi,

I'm trying to create salesorder in php with rfc BAPI_SALESORDER_CREATEFROMDAT2. I call it through webservice with php soap call. It works ok as I get response that order created with some number. However order is not created in sap. I also run BAPI_TRANSACTION_COMMIT but with no help.

I have found some description about the issue describing createTID or session locking in bc, but it didn't help.

Question is how can it be done in php? I'know it's possible to create z_rfc to run both but it should also be possible to run both create and commit in php as well.

(I have r/3 4.7/6.20)

I'd appreciate a lot any insight into this,

erki

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

can someone help me with the parameters sintax for these bapis (bapi_salesorder_createfromdat2 and bapi_transaction_commit) in PHP?

thanks

-- sorry for my pour english --

Flavio
Active Contributor
0 Kudos

Hi Gustavo,

     Could you please open a new thread? This one is more than 8 years old. And possibly, could you please add details to your issue?

Thanks a lot.

Regards,

Flavio

johna69
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Erki,

You should be able to run both from PHP.

I have not used these BAPIs and do not have access to a system where I can run them.

Can you provide more detail on the createTID and session locking that you mention.

Essentially the calls from PHP are two distinct calls to the system. If you implemented this in Java instead of PHP you would have the same interaction with the R/3 system. I know this does not help much, but if we can get more details on the nature of the problem we may be able to determine what is happening.

Regards

JohnA

gregorw
Active Contributor
0 Kudos

Hello John,

could not completely agree with you. If you're using Java you can do both calls in one session. Meaning that you get one connection (discrete or from session pool) and use that to call the BAPI.. and the commit. I think with SAPRFC it should be also possible. But how can you keep the session with SOAP?

Regards

Gregor

johna69
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Gregor,

I was referring to a Java Application, not running on a J2EE server. I should have been clearer.

In the context of a web service call, even from a J2EE server you are still running over SOAP and therefore would you not have the same problem?

Out of curiosity, why would being within a single session on the client end (calling side) have an effect on this?

How would this affect the BAPI calls?

Regards

JohnA

johna69
Product and Topic Expert
Product and Topic Expert
0 Kudos

A simple way of testing a Web Service in Java is to use the WSDL2Java tool from Apache Axis. This will take a WSDL and generate Java classes to allow access/testing of the Service.

Using this it is feasible to create a small Java application to invoke the two BAPIs as web services. This would allow the cause of the problem to be identified as PHP or Web Service based.

Not really relevant to PHP, but Axis is a tool I keep available when all else fails and I want to try an approach in a different language.

In conjunction with Tomcat, Axis gives you the ability to test both ends of the service.

Cheers

JohnA

Former Member
0 Kudos

I found following but it does not help in php side:

>You can also try:

>1. pub.sap.client:createTID and assign created tid to >variable $tid

>2. INVOKE sap.map:outbound for your BAPI and assign >created tid in step 1 to parameter $tid

>3. pub.sap.client:confirmTID and assign created tid in >step 1 to parameter $tid

and

>You should try adding service pub.sap.client:lockSession >before you call the BAPI BAPI_BUPA_CREATE_FROM_DATA. Then >you call the BAPI_TRANSACTION_COMMIT and the last step is >to call pub.sap.client:releaseSession.

so do you know if it is possible to achieve similar result in php?

I have no java installed on server. I create new soap client with

$client = new SoapClient($wsdl,...

for both rfc-s and I then run these webservices. Is there a possibility to run two webservices with different wdsl in one soapclient? Possibly not but one can hope

br

erki

johna69
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Erik,

Hopefully Gregor can shed some more light on the need to maintain a session for the LUW. That is unfortunately not an area I have any expertise in.

We can then try to find a means to replicate this in a web service environment (if possible).

A link tot he business connector solution:

Regards

JohnA

johna69
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Erik,

If you were on a 6.40 system then you would be able to define a web service for your BAPIs and mark them as session oriented.

See:

The tutorial "ABAP Web Service Definition in Web AS 6.40" (that you can find on SDN) and its 3 partners provide details on this.

In the 6.20 system it looks like you may either have to wrap the LUW in one RFC to be called as a Web Service, or use SAPRFC from PHP to make the calls.

Regards

JohnA

marilyn_pratt
Active Contributor
0 Kudos

Thanks John for the pointer to ABAP Web Service Definition in Web AS 6.40:

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webservices/... web service definition in web as 6.40.abst

ABAP Web Service Configuration in Web AS 6.40

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webservices/... web service configuration in web as 6.40.abst

and ABAP Web Service Virtual Interface in Web AS 6.40

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webservices/... web service virtual interface in web as 6.40.abst

A really nice set of simulations...

cheers,

Marilyn

Former Member
0 Kudos

Hi,

thanx for answers, I guessed that in 6.20 the only way would be to wrap them in one rfc, which I already did and it works. I lose ability to check errors in php but I can live with that for now.

saprfc is out of question because it does not support unicode.

Thanks,

erki

gregorw
Active Contributor
0 Kudos

Hi Erki,

so now it's time for you to reward points :-).

Regards

Gregor