cancel
Showing results for 
Search instead for 
Did you mean: 

Look up problem while calling a BAPI

Former Member
0 Kudos

Hello SDN,

I am using the BAPI <b>BAPI_COSTCENTER_GETDETAIL1</b> to get the costcenter detail from SAP. I can execute the BAPI successfuly in R/3. When I call the BAPI from with in my UDF, it returns RETURN segment with Msg status <b>E</b> and the cost center does not exist.

But the BAPI executes sucessuly for the same inputs when I execute the same in SE37.

Am I missing any config in XI?

P.S: I have used the same Communication channel to call RFC sucessfully.

Regards,

Jai Shankar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Jai,

<i>I have used the same Communication channel to call RFC sucessfully.</i>

If you are using the code given in the michals document then it should return the entire table in the form of xml. Then you have to parse the cost center value using User defined functions.

Also what do you see in receiver RFC communication channel (lookup communication channel)?

---Satish

Former Member
0 Kudos

Satish,

The BAPI is returning the value in XML as expected. The only problem is, it says no values found even for valid inputs. The communication channel monitor shows status as success.

Regards,

Jai Shankar

prasanthi_chavala
Active Contributor
0 Kudos

Hi Jai Shankar,

Check your java code (parsing method) whether it is retriving the cost center value from the response xml msg of called RFC and passing correctly to the required element in the UDF.

Regards,

Prasanthi.

bhavesh_kantilal
Active Contributor
0 Kudos

Jai,

Check the request XML. Maybe there is some datatype issue etc.

regards

Bhavesh

Former Member
0 Kudos

Hi Shankar,

There seems to be a problem in the format in which you are entering the data.

Make sure what ever you are passing in the IMport Structure is in the same format as the BAPI struc.

Just checked the BAPI..theres a key date field..

hope you are passing the date in the format.

YYYYMMDD

Regards,

Sumit

Message was edited by:

Sumit Khetawat

Former Member
0 Kudos

Bhavesh,

The input XML I am providing is

 "<?xml version="1.0" encoding="UTF-8"?>
<ns0:BAPI_COSTCENTER_GETDETAIL1 xmlns:ns0="urn:sap-com:document:sap:rfc:functions">
<CONTROLLINGAREA>1000</CONTROLLINGAREA>
<COSTCENTER>100</COSTCENTER>
<COSTCENTERDETAIL></COSTCENTERDETAIL>
</ns0:BAPI_COSTCENTER_GETDETAIL1>"

I got the XML by creating a dummy mapping as explained in Michal's article.

@ Sumit,

I beleive the date field is optional. I tried executing the BAPI with out the date field and it returns a valid output. But when I call the same using the above input xml, it is returns nothing.

Thank You.

Regards,

Jai Shankar

Former Member
0 Kudos

Hi Jai,

Try entering the Cost Center value as

<COSTCENTER>0000000100</COSTCENTER>

ie 7 zeros before 100.

it will work.

yeah date is optional thought just incase you entered.

Regards,

Sumit

bhavesh_kantilal
Active Contributor
0 Kudos

Jai,

When creating this XML in your Code, make sure that this entire XML is a String and a valid one (I know you wuld have ensure this but corss check ).

Not sure what are the inputs etc expected by the BAPI, but also try to use the Trace to print the Response XML and see what is happening . Just think that there must be some small issue somewhere.

Regards

Bhavesh

Former Member
0 Kudos

Sumit,

Many thanks. Will update you soon. I dont have access to my XI box currently. Once I get it, will test this and le you know the result.

But, when I execute the BAPI in R/3 no matter I give 100 or 0000000100 it gives me the correct result.

Regards,

Jai Shankar

bhavesh_kantilal
Active Contributor
0 Kudos

I second sumit on that observation. Have seen similar cases as well. But then I always had a ABAP Punter in my team who used to help me out in such cases

Do let us know on the updates.

Regards

Bhavesh

Former Member
0 Kudos

Hi Jai,

<i>But, when I execute the BAPI in R/3 no matter I give 100 or 0000000100 it gives me the correct result.</i>

Might be the conversion doesnt work when you call from XI. Not sure but itz worth a try. I have seen a few cases where it worked.

Secondly the error which you are getting is related to Cost Center.

There doesnt seem to be any problem with the XML which is created.

Regards,

Sumit

Former Member
0 Kudos

Hi Sumit and Bhavesh,

That solved my issue.

When I gave the cost ceter with 10 digit value, it returned me the correct result.

Thanks a lot for sharing your ideas.

But that raises another questio, how can I debug such errors?

Regards,

Jai Shankar

Former Member
0 Kudos

Hi Sumit and Bhavesh,

That solved my issue.

When I gave the cost ceter with 10 digit value, it returned me the correct result.

Thanks a lot for sharing your ideas.

But that raises another questio, how can I debug such errors?

Regards,

Jai Shankar

Former Member
0 Kudos

Hi Shankar,

Gr8 to knw that it solved your problem.

Just think what other possibility could be...Generally most of the times that is the reason.

Regards,

Sumit

ps : award points n close the thread if your problem is solved

Answers (0)