@AbapCatalog.sqlViewName: 'PPURORDERSFS'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@VDM.viewType: #BASIC
@VDM.private: true
//@EndUserText.label: 'Private factsheet - Purchase Orders'
define view P_Purchaseorders_Fs
as select from I_PurchasingDocument as PurchaseDoc
left outer join I_PurchasingDocumentItem as PurchaseDocItem on PurchaseDocItem.PurchasingDocument = PurchaseDoc.PurchasingDocument
left outer join I_CompanyCode as Company on PurchaseDoc.CompanyCode = Company.CompanyCode //getting company name
left outer join I_PurchasingGroup as PurgGroup on PurchaseDoc.PurchasingGroup = PurgGroup.PurchasingGroup //group name
left outer join I_PurchasingOrganization as PurgOrg on PurchaseDoc.PurchasingOrganization = PurgOrg.PurchasingOrganization //org name
left outer join P_Usercontactcard_Fs as UserName on UserName.UserID = PurchaseDoc.CreatedByUser //full name
left outer join P_Prchinforecordslang_Fs as Supplier on Supplier.Supplier = PurchaseDoc.Supplier //full name
left outer join I_PurchasingDocumentTypeText as DocumentTypeName on DocumentTypeName.Language = PurchaseDoc.Language
and DocumentTypeName.PurchasingDocumentCategory = PurchaseDoc.PurchasingDocumentCategory
and DocumentTypeName.PurchasingDocumentType = PurchaseDoc.PurchasingDocumentType
left outer join P_PlantAddrDetails_Fs as PlantData on PlantData.Plant = PurchaseDoc.SupplyingPlant
//inner join P_Supplier_Fs as SupName on PurchaseDoc.Supplier = SupName.Supplier //supplier name
//define view P_Purchaseorders_Fs as select from I_PurchasingDocument as PurchaseDoc
//inner join I_PurchasingDocumentItem as PurchaseDocItem on PurchaseDoc.PurchasingDocument = PurchaseDocItem.PurchasingDocument and PurchaseDocItem.CompanyCode = PurchaseDoc.CompanyCode
//left outer join I_CompanyCode as Company on PurchaseDoc.CompanyCode = Company.CompanyCode //getting company name
//left outer join I_PurchasingGroup as PurgGroup on PurchaseDoc.PurchasingGroup = PurgGroup.PurchasingGroup //group name
//left outer join I_PurchasingOrganization as PurgOrg on PurchaseDoc.PurchasingOrganization = PurgOrg.PurchasingOrganization //org name
//left outer join P_Supplier_Fs as SupName on PurchaseDoc.Supplier = SupName.Supplier //supplier name
{
key PurchaseDoc.PurchasingDocument as PurchasingDocument, //check ........
// key PurchaseDocItem.Plant as Plant,
//key PurchaseDocItem.PurchasingDocumentItem as PurchasingDocumentItem,
PurchaseDoc.CompanyCode as CompanyCode,
//PurchaseDocItem.PurchasingDocumentItem as PurchasingDocumentItem,
PurchaseDocItem.Material as Material,
// PurchaseDocItem.PurchasingDocumentItem as PurchasingDocumentItem,
Company.CompanyCodeName as CompanyCodeName,
UserName.PersonFullName,
// Supplier.name1,
case PurchaseDoc.PurchasingDocumentDeletionCode
when 'S' then 'Locked'
when 'L' then 'Yes'
else 'No'
end as PurchasingDocumentDeletionCode,
//PurchaseDoc.PurchasingDocumentDeletionCode as PurchasingDocumentDeletionCode,
PurchaseDoc.IncotermsClassification as IncotermsClassification,
PurchaseDoc.IncotermsTransferLocation as IncotermsTransferLocation,
//cast (PurchaseDoc.PurchasingOrganization as P_PURCHORG preserving type) as PurchasingOrganization,
PurchaseDoc.PurchasingGroup as PurchasingGroup,
PurchaseDoc.PurchasingOrganization as PurchasingOrganization,
Supplier.AdditionalName,
//@Semantics: { name.fullName: true }
// concat_with_space(Supplier.SupplierName, Supplier.AdditionalName, 1) as FormattedName,
//@ObjectModel: { text.element: [ 'FormattedName' ], readOnly: true }
PurchaseDoc.Supplier as Supplier,
PurchaseDoc.SupplyingPlant as SupplyingPlant,
PurchaseDoc.PaymentTerms as PaymentTerms,
PurchaseDoc.PurchaseContract as PurchaseContract,
PurchaseDoc.CreatedByUser as CreatedByUser,
PurchaseDoc.DocumentCurrency as DocumentCurrency,
PurchaseDoc.PurchasingDocumentOrderDate as PurchasingDocumentOrderDate,
PurchaseDoc.CreationDate as CreationDate,
PurchaseDoc.PurchasingDocumentType as PurchasingDocumentType,
PurgGroup.PurchasingGroupName as PurchasingGroupName,
PurgOrg.PurchasingOrganizationName as PurchasingOrganizationName,
Concat(Concat(concat_with_space(Supplier.SupplierName , '(', 1),ltrim(PurchaseDoc.Supplier, '0')),')') as SupplierName,
//SupName.SupplierName as SupplierName
//sum(PurchaseDoc.DocumentCurrency)as doccur
PurchaseDoc.PurchasingDocumentCategory as PurchasingDocumentCategory,
PurchaseDoc.Language as Language,
DocumentTypeName.PurchasingDocumentTypeName as PurchasingDocumentTypeName,
PlantData.PlantName as PlantName
}
group by
PurchaseDoc.PurchasingDocument,
//PurchaseDocItem.PurchasingDocumentItem ,
PurchaseDoc.CompanyCode,
PurchaseDocItem.Material,
Company.CompanyCodeName,
Supplier.SupplierName,
UserName.PersonFullName,
PurchaseDoc.PurchasingDocumentDeletionCode,
PurchaseDoc.IncotermsClassification,
PurchaseDoc.IncotermsTransferLocation,
PurchaseDocItem.Plant,
PurchaseDoc.PurchasingGroup,
PurchaseDoc.PurchasingOrganization,
Supplier.AdditionalName,
PurchaseDoc.Supplier,
PurchaseDoc.SupplyingPlant,
PurchaseDoc.PaymentTerms,
PurchaseDoc.PurchaseContract,
PurchaseDoc.CreatedByUser,
PurchaseDoc.DocumentCurrency,
PurchaseDoc.PurchasingDocumentOrderDate,
PurchaseDoc.CreationDate,
PurchaseDoc.PurchasingDocumentType,
PurgGroup.PurchasingGroupName,
PurgOrg.PurchasingOrganizationName,
PurchaseDoc.PurchasingDocumentCategory,
PurchaseDoc.Language,
DocumentTypeName.PurchasingDocumentTypeName,
PlantData.PlantName
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_COMPANYCODE",
"I_PURCHASINGDOCUMENT",
"I_PURCHASINGDOCUMENTITEM",
"I_PURCHASINGDOCUMENTTYPETEXT",
"I_PURCHASINGGROUP",
"I_PURCHASINGORGANIZATION",
"P_PLANTADDRDETAILS_FS",
"P_PRCHINFORECORDSLANG_FS",
"P_USERCONTACTCARD_FS"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/