Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
mkoerner1
Explorer

Introduction


We have implemented the Fiori MyInbox on a GW-System with an Abap Release 7.50 SP07.

The WF`s are on a Backend Release 7.40 SP11.

We need some extra information on the MyInbox which are not available in the standard implementation. So I have enhanced the App to get this data.

Here are my problems while enhancing everything and how i solved it.

My main document, which i used for enhancing the MyInbox, can be found here: 2118812.

Systems


The systems i will use here are these 2

GW: Gateway / Frontend System with Release 7.50 SP07

BE: Backend system with Release 7.40 SP11

1. Get URL`s for ABAP class based objects


In my wokflows I have implemented workflow classes for the objects I need in the workflow. The standard TASKPROCESSING will not generate URL`s for class based objects. So i have to do it on my own.

1.1 Create methods to generate the URL in the class.


On the BE-system:

The first step is to create a URL. I have decided to use an interface YIF_WORKFLOW which I can use in every class. The definition is simple:
INTERFACE yif_workflow
PUBLIC .


METHODS display .
METHODS get_url
RETURNING VALUE(r_url) TYPE string.

ENDINTERFACE.

Now in my class the implementation is also simple, e.G.YCL_WF_CLASS.
  METHOD yif_workflow~get_url.
*---------------------------------------------------------------------*
* Kurzbeschreibung: URL erzeugen
* *
* *
* Autor:
* Datum: 24.05.2017
*---------------------------------------------------------------------*
* Änderungen *
* Grund: *
* Autor: Kürzel: *
* Datum: *
*---------------------------------------------------------------------*
data: ls_obj TYPE sibflporb.
TRY.
*Zuerst das URL-Objekt erzeugen
DATA(lo_url) = CAST if_swf_utl_url_generate( NEW cl_swf_utl_url_webgui( ) ).
* Instanz setzen
MOVE-CORRESPONDING m_lpor to ls_obj.
ls_obj-catid = 'BC'.
lo_url->set_object_and_action(
EXPORTING
im_object = ls_obj
im_action = 'YIF_WORKFLOW~DISPLAY' ).
* Visualisierung setzen
DATA(ls_vis) = VALUE if_swf_utl_url_generate=>method_visualization_type(
vtyp = 'WEBGUI'
catid = 'BC'
typid = m_lpor-typeid ).
lo_url->set_method_visualization_type( ls_vis ).
* Und die URL zurückgeben
r_url = lo_url->get_url( ).
CATCH cx_root.
ENDTRY.
ENDMETHOD.

In the display method you can do whatever you want, e.g. call a transaction.

1.2 Create RFC on the backend


Also BE-System

As the MyInbox is on a frontend gateway i need to get the data from my backend via RFC.

So I have generated a dunction module YEWF_GET_MISSING_URL with this coding:
FUNCTION YEWF_GET_MISSING_URL
CHANGING
VALUE(CT_INSTANZ) TYPE YASWFOBJECTS_T.



DATA: lo_obj TYPE REF TO bi_persistent.
* Über die Objekte loopen und die URL aufbereiten
LOOP AT ct_instanz ASSIGNING FIELD-SYMBOL(<wa>) WHERE object_link IS INITIAL.
DATA(l_object) = cl_http_utility=>if_http_utility~decode_utf8( CONV xstring( <wa>-object_id ) ).
DATA(ls_object) = CONV sibflporb( l_object ).
* Nur weitermachen, wenn das Objekt eine Klasse ist unc mit Y oder Z beginnt
IF ls_object-catid <> 'CL'
OR ls_object-typeid(1) NA'YZ' .
CONTINUE.
ENDIF.
* Ansonsten Klasse instanziieren
CALL METHOD (ls_object-typeid)=>bi_persistent~find_by_lpor
EXPORTING
lpor = CONV sibflpor( ls_object )
RECEIVING
result = lo_obj.
* Und die URL holen
TRY.
<wa>-object_link = CAST yif_workflow( lo_obj )->get_url( ).
CATCH cx_root.
ENDTRY.
ENDLOOP.
ENDFUNCTION.


1.3 Enhance the Gateway Service


Now we need to go to the GW-System.

The next step is to enhance the gateway service. Call transaction SEGW and create a new project (YTASKPROCESSING)





Then right click on the context menu on the node Data Model and call redefine ODate-Service



You need the /IWPGW/TASKPROCESSING in the version 2:



Mark all entries and click on execute:



Click on the Button generate on the top and leave everything as it is. The system will generate some classes, which we can enhance.

That`s it for the moment here. Nothing to do more.

1.4 Redefine the Method CASE_GET_ENTITYSET


On the GW we can now find a class YCL_YTASKPROCESSING_DPC_EXT. Here we need to redefine the Method CASE_GET_ENTITYSET to call ourf RFC when the Objects are called:
*---------------------------------------------------------------------*
* Kurzbeschreibung: Redefiniert, um URLs zu bekommen
* *
* *
* Autor:
* Datum: 24.05.2017
*---------------------------------------------------------------------*
* Änderungen *
* Grund: *
* Autor: Kürzel: *
* Datum: *
*---------------------------------------------------------------------*
DATA: l_alias TYPE /iwfnd/defi_system_alias.
FIELD-SYMBOLS: <entity> TYPE /iwpgw/if_tgw_types=>tt_task_objects.
* Destination merken
mv_destination = CAST /iwbep/cl_mgw_request(
io_tech_request_context )->get_request_details( )-system_alias_info-rfc_dest.
* Zuerst die Supermethode aufufen
CALL METHOD super->case_get_entityset
EXPORTING
iv_entity_name = iv_entity_name
iv_entity_set_name = iv_entity_set_name
iv_source_name = iv_source_name
it_filter_select_options = it_filter_select_options
it_order = it_order
is_paging = is_paging
it_navigation_path = it_navigation_path
it_key_tab = it_key_tab
iv_filter_string = iv_filter_string
iv_search_string = iv_search_string
io_tech_request_context = io_tech_request_context
IMPORTING
er_entityset = er_entityset
es_response_context = es_response_context.
* Und wenn jetzt die Task-Objekte kommen sollen, dann die fehlenden URLS generieren
IF iv_entity_name = /iwpgw/if_tgw_srv_constant=>gcs_entities-task_object.
ASSIGN er_entityset->* TO <entity>.
CHECK lines( <entity> ) > 0.
* Destination ermitteln
TRY.
* Wenn gefunden Aufruf des entsprechenden Bausteins
IF sy-subrc EQ 0.
CALL FUNCTION 'YEWF_GET_MISSING_URL'
DESTINATION mv_destination
CHANGING
ct_instanz = <entity>.
ENDIF.
CATCH cx_root.
ENDTRY.
ENDIF.

Ok, that's it here.

1.5 Maintain Service


Now on the GW call TA /IWFND/MAINT_SERVICE and click on new Service:



As Systemalias use "LOCAL" and check the services:



Find your service and click on it, accept the next Popup and go back.

In the overview you will now find your service with a destination LOCAL:



Here you need to change the Systemalias to point to BE.

So click on .

Copy the existing entry and change the Alias to your BE:



At least delete the entry with the alias "LOCAL".

 

2. Enhance the frontend


Now it is time to enhance th MyInbox. To do so create a new SAPUI5-Application in Eclipse as describe in the Coobook. You only need to create the Component.js and upload it to your Server.

Now it is time to test your changes: Call the URL for testing it standalone:



Oops. What's this?

Try to find the error wit the debugging tools on chrome. Hit F12

Very strange message. After debugging a while I found that an entityset i with name






'CustomAttributeDefinition' 

is called, which is not defined in my extended service class.

Solution:

Go tto the method CASE_GET_ENTITYSET and insert this lines at the beginning:
* Zusätzliche Attribute brauchen wir nicht
IF iv_entity_name = /iwpgw/if_tgw_srv_constant=>gcs_entities_v2-cust_attr_def.
RETURN.
ENDIF.

Try it again:



Voila, no error, but wait. Where is my tab with the object links?

Original:



Ok, seems that there is something missing.

Solution:

It tooked me a whole day to find the solution.

Here is what i did:

First I check the original view. .It is the S3.view.xml. Here I found something interesting:
<IconTabFilter id="MIBObjectLinksTabFilter"
icon="sap-icon://chain-link"
tooltip="{i18n>relatedObjects.tooltip}"
count="{detail>/ObjectLinksCount}"
visible="{ path: 'detail>/TaskSupports/TaskObject', formatter: 'cross.fnd.fiori.inbox.Conversions.formatterVisibilityOfObjectIconTab' }"
key="OBJECTLINKS">

<core:ExtensionPoint name="CustomerExtensionForObjectLinkTabContent">
<List id="MIBObjectLinksList" items="{path: 'detail>/ObjectLinks/results'}" >
<items>
<CustomListItem>
<Link text= "{detail>Label}" target="_blank" href = "{detail>ObjectLink}" wrapping = "true" class="crossFndFioriInboxObjectLink"/>
</CustomListItem>
</items>
</List>

</core:ExtensionPoint>
</IconTabFilter>

This is the IconTab for the ObjectLinks. As you can see the property visible is set via the backend, which is in our case the GW.

Check the coding for this. relevant is the class /IWPGW/CL_TGW_TASK_FACADE_BWF. In the method /IWPGW/IF_TGW_TASK_FACADE~READ_TASK a single task is selected from the BE and then mapped:

Ok, seems to work but in the debugger i found this:
METHOD map_task_additional_flags.

IF is_task-task_supports IS INITIAL.
map_task_status_task_supports( CHANGING is_task = is_task ).

* comments are always supported for BWF
is_task-supports_comments = abap_true.

* attachments are always supported for BWF
is_task-supports_attach = abap_true.

is_task-task_supports-comments = is_task-supports_comments.
is_task-task_supports-attachments = is_task-supports_attach.
is_task-task_supports-createdbydetails = abap_true.
is_task-task_supports-customattributedata = abap_true.
is_task-task_supports-description = abap_true.
is_task-task_supports-possibleagents = abap_true.
is_task-task_supports-potentialowners = abap_true.
is_task-task_supports-processinglogs = abap_true.
is_task-task_supports-processordetails = abap_true.
is_task-task_supports-taskdefinitiondata = abap_true.
* entityset TaskObject might return empty list in case corresponding functionality
* not available due to lower IW_BEP / SAP_GWFND SP in SAP Business Suite system
is_task-task_supports-taskobject = abap_true.
is_task-task_supports-uiexecutionlink = abap_true.

ELSE. "filled within is_task-task_supports
is_task-supports_claim = is_task-task_supports-claim.
is_task-supports_release = is_task-task_supports-release.
is_task-supports_forward = is_task-task_supports-forward.
* is_task-supports_confirm = is_task-task_supports-confirm.
* is_task-supports_resubmit = is_task-task_supports-resubmit.
* is_task-supports_cancelresubmission = is_task-task_supports-cancel_resubmission.
is_task-supports_comments = is_task-task_supports-comments.
is_task-supports_attach = is_task-task_supports-attachments.
ENDIF.

* Attention: dependent of the version different task supports in place
is_task-task_supports-taskobject = abap_false.
is_task-task_supports-confirm = abap_false.
is_task-task_supports-resubmit = abap_false.
is_task-task_supports-cancelresubmission = abap_false.

ENDMETHOD.

As you can see in the GW the flag TASKOBJECT is set to space. My first idea was just to set it in my extended class. But also the CONFIRM and the RESUBMIT is set to space. And this is something which is responsible to the Backend. So my solution is the following:

Create a subclass YCL_TGW_FASCADE which inherits from /IWPGW/CL_TGW_TASK_FACADE_BWF

Redefine the necessary methods:
CLASS ycl_tgw_fascade DEFINITION
PUBLIC
INHERITING FROM /iwpgw/cl_tgw_task_facade_bwf
FINAL
CREATE PUBLIC .

PUBLIC SECTION.
METHODS /iwpgw/if_tgw_task_facade~read_task
REDEFINITION.
METHODS /iwpgw/if_tgw_task_facade~query_tasks
REDEFINITION.
METHODS set_destination
IMPORTING
i_dest TYPE /iwbep/defi_rfc_dest.
ALIASES read_task FOR /iwpgw/if_tgw_task_facade~read_task.
ALIASES query_tasks FOR /iwpgw/if_tgw_task_facade~query_tasks.
PROTECTED SECTION.
METHODS map_task_additional_flags
REDEFINITION.
METHODS map_task_query
REDEFINITION.
PRIVATE SECTION.
CONSTANTS:
BEGIN OF gcs_bop_names,
query_tasks TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_QUERY_TASKS',
task_detail_query TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_TASK_DET_QUE',
task_detail_read TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_TASK_DET_REA',
task_definition TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/CL_TGW_TASK_DEF_BOP',
task_action TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_TASK_ACTION',
task_actions TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_TASK_ACTIONS',
task_dec_opt_act TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_TASK_DEC_OPT',
task_att_strm_cre TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_ATT_STRM_CRE',
task_att_strm_del TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_ATT_STRM_DEL',
substitutes_get TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_SUBS_GET',
substitute_upd TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_SUBS_UPD',
substitute_del TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_SUBS_DEL',
substitution TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_SUBSTITUTION',
userlist_get TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_USER_GETLIST',
userdetail_get TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_USER_GET_DET',
query_outbox TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_QUERY_OUTBOX',
scenario_count TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_SCN_COUNT',
user_details TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_USER_DETAILS',
task_expand TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_EXPAND',
substitution_profile TYPE /iwbep/mgw_bop_id VALUE '/IWPGW/WF_TGW_SUBS_PROF',
END OF gcs_bop_names.
ENDCLASS.



CLASS ycl_tgw_fascade IMPLEMENTATION.


METHOD /iwpgw/if_tgw_task_facade~read_task.
*---------------------------------------------------------------------*
* Kurzbeschreibung: Redefinition, um ein anderes Mapping aufrufen zu können
* Methode selbst ist eine Kopie der Super-Methode *
* *
* Autor:
* Datum: 02.06.2017
*---------------------------------------------------------------------*
* Änderungen *
* Grund: *
* Autor: Kürzel: *
* Datum: *
*---------------------------------------------------------------------*
DATA: lo_bop_task_det_read TYPE REF TO /iwbep/if_mgw_bop,
lo_bop_task_det_read_do TYPE REF TO /iwbep/if_mgw_bop_do,
ls_bop_request TYPE /iwpgw/wf_tgw_task_det_rea=>_params_request,
ls_bop_response TYPE /iwpgw/wf_tgw_task_det_rea=>_params_response,
lx_mgw_bop TYPE REF TO /iwbep/cx_mgw_bop.

TRY.

lo_bop_task_det_read = create_rfc_bop( gcs_bop_names-task_detail_read ).

lo_bop_task_det_read_do = lo_bop_task_det_read->get_data_object( ).

ls_bop_request-is_requested_spec-task_detail = abap_true.
ls_bop_request-iv_workitem_id = iv_instance_id.
lo_bop_task_det_read_do->set_request_generic( ls_bop_request ).

lo_bop_task_det_read->execute( lo_bop_task_det_read_do ).

CATCH /iwbep/cx_mgw_bop INTO lx_mgw_bop.
RAISE EXCEPTION TYPE /iwbep/cx_mgw_tech_exception
EXPORTING
previous = lx_mgw_bop.
ENDTRY.


lo_bop_task_det_read_do->get_response_generic( IMPORTING ev_response = ls_bop_response ).

IF ls_bop_response-et_return_users IS NOT INITIAL.
map_task_full_names( EXPORTING is_root_task = ls_bop_response-es_wi_root_detail
it_return_users = ls_bop_response-et_return_users
IMPORTING es_task = es_task ).
ELSE.
map_task_read( EXPORTING is_bop_response = ls_bop_response
IMPORTING es_task = es_task ).
ENDIF.
*Hier kommt die eigene Methode ins Spiel
map_task_additional_flags( CHANGING is_task = es_task ).

mt_return = ls_bop_response-et_return.
ENDMETHOD.


METHOD map_task_additional_flags.
*---------------------------------------------------------------------*
* Kurzbeschreibung: Redefinition, da Mapping im Stabndard falsch
* *
* *
* Autor:
* Datum: 02.06.2017
*---------------------------------------------------------------------*
* Änderungen *
* Grund: *
* Autor: Kürzel: *
* Datum: *
*---------------------------------------------------------------------*
IF is_task-task_supports IS INITIAL.
map_task_status_task_supports( CHANGING is_task = is_task ).

* comments are always supported for BWF
is_task-supports_comments = abap_true.

* attachments are always supported for BWF
is_task-supports_attach = abap_true.

is_task-task_supports-comments = is_task-supports_comments.
is_task-task_supports-attachments = is_task-supports_attach.
is_task-task_supports-createdbydetails = abap_true.
is_task-task_supports-customattributedata = abap_true.
is_task-task_supports-description = abap_true.
is_task-task_supports-possibleagents = abap_true.
is_task-task_supports-potentialowners = abap_true.
is_task-task_supports-processinglogs = abap_true.
is_task-task_supports-processordetails = abap_true.
is_task-task_supports-taskdefinitiondata = abap_true.
* entityset TaskObject might return empty list in case corresponding functionality
* not available due to lower IW_BEP / SAP_GWFND SP in SAP Business Suite system
is_task-task_supports-taskobject = abap_true.
is_task-task_supports-uiexecutionlink = abap_true.

ELSE. "filled within is_task-task_supports
is_task-supports_claim = is_task-task_supports-claim.
is_task-supports_release = is_task-task_supports-release.
is_task-supports_forward = is_task-task_supports-forward.
* is_task-supports_confirm = is_task-task_supports-confirm.
* is_task-supports_resubmit = is_task-task_supports-resubmit.
* is_task-supports_cancelresubmission = is_task-task_supports-cancel_resubmission.
is_task-supports_comments = is_task-task_supports-comments.
is_task-supports_attach = is_task-task_supports-attachments.
ENDIF.
ENDMETHOD.


METHOD set_destination.
*---------------------------------------------------------------------*
* Kurzbeschreibung: Destination aus der übergeordneten Klasse lesen
* *
* *
* Autor:
* Datum: 02.06.2017
*---------------------------------------------------------------------*
* Änderungen *
* Grund: *
* Autor: Kürzel: *
* Datum: *
*---------------------------------------------------------------------*
mv_rfc_destination = i_dest.
ENDMETHOD.
METHOD /iwpgw/if_tgw_task_facade~query_tasks.
*---------------------------------------------------------------------*
* Kurzbeschreibung: Redefiniert, um eigen Mapping-Methode aufzurufen
* Kopie der Originalmethode mit kleiner Anpassung *
* *
* Autor:
* Datum: 02.06.2017
*---------------------------------------------------------------------*
* Änderungen *
* Grund: *
* Autor: Kürzel: *
* Datum: *
*---------------------------------------------------------------------*

DATA: lo_bop_query_tasks TYPE REF TO /iwbep/if_mgw_bop,
lo_bop_query_tasks_do TYPE REF TO /iwbep/if_mgw_bop_do,
ls_bop_request TYPE /iwpgw/wf_tgw_query_tasks=>_params_request,
ls_bop_response TYPE /iwpgw/wf_tgw_query_tasks=>_params_response,
lx_mgw_bop TYPE REF TO /iwbep/cx_mgw_bop.

FIELD-SYMBOLS: <fs_select_option> TYPE /iwbep/s_mgw_select_option,
<fs_sorting_order> TYPE /iwbep/s_mgw_sorting_order.

TRY.

lo_bop_query_tasks = create_rfc_bop( gcs_bop_names-query_tasks ).

lo_bop_query_tasks_do = lo_bop_query_tasks->get_data_object( ).

* fill RFC request parameters ( interface and quesry string options )
ls_bop_request-it_filter_select_options = mt_filter_select_options.
ls_bop_request-it_order = mt_order.
ls_bop_request-is_paging = ms_paging.
ls_bop_request-iv_is_count_requested = mv_is_count_requested.
ls_bop_request-iv_is_inlinecount_requested = mv_is_inlinecount_requested.

* Change filter_select_options for PriorityNumber
READ TABLE ls_bop_request-it_filter_select_options TRANSPORTING NO FIELDS WITH KEY property = /iwpgw/cl_tgw_svc_model=>gcs_property_name-prioritynumber.
IF sy-subrc EQ 0.
* Change PriorityNumber to Priority
LOOP AT ls_bop_request-it_filter_select_options ASSIGNING <fs_select_option>
WHERE property EQ /iwpgw/cl_tgw_svc_model=>gcs_property_name-prioritynumber.
<fs_select_option>-property = /iwpgw/cl_tgw_svc_model=>gcs_property_name-priority.
ENDLOOP.
ENDIF.

* Change order for PriorityNumber
READ TABLE ls_bop_request-it_order TRANSPORTING NO FIELDS WITH KEY property = /iwpgw/cl_tgw_svc_model=>gcs_property_name-prioritynumber.
IF sy-subrc EQ 0.
* Change PriorityNumber to Priority
LOOP AT ls_bop_request-it_order ASSIGNING <fs_sorting_order>
WHERE property EQ /iwpgw/cl_tgw_svc_model=>gcs_property_name-prioritynumber.
<fs_sorting_order>-property = /iwpgw/cl_tgw_svc_model=>gcs_property_name-priority.
ENDLOOP.
ENDIF.

* Change filter_select_options for TaskDefinitionID
READ TABLE ls_bop_request-it_filter_select_options TRANSPORTING NO FIELDS
WITH KEY property = /iwpgw/if_tgw_srv_constant=>gc_task_def_id.
IF sy-subrc EQ 0.
set_taskdefid_filter_options( CHANGING ct_filter_select_options = ls_bop_request-it_filter_select_options ).
ENDIF.

lo_bop_query_tasks_do->set_request_generic( iv_request = ls_bop_request ).

lo_bop_query_tasks->execute( lo_bop_query_tasks_do ).

CATCH /iwbep/cx_mgw_bop INTO lx_mgw_bop.
RAISE EXCEPTION TYPE /iwbep/cx_mgw_tech_exception
EXPORTING
previous = lx_mgw_bop.
ENDTRY.


lo_bop_query_tasks_do->get_response_generic( IMPORTING ev_response = ls_bop_response ).

map_task_query( EXPORTING is_bop_response = ls_bop_response
IMPORTING et_tasks = et_tasks
ev_inlinecount = ev_inlinecount
ev_count = ev_count ).
mt_return = ls_bop_response-et_return.
ENDMETHOD.

METHOD map_task_query.
*---------------------------------------------------------------------*
* Kurzbeschreibung: Redefiniert wegen falschem Mapping
* *
* *
* Autor:
* Datum: 02.06.2017
*---------------------------------------------------------------------*
* Änderungen *
* Grund: *
* Autor: Kürzel: *
* Datum: *
*---------------------------------------------------------------------*
DATA:
ls_response_task LIKE LINE OF is_bop_response-et_tasks,
lt_response_users LIKE is_bop_response-et_return_users,
ls_output_task LIKE LINE OF et_tasks.


lt_response_users = is_bop_response-et_return_users.
SORT lt_response_users BY wi_id user.
DELETE ADJACENT DUPLICATES FROM lt_response_users COMPARING wi_id user.

LOOP AT is_bop_response-et_tasks INTO ls_response_task.

map_task_full_names( EXPORTING is_root_task = ls_response_task
it_return_users = lt_response_users
IMPORTING es_task = ls_output_task ).

map_task_additional_flags( CHANGING is_task = ls_output_task ).

APPEND ls_output_task TO et_tasks.
CLEAR ls_output_task.
ENDLOOP.

ev_inlinecount = is_bop_response-ev_inlinecount.
ev_count = is_bop_response-ev_count.
ENDMETHOD.

ENDCLASS.

 

In the gateway service class we need to redefine the methods CASE_GET_ENTITY, ENTITYSET_TASK and ENTITY_TASK:

CASE_GET_ENTITY:
  METHOD case_get_entity.
*---------------------------------------------------------------------*
* Kurzbeschreibung: Redefiniert, damit die Destination bekannt ist
* *
* *
* Autor:
* Datum: 02.06.2017
*---------------------------------------------------------------------*
* Änderungen *
* Grund: *
* Autor: Kürzel: *
* Datum: *
*---------------------------------------------------------------------*
* Destination merken
mv_destination = CAST /iwbep/cl_mgw_request(
io_tech_request_context )->get_request_details( )-system_alias_info-rfc_dest.
* Super-Methode aufrufen
CALL METHOD super->case_get_entity
EXPORTING
iv_entity_name = iv_entity_name
iv_entity_set_name = iv_entity_set_name
iv_source_name = iv_source_name
it_key_tab = it_key_tab
it_navigation_path = it_navigation_path
io_tech_request_context = io_tech_request_context
IMPORTING
er_entity = er_entity.

ENDMETHOD.

 

ENTITY_TASK_SET:

Here we need to call our own class. So from line 42 to 51 the relevant changes are done.
  METHOD entityset_task.
*---------------------------------------------------------------------*
* Kurzbeschreibung: Redefiniert, weil ansonsten der ObjektTab im UI fehlt
* Kopie der Super Methode *
* *
* Autor:
* Datum: 02.06.2017
*---------------------------------------------------------------------*
* Änderungen *
* Grund: *
* Autor: Kürzel: *
* Datum: *
*---------------------------------------------------------------------*
CONSTANTS: lc_method_name TYPE seomtdname VALUE 'QUERY_TASKS'. "#EC NOTEXT

DATA: lv_class_name TYPE seoclname,
lv_perf_handle_p TYPE i,
lv_provider_id TYPE /iwpgw/tgw_provider_id,
lt_tasks TYPE /iwpgw/if_tgw_types=>tt_tasks,
lo_badi_task_query TYPE REF TO /iwpgw/badi_tgw_task_query,
lt_modified_tasks TYPE /iwpgw/if_tgw_task_query=>tt_task_modified_data,
ls_modified_task LIKE LINE OF lt_modified_tasks,
lv_source_value TYPE /iwpgw/tgw_source_value,
lt_select_params TYPE string_table,
lv_count TYPE i,
lv_inlinecount TYPE i.

FIELD-SYMBOLS: <fs_task> TYPE /iwpgw/if_tgw_types=>ty_task.

*For the Context service URL
DATA lt_service_context TYPE /iwpgw/t_tgw_context_cust.
DATA ls_service_context TYPE LINE OF /iwpgw/t_tgw_context_cust.
DATA lo_context_config TYPE REF TO /iwpgw/cl_tgw_config.

* Get class name for Performance Trace
lv_class_name = /iwpgw/cl_tgw_runtime_util=>get_class_name( mo_task_facade ).

* Performance Trace START
lv_perf_handle_p = /iwbep/cl_diagnostics_facade=>performance_start( iv_class_name = lv_class_name
iv_method_name = lc_method_name ).

* Wir brauchen hier unsere eigen Klasse
data(lo_fascade) = new ycl_tgw_fascade( ).
* destination setzen
lo_fascade->set_destination( mv_destination ).
* Daten abrufen
CALL METHOD lo_fascade->query_tasks
IMPORTING
et_tasks = lt_tasks
ev_count = lv_count
ev_inlinecount = lv_inlinecount.

* Performance Trace STOP
/iwbep/cl_diagnostics_facade=>performance_stop( lv_perf_handle_p ).

* Get $count or $inlinecount information if requested
IF io_tech_request_context->has_count( ) EQ abap_true.
"Calculate and return only count - no entry specific data required
IF lv_count IS INITIAL AND lt_tasks IS NOT INITIAL.
DESCRIBE TABLE lt_tasks LINES lv_count.
ENDIF.
es_response_context-count = lv_count.
RETURN.
ELSEIF io_tech_request_context->has_inlinecount( ) EQ abap_true.
es_response_context-inlinecount = lv_inlinecount.
ENDIF.

lv_provider_id = mo_task_facade->get_provider_id( ).

TRY.
GET BADI lo_badi_task_query
FILTERS
provider_id = lv_provider_id.

CALL BADI lo_badi_task_query->modify_items
EXPORTING
iv_provider_id = lv_provider_id
it_tasks = lt_tasks
CHANGING
ct_modified_tasks = lt_modified_tasks.

*Read the services from the configuration
lo_context_config = /iwpgw/cl_tgw_config=>get_instance( ).
lo_context_config->get_service_by_tasks( IMPORTING et_service_context = lt_service_context ).

LOOP AT lt_tasks ASSIGNING <fs_task>.
READ TABLE lt_modified_tasks INTO ls_modified_task WITH KEY instance_id = <fs_task>-inst_id.
IF sy-subrc EQ 0.
<fs_task>-task_title = ls_modified_task-task_title.
ENDIF.

* Map status and priority values
CLEAR lv_source_value.
lv_source_value = <fs_task>-priority.
<fs_task>-priority = map_task_properties( iv_filter_type = gcs_filter_types-priority
iv_source_value = lv_source_value ).
CLEAR lv_source_value.
lv_source_value = <fs_task>-status.
<fs_task>-status = map_task_properties( iv_filter_type = gcs_filter_types-status
iv_source_value = lv_source_value ).
*Fill the service Context URL
READ TABLE lt_service_context WITH KEY task_id = <fs_task>-task_def_id "#EC *
INTO ls_service_context.
IF sy-subrc = 0.
<fs_task>-service_url = build_service_url( iv_service_tech_name = ls_service_context-svc_tech_name
iv_version = ls_service_context-svc_version ) .
ENDIF.
CLEAR ls_service_context.
ENDLOOP.

CATCH cx_badi_not_implemented. "#EC NO_HANDLER

ENDTRY.

CALL METHOD copy_data_to_ref
EXPORTING
is_data = lt_tasks
CHANGING
cr_data = er_entityset.

ENDMETHOD.

 

ENTITY_TASK

Here we have the same to do as above. The cjanges are in line 32 - 39:
 METHOD entity_task.
*---------------------------------------------------------------------*
* Kurzbeschreibung: Redefiniert, weil ansonsten der ObjektTab im UI fehlt
* Unterschied: Wir nehmen eine eigen Fascade-Klasse *
* *
* Autor:
* Datum: 02.06.2017
*---------------------------------------------------------------------*
* Änderungen *
* Grund: *
* Autor: Kürzel: *
* Datum: *
*---------------------------------------------------------------------*
CONSTANTS: lc_method_name TYPE seomtdname VALUE 'READ_TASK'. "#EC NOTEXT

DATA: lv_class_name TYPE seoclname,
lv_perf_handle_p TYPE i,
ls_task TYPE /iwpgw/if_tgw_types=>ty_task,
lv_task_id TYPE /iwpgw/tgw_instance_id,
lo_expand TYPE REF TO /iwpgw/if_tgw_expandable,
lo_fascade TYPE REF TO ycl_tgw_fascade.

lv_task_id = extract_instance_id( it_key_tab ).

* Get class name for Performance Trace
lv_class_name = /iwpgw/cl_tgw_runtime_util=>get_class_name( mo_task_facade ).

* Performance Trace START
lv_perf_handle_p = /iwbep/cl_diagnostics_facade=>performance_start( iv_class_name = lv_class_name
iv_method_name = lc_method_name ).

* Nicht die Originalklasse nehmen, sondern eine Eigene
CREATE OBJECT lo_fascade.
lo_fascade->set_destination( mv_destination ).
CALL METHOD lo_fascade->read_task
EXPORTING
iv_instance_id = lv_task_id
IMPORTING
es_task = ls_task.

* Performance Trace call provider STOP
/iwbep/cl_diagnostics_facade=>performance_stop( lv_perf_handle_p ).

* Continue only if we can read the task header
IF ls_task IS NOT INITIAL.

update_task_details_from_cust( CHANGING cs_task = ls_task ).

CALL METHOD copy_data_to_ref
EXPORTING
is_data = ls_task
CHANGING
cr_data = rr_entity.

ENDIF.
ENDMETHOD.

Activate and try it again:



Now it is working. 🙂

If I run in additional problems I will continue to write blogs.

Have a nice day.

 
Labels in this area