Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to make a normal Function Module remote able function module

former_member207487
Participant
0 Likes
1,717

Hi guys,

i am a beginner in abap programming. I have made a programm in Se80 which shows all the nodes of the active hierarchies (5 stk.)

in a ALV grid. Therefore i am getting the active hierarchies from table "rshiedir" and use the normal function module "RSSH_HIERARCHY_READ" to display the nodes of the hierarchie. The problem is the hierarchies do have a different techical name in the systems (development-acceptance-productive) but the descriptive nbame is the same in all systems. Because of the difference of the technical names I can use this programm in just one system. But the hierarchy content should be comparable and be displayed in all three systems. Therefore i would like to create a remoteable function module which covers the normal one. Can i do this and how can i create a remoteable function module and use it?

If not do you know any remotable functgion module which gives back all the nodes from an active hierarchy in table "RShiedir".

Thanks and kind regards,

Murat

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,369

Hello,

Simple, create a wrapper RFC (similar to 'RSSH_HIERARCHY_READ' ) & call the normal FM 'RSSH_HIERARCHY_READ' inside the wrapper.

Something like this:

FUNCTION z_rssh_hierarchy_read.
*"----------------------------------------------------------------------
*"*"Global Interface:
*"  IMPORTING
*"     VALUE(I_RSHIEDIRKEY) TYPE  RSHI_S_RSHIEDIRKEY OPTIONAL
*"     VALUE(I_RSHIEDIRLOG) TYPE  RSHI_S_RSHIEDIRLOG OPTIONAL
*"     VALUE(I_DATE) TYPE  RSHI_DATE DEFAULT SY-DATUM
*"  EXPORTING
*"     REFERENCE(E_RSHIEDIR) TYPE  RSHI_S_HIEDIR
*"     REFERENCE(E_T_RSNODES) TYPE  RSHI_T_HIENODE
*"     REFERENCE(E_TH_RSINTERVAL) TYPE  RSHI_TH_INTERVAL
*"     REFERENCE(E_DUPLICATE_LEAFS) TYPE  RS_BOOL
*"     REFERENCE(E_T_RSNODES_LNK) TYPE  RSHI_T_HIENODE
*"  EXCEPTIONS
*"      INVALID_HIERARCHY
*"      NAME_ERROR
*"      IOBJ_NOT_FOUND
*"----------------------------------------------------------------------

" Don't forget to add TYPE-POOLS rshi to the FuGr. TOP include
  CALL FUNCTION 'RSSH_HIERARCHY_READ'
    EXPORTING
      i_rshiedirkey     = i_rshiedirkey
      i_rshiedirlog     = i_rshiedirlog
      i_date            = i_date
    IMPORTING
      e_rshiedir        = e_rshiedir
      e_t_rsnodes       = e_t_rsnodes
      e_th_rsinterval   = e_th_rsinterval
      e_duplicate_leafs = e_duplicate_leafs
      e_t_rsnodes_lnk   = e_t_rsnodes_lnk
    EXCEPTIONS
      invalid_hierarchy = 1
      name_error        = 2
      iobj_not_found    = 3
      OTHERS            = 4.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Here Z_RSSH_HIERARCHY_READ is the wrapper RFC. Hope you get the point.

BR,

Suhas

8 REPLIES 8
Read only

Former Member
0 Likes
1,369

Hi,

A normal FM can be made remote enable by selecting Remote-Enabled Module option in the attributes of the FM.

Read only

0 Likes
1,369

HI,

If you navigate to the Attribute of the function module, you will get 3 sections. Please look into the Processing Type Section. There you will find 3 options as follows.

Normal Function Module

Remote-Enabled module

Update Module

Please select the Remote enable module, then your function will be remote enabled.

Please let me know if you facing any issue regarding this.

Regards

Satrajit.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,370

Hello,

Simple, create a wrapper RFC (similar to 'RSSH_HIERARCHY_READ' ) & call the normal FM 'RSSH_HIERARCHY_READ' inside the wrapper.

Something like this:

FUNCTION z_rssh_hierarchy_read.
*"----------------------------------------------------------------------
*"*"Global Interface:
*"  IMPORTING
*"     VALUE(I_RSHIEDIRKEY) TYPE  RSHI_S_RSHIEDIRKEY OPTIONAL
*"     VALUE(I_RSHIEDIRLOG) TYPE  RSHI_S_RSHIEDIRLOG OPTIONAL
*"     VALUE(I_DATE) TYPE  RSHI_DATE DEFAULT SY-DATUM
*"  EXPORTING
*"     REFERENCE(E_RSHIEDIR) TYPE  RSHI_S_HIEDIR
*"     REFERENCE(E_T_RSNODES) TYPE  RSHI_T_HIENODE
*"     REFERENCE(E_TH_RSINTERVAL) TYPE  RSHI_TH_INTERVAL
*"     REFERENCE(E_DUPLICATE_LEAFS) TYPE  RS_BOOL
*"     REFERENCE(E_T_RSNODES_LNK) TYPE  RSHI_T_HIENODE
*"  EXCEPTIONS
*"      INVALID_HIERARCHY
*"      NAME_ERROR
*"      IOBJ_NOT_FOUND
*"----------------------------------------------------------------------

" Don't forget to add TYPE-POOLS rshi to the FuGr. TOP include
  CALL FUNCTION 'RSSH_HIERARCHY_READ'
    EXPORTING
      i_rshiedirkey     = i_rshiedirkey
      i_rshiedirlog     = i_rshiedirlog
      i_date            = i_date
    IMPORTING
      e_rshiedir        = e_rshiedir
      e_t_rsnodes       = e_t_rsnodes
      e_th_rsinterval   = e_th_rsinterval
      e_duplicate_leafs = e_duplicate_leafs
      e_t_rsnodes_lnk   = e_t_rsnodes_lnk
    EXCEPTIONS
      invalid_hierarchy = 1
      name_error        = 2
      iobj_not_found    = 3
      OTHERS            = 4.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Here Z_RSSH_HIERARCHY_READ is the wrapper RFC. Hope you get the point.

BR,

Suhas

Read only

Former Member
0 Likes
1,369

Hi,

You can check the radio button of Remote-Enabled Module in attributes tab of function module.

Regards.

Read only

former_member207487
Participant
0 Likes
1,369

Hi Saha,

the idea with the wrapper function module is good. But when i create a function module the function group is required. What should i enter here. Everywhere the same like the original function module. Function group "RSSHIER" should i enter this one for the wrapper function group? and you wrote that i should not forget the type pool:slis in the include. When i create a wrapper function module where can i put the include?

Thanks and kindregards,

Murat

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,369

Hello Murat,

You can create your own FuGr. (e.g., ZRSSHIER) & in the generated code of the FuGr. you'll have a top include.

In the top include define the TYPE-POOL. (Similar to LRSSHIERTOP line 11).

BR,

Suhas

PS: For simplicity sake & to save me time to create the prototype i gave the same names

Read only

former_member207487
Participant
0 Likes
1,369

Hi Saha,

Do i have to declare importing and exporting variables or exporting tables? in the wrapper Function module?

Thanks and kind regards,

Murat

Read only

former_member207487
Participant
0 Likes
1,369

i am wainting fo an answer from saha. but the question is answered.