cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI Call, in oder to bring data?

Former Member
0 Kudos

Hello Friends,

I am facing problem in oder to bring data from SAP system. Actually I am calling a BAPI "BAPI_DEBTOR_GETDETAIL" to show the details of the debtor. Here is the code,

JCO.Repository repository = new JCO.Repository("call" , mConnection);

IFunctionTemplate template = repository.getFunctionTemplate("BAPI_DEBTOR_GETDETAIL");

JCO.Function function = template.getFunction();

function.getImportParameterList().setValue(0000000001 , "DEBTORID");

JCO.Structure str = function.getExportParameterList().getStructure("DEBITOR_GENERAL_DETAIL");

System.out.println("NAME: " + str.getString("NAME"));

The customer 1 is already existed in the system. Please advise me if this the right way, to send the parameter with setValue method (cause atleast it did not give me any exception). And also please advise me how to bring the customer information, cause when i write this

System.out.println("NAME: " + str.getString("NAME"));

It does not print any thing!

Many thanks in advance!

Haider Syed.

Accepted Solutions (1)

Accepted Solutions (1)

gregorw
Active Contributor
0 Kudos

Hello,

the problem is in this line:

function.getImportParameterList().setValue(0000000001 , "DEBTORID");

it should be:

function.getImportParameterList().setValue("0000000001" , "DEBTORID");

if you had read the RETURN Structure you would have get more information

JCO.Structure ret = function.getExportParameterList().getStructure("RETURN");
System.out.println("BAPI_DEBTOR_GETDETAIL RETURN: " + ret.getString("MESSAGE"));

If you want more information about the Customer I think it's better to use "BAPI_CUSTOMER_GETDETAIL2".

Reagards

Gregor

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Gregor,

Thanks for your reply,

I have tried now with this:

function.getImportParameterList().setValue("0000000001" , "DEBTORID");

but still it does not print the name of the debetor??

Any suggestions please.

With Regards,

Haider Syed.

Former Member
0 Kudos

Thanks to all!

The problem is sloved

Caio,

gregorw
Active Contributor
0 Kudos

Hello,

can you describe the solution? It might be helpful for others. And don't forget to give points if my answer was helpful.

Regards

Gregor

Former Member
0 Kudos

hi Gregor,

Yes, your answer was very helpful, and I have already awarded u the points, Thanks indeed, but I dont know why we need to send parameters in "",

The actual problem was, I forgot to execute the function,

mConnection.execute(function);

But after executing the function, it shows me the required information.

With Regards,

Haider Syed

Former Member
0 Kudos

Very funny Haider.

I thought it was something really serious.