{"id":274,"date":"2025-05-20T09:35:22","date_gmt":"2025-05-20T09:35:22","guid":{"rendered":"https:\/\/sapabap.dwimansolution.com\/?p=274"},"modified":"2025-05-20T09:35:23","modified_gmt":"2025-05-20T09:35:23","slug":"sap-abap-workflow-agents-cds","status":"publish","type":"post","link":"https:\/\/sapabap.dwimansolution.com\/index.php\/2025\/05\/20\/sap-abap-workflow-agents-cds\/","title":{"rendered":"SAP ABAP &#8211; Workflow Agents CDS"},"content":{"rendered":"\n<ol>\n<li><strong>ZI_SWAgent<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>@AbapCatalog.viewEnhancementCategory: &#91;#NONE]\r\n@AccessControl.authorizationCheck: #NOT_REQUIRED\r\n@EndUserText.label: 'Workflow Agent'\r\n@Metadata.ignorePropagatedAnnotations: true\r\n@ObjectModel.usageType:{\r\n    serviceQuality: #X,\r\n    sizeCategory: #S,\r\n    dataClass: #MIXED\r\n}\r\ndefine view entity ZI_SWAgent\r\n  as select from swwwihead as _Head\r\n  association &#91;1..1] to swwwipagent          as _Agent        on  $projection.wi_id = _Agent.wi_id\r\n  association &#91;1..1] to swwuserwi            as _CurrentAgent on  $projection.wi_id    =  _CurrentAgent.wi_id\r\n                                                              and _CurrentAgent.no_sel &lt;> 'X'\r\n  association &#91;0..1] to I_WorkflowTaskResult as _Result       on  $projection.wi_id = _Result.WorkflowTaskInternalID\r\n{\r\n  key   wi_id,\r\n  key\r\n        case wi_stat\r\n            when 'COMPLETED' then _Agent.user_id\r\n            when 'CANCELLED' then _Agent.user_id\r\n            else  _CurrentAgent.user_id end as user_id,\r\n        wi_stat,\r\n        wi_aagent,\r\n        top_wi_id,\r\n        top_task,\r\n        _Result.WorkflowTaskResultNature,\r\n        _Result.WorkflowTaskResult,\r\n        _Result.WorkflowTaskResultComment,\r\n\r\n        case wi_stat when 'COMPLETED' then\r\n          case _Agent.user_id when wi_aagent then 'X'\r\n          else ' ' end\r\n        else ' ' end                        as lastAgentIndicator\r\n}\r\nwhere\r\n  wi_type = 'W'\r\n<\/code><\/pre>\n\n\n\n<p><strong>2. ZI_SWAgentFiltered<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@AbapCatalog.viewEnhancementCategory: &#91;#NONE]\r\n@AccessControl.authorizationCheck: #NOT_REQUIRED\r\n@EndUserText.label: 'Workflow Agent'\r\n@Metadata.ignorePropagatedAnnotations: true\r\n@ObjectModel.usageType:{\r\n    serviceQuality: #X,\r\n    sizeCategory: #S,\r\n    dataClass: #MIXED\r\n}\r\ndefine view entity ZI_SWAgentFiltered\r\n  as select from ZI_SWAgent\r\n{\r\n  key wi_id,\r\n  key user_id,\r\n      wi_stat,\r\n      wi_aagent,\r\n      top_wi_id,\r\n      top_task,\r\n      WorkflowTaskResultNature,\r\n      WorkflowTaskResult,\r\n      WorkflowTaskResultComment,\r\n      lastAgentIndicator\r\n}\r\nwhere\r\n     wi_stat            &lt;> 'COMPLETED'\r\n  or lastAgentIndicator =  'X'\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>2. ZI_SWAgentFiltered<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/sapabap.dwimansolution.com\/index.php\/wp-json\/wp\/v2\/posts\/274"}],"collection":[{"href":"https:\/\/sapabap.dwimansolution.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sapabap.dwimansolution.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sapabap.dwimansolution.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sapabap.dwimansolution.com\/index.php\/wp-json\/wp\/v2\/comments?post=274"}],"version-history":[{"count":1,"href":"https:\/\/sapabap.dwimansolution.com\/index.php\/wp-json\/wp\/v2\/posts\/274\/revisions"}],"predecessor-version":[{"id":275,"href":"https:\/\/sapabap.dwimansolution.com\/index.php\/wp-json\/wp\/v2\/posts\/274\/revisions\/275"}],"wp:attachment":[{"href":"https:\/\/sapabap.dwimansolution.com\/index.php\/wp-json\/wp\/v2\/media?parent=274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sapabap.dwimansolution.com\/index.php\/wp-json\/wp\/v2\/categories?post=274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sapabap.dwimansolution.com\/index.php\/wp-json\/wp\/v2\/tags?post=274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}