1

I tried to use the IAM API to connect SAP with a NW Java application, I added an HTTP Connection in SM59 with type G (HTTP Connection to External Serv).

And when I call the BAPI BAPI_USER_GETLIST, the program dumps with error:

Illegal destination type 'G'.

Here is the used code :

* Call the API
  call function 'BAPI_USER_GETLIST' destination rfcdest
    exporting
*     max_rows        = 0
      with_username   = withname
    importing
      rows            = sel_rows
    tables
      selection_range = sel_range
*     selection_exp   =
      userlist        = user_list
      return          = return_tab.

The error : enter image description here I would like to know if there is a way to fix this issue ?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Hamza Chioua
  • 135
  • 3
  • 11
  • 1
    correct me if I am wrong, but is it even possible to call a bapi in a non ABAP System? Not quite sure about this. – Sasku Nov 15 '19 at 11:00
  • Or do you mean you want to access a BAPI of S/4HANA on SAP Cloud Platform, or something like that? – Sandra Rossi Nov 15 '19 at 12:26

1 Answers1

6

It is all there in the short dump description in the error analysis part. You are calling a BAPI and this is an RFC function module. You have to invoke it over an ABAP connection - Connection Type 3.

Sasku
  • 517
  • 7
  • 23
Jagger
  • 10,350
  • 9
  • 51
  • 93
  • Don't forget destination type 'T'... In any case, you are right: destination type 'G' is only for HTTP requests (*HTTP Protocol*). In order to call a BAPI, one needs a destination that supports the *RFC Protocol*. These are basically: '2' (R/2 system - no longer in use), '3' (R/3 system), 'T' (external server program) and 'I' (another app server of the same system) – Lanzelot Feb 11 '20 at 15:08