5

I established connection to a SAP Server and I would like to print a list of BAPIs in my Java program. I am using sapjco3.jar.

Is there any way to do it?

Boghyon Hoffmann
  • 13,472
  • 7
  • 49
  • 114
Prabhakar Manthena
  • 2,023
  • 2
  • 14
  • 30

4 Answers4

6

You can also use the function module SWO_QUERY_API_METHODS. The following code snippet works with JCo 2:

IFunctionTemplate functionTemplate = Repository.getFunctionTemplate("SWO_QUERY_API_METHODS");
JCO.Function function = functionTemplate.getFunction();
mConnection.execute(function);

ParameterList exportParameter = function.getExportParameterList();
System.out.println("exportParameter: " + exportParameter);
ParameterList importParameter = function.getImportParameterList();
System.out.println("importParameter: " + importParameter);
ParameterList tableParameter = function.getTableParameterList();
System.out.println("tableParameter: " + tableParameter);
vwegert
  • 18,093
  • 3
  • 33
  • 54
dweisser
  • 63
  • 1
  • 7
  • 2
    Be aware that `SWO_QUERY_API_METHODS` is not a BAPI, it's just a RFC-enabled function module that was released for internal use. It may change or disappear without a warning to customers. Other than that, this sounds like a great alternative. – vwegert Aug 28 '13 at 09:42
5

As far as I know, there is no "BAPI to get a list of BAPIs", so this would be a non-trivial task. You could try to use RFC_FUNCTION_SEARCH to search for function modules named BAPI*, but that's not guaranteed to give you a) only official BAPIs and b) all of the official BAPIs...

vwegert
  • 18,093
  • 3
  • 33
  • 54
4

You can use the BAPI_MONITOR_GETLIST to get a list of all BAPIs in your system together with meta data.

2

You could make an ABAP function searching for all RFC functions in table TFDIR, with FMODE ='R' (remote). However, This will give you all remote-callable function, not only BAPIs.

PATRY Guillaume
  • 4,204
  • 1
  • 33
  • 39