I_DOCWORKFLOWINFO
Composite:document and workflow info
I_DOCWORKFLOWINFO is a CDS View in S/4HANA. Composite:document and workflow info. It contains 2 fields. 1 CDS views read from this table.
CDS Views using this table (1)
| View | Type | Join | VDM | Description |
|---|---|---|---|---|
| I_DocSingleWorkflowInfo | view | from | COMPOSITE | one document to single workflow |
Fields (2)
| Key | Field | CDS Fields | Used in Views |
|---|---|---|---|
| Batch | Batch | 1 | |
| ObjectKey | ObjectKey | 1 |
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.sqlViewName: 'IDOCTOWFINFO'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.representativeKey: 'AccountingDocument'
@VDM.viewType: #COMPOSITE
@EndUserText.label: 'Composite:document and workflow info'
@Consumption.dbHints: [ 'USE_HEX_PLAN', 'NO_SUBPLAN_SHARING' ]
define view I_DocWorkflowInfo
as select from P_DocToWorkitem as _doc
// inner join I_WorkflowLatestTask as _doc on _doc.Workflow = _doc.Workflow
// and _doc.WorkItem = _doc.WorkItem
left outer join I_WorkflowMyDecisionStatus as _myDesicion on _doc.Workflow = _myDesicion.Workflow
//left outer join I_WorkflowDecisionStatus as _latestDesicion on _doc.Workflow = _latestDesicion.Workflow
association [1..1] to I_CompanyCode as _CompanyCode on $projection.CompanyCode = _CompanyCode.CompanyCode
//association [1..1] to I_CompanyCode as _SourceCompanyCode on $projection.SourceCompanyCode = _SourceCompanyCode.CompanyCode
association [0..1] to I_FiscalYearForCompanyCode as _FiscalYear on $projection.FiscalYear = _FiscalYear.FiscalYear
and $projection.CompanyCode = _FiscalYear.CompanyCode
{
//@ObjectModel.foreignKey.association: '_SourceCompanyCode'
//key _doc.CompanyCode as SourceCompanyCode,
@ObjectModel.foreignKey.association: '_CompanyCode'
key _doc.CompanyCode,
key _doc.AccountingDocument,
@ObjectModel.foreignKey.association: '_FiscalYear'
key _doc.FiscalYear,
_doc.AccountingDocumentType,
_doc.ReferenceDocument,
_doc.DocumentDate,
_doc.FiscalPeriod,
_doc.LastChangeDate,
_doc.LedgerGroup,
_doc.HeaderDescription,
_doc.PostingDate,
_doc.CreatedByUser,
_doc.CreationDateTime,
_doc.AccountingDocumentCreationDate,
//_doc.RequisitionerName,
//_doc.Processor,
_doc.ObjectKey,
_doc.TransactionCode,
_doc.ParkingTransactionCode,
_doc.Currency,
_doc.CompanyCodeCurrency,
_doc.GlobalCurrency,
_doc.FreeDefinedCurrency1,
_doc.AccountingDocumentCategory,
/* changed by i337033 2020-01-02
enable currency adjustement workflow*/
cast ( case when _doc.AccountingDocumentCategory = '' or //general journal entry
_doc.AccountingDocumentCategory = 'U' or //currency adjustment
_doc.AccountingDocumentCategory = 'L' //Posting Not in Leading Ledger
then 'P'
when _doc.AccountingDocumentCategory = 'Z'
then 'D'
when _doc.AccountingDocumentCategory = 'V'
//parked document
then
(
case when _doc.Workflow is initial or _doc.Workflow is null
then 'N' //no workfow created
when _doc.JournalEntryWorkflowStatus = 'ERROR'// or _doc.JournalEntryWorkflowStatus = 'CANCELLED'
then 'F' //workflow status error
when _doc.JournalEntryWorkflowStatus = 'CANCELLED' then 'C'
when _doc.JournalEntryWorkflowStatus = 'COMPLETED'
//Workflow finished
then ( case when _doc.AccountingDocumentStatus is initial or _doc.AccountingDocumentStatus is null
or _doc.AccountingDocumentStatus = 'A'// workflow completed + approved, but stil is parked document
then 'F'
else _doc.AccountingDocumentStatus end )
else // ready, in process
(case when _doc.AccountingDocumentStatus is initial or _doc.AccountingDocumentStatus is null
then 'S'
else _doc.AccountingDocumentStatus end ) end
) end as fac_decision_status ) as AccountingDocumentStatus,
_doc.JournalEntryWorkflowStatus,
/* changed end */
// case when _doc.AccountingDocumentStatus = 'A' and _doc.WorkflowTaskStatus = 'COMPLETED' and _doc.AccountingDocumentCategory <> 'V'
// then 'A'
// // for posting automatically
// when _doc.AccountingDocumentStatus is null and _doc.WorkflowTaskStatus = 'COMPLETED' and _doc.AccountingDocumentCategory <> 'V'
// then 'A'
// when (_doc.AccountingDocumentStatus = 'R' ) or //and _doc.TaskProcessingStatus = 'COMPLETED') or
// //Redo Step
// (_doc.WorkflowTaskDefinition = 'TS00008267' and
// (_doc.WorkflowTaskStatus = 'READY' or _doc.WorkflowTaskStatus = 'SELECTED' or _doc.WorkflowTaskStatus = 'STARTED' ) )
// then 'R'
// when _doc.Workflow is null
// then 'N'
// when _doc.WorkflowTaskStatus = 'READY' or _doc.WorkflowTaskStatus = 'SELECTED' or _doc.WorkflowTaskStatus = 'STARTED'
// then 'S'
// when _doc.WorkflowTaskStatus = 'WAITING'
// then 'W'
// when _doc.WorkflowTaskStatus = 'ERROR'
// then 'F' // last step is error
// when _doc.WorkflowTaskStatus = 'CANCELLED'
// then 'F'
// when _doc.WorkflowTaskStatus = 'COMPLETED' and AccountingDocumentCategory = 'V'
// //Add by i337033 2018/11/22
// //for intercompany case, only when one instant has been approved, document status should still be S
// then
// ( case when _doc.AccountingDocumentStatus is null // is null means it contains dialog instance to be approved, or dialog Redo (Reject has been determinted)
// then 'S'
// else 'F' end )
//// then 'F' // verify step is completed but entire wf error
// //when AccountingDocumentCategory = 'Z' then 'D'
// else '' // easy to detect other status once inconsistency
// end as AccountingDocumentStatus,
_doc.Workflow,
_doc.WorkItem as WorkflowTaskInternalID,
// key _WorkflowLatestTask.WorkItem,
// substring(instid,1,10) as AccountingDocument,
// substring(instid,11,4) as CompanyCode,
// substring(instid,15,4) as FiscalYear,
_doc.ReleaseDateTime,
// Workitem calculation always follow the rule that if there is decision existing, then get the last decision workflow
// so this is an limitation in the case of multiple level workflow, if one documect is approve and go into next level,
// in the inbox, workitem is send as decision workitem by workflow framework, but in verification worklist, the processor
// function always send the last workitem of workflow, then it causes conflict, after discussion, the processor function
// has to be implemented in abap class
case when _myDesicion.WorkItem is not null
then _myDesicion.WorkItem
else _doc.WorkItem
end as WorkItem,
_doc.WorkflowTaskDefinition, // to get latest task id (TSXXX)
case when _myDesicion.WorkItem is not null
then _myDesicion.TaskProcessingStatus
else _doc.WorkflowTaskStatus
end as TaskProcessingStatus,
// auto reversal
_doc.ReversalReason,
_doc.PlannedReversalDate,
_doc.WorkflowTaskType,
_doc.WorkflowTaskPriority,
_doc.WorkflowTaskStatus,
_doc.ParkedByUser,
_doc.Batch,
_doc.IntercompanyTransaction,
_CompanyCode,
_FiscalYear
//_SourceCompanyCode
}