Skip to Content
0
Former Member
Jul 10, 2014 at 12:26 PM

Gateway for simple function module

848 Views

Hi there,

my background is ABAP and I've now started development with SAPUI5.

My scenario:

I want to write a simple SAPUI5 application allowing to change a user password.

Therefore I've created a RFC-enabled function module 'ZBC_USER_SET_NEW_PASSWORD' in the backend system:

FUNCTION zbc_user_set_new_password.

*"----------------------------------------------------------------------

*"*"Local Interface:

*" IMPORTING

*" VALUE(I_UNAME) TYPE SYUNAME

*" VALUE(I_PASSWORD) TYPE STRINGVAL

*"----------------------------------------------------------------------

DATA:

ls_return TYPE bapiret2,

lt_return TYPE STANDARD TABLE OF bapiret2.

CALL FUNCTION 'BAPI_USER_CHANGE'

EXPORTING

username = i_uname

password = i_password

passwordx = abap_true

TABLES

return = lt_return.

READ TABLE lt_return INTO ls_return

WITH KEY

type = 'E'.

IF sy-subrc IS INITIAL.

* Error occured

EXIT.

ENDIF.

ENDFUNCTION.

Now I would like to call that FM from a SAPUI5 application running on the same ABAP server.

I've tried to create a gateway service that only calls this function module, but I'm struggling with the GetEntitySet and GetEntity methods.

What is the easiest way to create a gateway service to call the above listed function module?

Please note that I don't want to retrieve any data. I just would like to send a new password to the backend system.

If gateway is not appropriate for this, would it be better to expose the FM as web service and directly call it via SOAP request?

Thanks in advance.