on 05-04-2011 6:50 PM
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
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??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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!
I think i can solve this problem with BAPI_REQUISITION_GETDETAIL, but i dont have exmaples.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.