0

How can I use ENQUEUEGETSTAT function module in gateway service, this fm returns 3 parameter (ENTRIES_TOTAL, ENTRIES_PEAK, ENTRIES_ACTUAL)

I can map tables in Gateway but cant figure out this. How can I collect these parameters in to internal table and export then?

enter image description here

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
İbrahim Özcan
  • 103
  • 3
  • 12

1 Answers1

1

it looks like a function import use case to me .

First of all, you have to define a ABAP structure for the returning data like below

@EndUserText.label : 'ENQUEUEGETSTAT'
@AbapCatalog.enhancementCategory : #NOT_EXTENSIBLE
define structure zza_enqueuegetstat {
    entries_total  : abap.int4;
    entries_peak   : abap.int4;
    entries_actual : abap.int4;
}

In your SEGW project, create a entity type ENQUEUEGETSTAT mapping to this structure.

enter image description here.

Afterwards, create a function import ENQUEUEGETSTAT.

enter image description here

Go to your DPC_EXT class and redefine the method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~EXECUTE_ACTION.

method /iwbep/if_mgw_appl_srv_runtime~execute_action.

    data ls_enqueuegetstat type zza_enqueuegetstat.

    if iv_action_name = 'ENQUEUEGETSTAT'.
      call function 'ENQUEUEGETSTAT'
        importing
          entries_total  = ls_enqueuegetstat-entries_actual
          entries_peak   = ls_enqueuegetstat-entries_peak
          entries_actual = ls_enqueuegetstat-entries_total.

      copy_data_to_ref(
          exporting
             is_data = ls_enqueuegetstat
          changing
             cr_data = er_data
      ).
   endif.
endmethod.

Save and activate everything. Then you should able to access your function import /sap/opu/odata/sap/**YOUR_SERVICE**/ENQUEUEGETSTAT?$format=json

{
    "d": {
        "EntriesTotal": 382,
        "EntriesPeak": 43189,
        "EntriesActual": 500000
    }
}

Hope it helps.

Haojie
  • 5,665
  • 1
  • 15
  • 14