Application Development 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: 

Calling a BAPI from outside world Vs from a se38 program

Former Member
0 Kudos

Hello SAP gurus,

We are trying to call BAPI_SALESORDER_GETLIST from our product. We are sending the mandatory Parameters which are customer_number (10Characters) padded with right number of zeros and sales_organization (4Characters).

For some reason every time it fails when called from our non sap program with a message data not found. I tried to put a external break point and noticed that both varialbles customer_number and sales_organization sent from our program are Showing the right values. But still in the end it says data not found.

However, I wrote a short program (SE38) and called the same BAPI with the same parameter values and it works from inside SE38. It lists the records that satisfies the condition.

So I am wondering why the same bapi behaves differently when called from SE38 Vs calling from outside world.

I would appreciate anybody can please let us know.

Thanks in advance

Ram

Edited by: Ram Prasad on Mar 5, 2009 9:28 PM

1 ACCEPTED SOLUTION

former_member189059
Active Contributor
0 Kudos

Just one more thought, I don't know if it will really make a difference

But check the date parameters DOCUMENT_DATE and DOCUMENT_DATE_TO in your local call and external call. Check if both are the same

I think if one is blank and the other is 00000000 then it may cause the fetching to go wrong

15 REPLIES 15

former_member156446
Active Contributor
0 Kudos

check the authorizations, of the service that is calling the BAPI from the outside of SAP's world... that service need to have the same authorizations as you are having in SAP world.

0 Kudos

thanks JY for the response.

yes i am using the same user and password in both the cases which has sap_all.

the strange thing is that i can put a breakpoint and see these two mandatory parameters displaying the right values. But still it says data not found.

But for the exact same values it works from SE38.

any other suggestions of comments will be highly appreciated.

Edited by: Ram Prasad on Mar 5, 2009 9:34 PM

0 Kudos

even though you are using the same user name and pswd... thats an external call to SAP.. so the authorizations are different... check and confirm with your Security team... and make sure you and the external call have the same authorizations....

you can see the data/input parameters.. but there will be many authorization checks happening in the BAPI call which might restrict from a successfull execution..

Former Member
0 Kudos

Hi,

Try to write the parameter values to unix file before you pass to the BAPI, So that we can make sure that data was passing correctly to the BAPI, when you can from outside SAP. This is for just make sure about input data for BAPI only.

Regards,

~Satya

Former Member
0 Kudos

Hi,

Try to write the parameter values to unix file before you pass to the BAPI, So that we can make sure that data was passing correctly to the BAPI, when you can from outside SAP. This is for just make sure about input data for BAPI only.

Regards,

~Satya

0 Kudos

Thanks JY, Sure I will look into the authorization side and see what I can do. Unfortunately, I am the only SAP guy in our company and eventhough I am a certified XI engineer, I am wearing different caps (BASIS, FUNCTIONAL etc,) and so I depend on forums like this for most of my issues and most of the time I am very succesful in getting the right solutions and I appreciate it.

Suresh, thanks for the response. The data that is sent from our program (External) is being sent properly since I have checked it by putting an external break point and debugging it.

Any other suggestions or comments will be highly appreciated.

Tks

Ram

Edited by: Ram Prasad on Mar 6, 2009 3:23 AM

former_member189059
Active Contributor
0 Kudos

Just one more thought, I don't know if it will really make a difference

But check the date parameters DOCUMENT_DATE and DOCUMENT_DATE_TO in your local call and external call. Check if both are the same

I think if one is blank and the other is 00000000 then it may cause the fetching to go wrong

0 Kudos

Hi Chris

Thanks for the response. But I am not giving any parameters other than the 2 mandatory ones which are,

customer number and sales organization. All others are null.

tks

ram

0 Kudos

Hello JY

As per your suggestion, I am trying to see the different in authorizations between calling this BAPI from inside SE38 program Vs calling the webservice from outside world.

Unfortunately, I am not a BASIS guy and we don't have a BASIS person in our company and so I would appreciate if you can please give me some tips on how to go about it.

Thanks a lot for all the help.

Ram

0 Kudos

The user is not member of one of the required J2EE security roles.

● Solution:

Take the ID of the log entry, open the security log in the Log Viewer and search for the log entry. This will lead to an message of severity Warning like:

Calling operation getQuote of component sap.com/WSSEC_SERVER_EAR*WSSEC_TEST_Assembly.jar for principal Administrator denied (roles: [StockGuests, StockCustomers]).

The message contains the user in combination with the component and the required security roles that are needed to successfully authorize the request. In the Security Service look for the security roles of the component and check the user assignment.

If no roles were assigned (roles: []), no authorization is possible and the assignment must be changed in the IDE.

From [here>>>>>.|http://help.sap.com/saphelp_nwmobile71/helpdata/en/10/661841a66af223e10000000a155106/content.htm]

[Authorization |http://help.sap.com/saphelp_nw70/helpdata/en/2b/07074155bcf26fe10000000a1550b0/content.htm]

J@Y

0 Kudos

Thank you very much for the quick response. I will try your suggestion and keep you posted.

Ram

0 Kudos

Hi,

All you need to do, is set the import parameter "TRANSACTION_GROUP" to 0 (Zero not O) when you are calling the BAPI from an external source.

Lo and behold, you have you data!

T00th

0 Kudos

Thanks Sameer, I will try that and will let you know. But I checked the Bapi Documentation and it says that by default this field takes '0'. However, I will force '0' and see if that helps.Will keep you posted

tks

ram

0 Kudos

Hi,

The default value in this field is set to "0" in SAP, but when calling from an external source, this doesnt seem to work. Thats the reason you have to set it manually when calling the BAPI from a remote application.

T00th

0 Kudos

wow!!! thanks a lot sameer. That did the trick.