cancel
Showing results for 
Search instead for 
Did you mean: 

get all BANF

Former Member
0 Kudos

Hello All,

i´am learning how to work with bapis. I've played through one Example about purchasing in sap. Now i try to read out all existing banf with a bapi. How can i find out which bapis i need and maybe someone can give me an example, how can i read out the banf with jco 3

Thank you!!

Igor

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Now i try it with this code:

JCoFunction function = ABAP_AS.getRepository().getFunction("BAPI_REQUISITION_GETDETAIL");

if(function == null)

throw new RuntimeException("BAPI_COMPANYCODE_GETLIST not found in SAP.");

try

{

function.execute(ABAP_AS);

}

catch(AbapException e)

{

System.out.println(e.toString());

return;

}

JCoTable codes = function.getTableParameterList().getTable("REQUISITION_ITEMS");

//System.out.println(codes.getMetaData());

for (int i = 0; i < codes.getNumRows(); i++)

{

codes.setRow(i);

System.out.println(codes.getString("PREQ_NO"));

}

The problem is, that i get nothing back. No error, just nothing Can someone help me??

Former Member
0 Kudos

The function module you selected is correct for requisitions. What you are missing is at least one import parameter "NUMBER" indicating which requisition you want to retrieve. You can also run that through transaction SE37 to test. Sample code can be found here: http://help.sap.com/saphelp_nwpi711/helpdata/en/48/634503d4e9501ae10000000a42189b/content.htm


function.getImportParameterList().setValue("NUMBER", REQUISTION_NUMBER );

The import parameter must be set before

function.execute()

Make sure you substitute REQUISITION_NUMBER with the an existing requisition id.

I hope that gets you started.

Edited by: Christian Wunderlich on May 23, 2011 11:55 PM

Former Member
0 Kudos

Thank you for you answer.

I already try it with another BAPIs and i was successful. But with this BAPI i have no luck.

My code looks so:

JCoFunction function = ABAP_AS.getRepository().getFunction("BAPI_REQUISITION_GETDETAIL");

if(function == null)

throw new RuntimeException("BAPI_COMPANYCODE_GETLIST not found in SAP.");

function.getImportParameterList().setValue("NUMBER","10015263");

try

{

function.execute(ABAP_AS);

}

catch(AbapException e)

{

System.out.println(e.toString());

return;

}

JCoTable codes = function.getTableParameterList().getTable("REQUISITION_ITEMS");

for (int i = 0; i < codes.getNumRows(); i++)

{

codes.setRow(i);

System.out.println(codes.getString("MATERIAL"));

}/**/

}

And when i try it with the transaction se37 with my number i get required Info, but with my code i get nothing.

As i said, another BAPIs works fine.

Thank you!

Former Member
0 Kudos

I can't test this myself right now, but please try to zero fill (add two leading zeros) your BANF id.

Former Member
0 Kudos

Thank you, it was very helpful.

I have just one another question, maybe you can help me also.

I need the reference model for purchase order with associated business-object-model, were can i find this?

Thank you

Igor

Answers (1)

Answers (1)

Former Member
0 Kudos

I think i can solve this problem with BAPI_REQUISITION_GETDETAIL, but i dont have exmaples.