I_SDDOCSTANDARDPARTNER

CDS View

SD Document Standard Partner

I_SDDOCSTANDARDPARTNER is a CDS View in S/4HANA. SD Document Standard Partner. It contains 3 fields. 2 CDS views read from this table.

CDS Views using this table (2)

ViewTypeJoinVDMDescription
C_ESJIQuotationQuery view left_outer CONSUMPTION Quotation
C_ESJISalesOrderQuery view left_outer CONSUMPTION Incoming Sales Orders

Fields (3)

KeyField CDS FieldsUsed in Views
ResponsibleEmployee ResponsibleEmployee 2
SalesEmployee SalesEmployee 2
ShipToParty ShipToParty 2
@ClientHandling.algorithm: #SESSION_VARIABLE 
@ObjectModel.usageType.dataClass: #MIXED 
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.sizeCategory: #XL 
@EndUserText.label: 'SD Document Standard Partner'
@VDM.viewType: #COMPOSITE
@AccessControl.authorizationCheck: #PRIVILEGED_ONLY
@AccessControl.personalData.blocking: #NOT_REQUIRED
@AbapCatalog.sqlViewName: 'ISDDOCSTDPART'
@AbapCatalog.preserveKey: true
@AbapCatalog.compiler.compareFilter: true

define view I_SDDocStandardPartner
  // P_SDDocStandardPartner1: Get all distinct sd document to get rid of duplicated items

  as select from           P_SDDocStandardPartner1 as AllSDDocs

    left outer to one join I_SDDocumentPartner     as SoldToParty         on  AllSDDocs.SDDocument        = SoldToParty.SDDocument
                                                                          and SoldToParty.PartnerFunction = 'AG'
    left outer to one join I_SDDocumentPartner     as ShipToParty         on  AllSDDocs.SDDocument        = ShipToParty.SDDocument
                                                                          and ShipToParty.PartnerFunction = 'WE'
    left outer to one join I_SDDocumentPartner     as BillToParty         on  AllSDDocs.SDDocument        = BillToParty.SDDocument
                                                                          and BillToParty.PartnerFunction = 'RE'
    left outer to one join I_SDDocumentPartner     as PayerParty          on  AllSDDocs.SDDocument        = PayerParty.SDDocument
                                                                          and PayerParty.PartnerFunction  = 'RG'
    left outer to one join I_SDDocumentPartner     as SalesEmployee       on  AllSDDocs.SDDocument        = SalesEmployee.SDDocument 
                                                                          and SalesEmployee.PartnerFunction = 'VE'
    left outer to one join I_SDDocumentPartner     as ResponsibleEmployee on AllSDDocs.SDDocument        = ResponsibleEmployee.SDDocument 
                                                                          and ResponsibleEmployee.PartnerFunction = 'ZM'
//    left outer to one join I_Employment            as SalesEmployee2      on SalesEmployee1.Personnel     = SalesEmployee2.EmploymentInternalID

//    left outer to one join I_Employment            as ResponsibleEmployee2 on ResponsibleEmployee1.Personnel = ResponsibleEmployee2.EmploymentInternalID

      
  association [0..1] to I_Customer as _SoldToParty         on $projection.SoldToParty = _SoldToParty.Customer
  association [0..1] to I_Customer as _BillToParty         on $projection.BillToParty = _BillToParty.Customer
  association [0..1] to I_Customer as _ShipToParty         on $projection.ShipToParty = _ShipToParty.Customer
  association [0..1] to I_Customer as _PayerParty          on $projection.PayerParty  = _PayerParty.Customer

//  association [0..1] to I_Employee as _SalesEmployee       on $projection.SalesEmployee       = _SalesEmployee.PersonnelNumber

//  association [0..1] to I_Employee as _ResponsibleEmployee on $projection.ResponsibleEmployee = _ResponsibleEmployee.PersonnelNumber

  association [0..1] to I_PersonWorkAgreement_1 as _SalesEmployee       on $projection.SalesEmployee       = _SalesEmployee.PersonWorkAgreement
  association [0..1] to I_PersonWorkAgreement_1 as _ResponsibleEmployee on $projection.ResponsibleEmployee = _ResponsibleEmployee.PersonWorkAgreement
{
  key AllSDDocs.SDDocument,

      @ObjectModel.foreignKey.association: '_SoldToParty'
      cast(SoldToParty.Customer as kunag preserving type)      as SoldToParty,

      @ObjectModel.foreignKey.association: '_ShipToParty'
      cast(ShipToParty.Customer as kunwe preserving type)      as ShipToParty,

      @ObjectModel.foreignKey.association: '_BillToParty'
      cast(BillToParty.Customer as kunre preserving type)      as BillToParty,

      @ObjectModel.foreignKey.association: '_PayerParty'
      cast(PayerParty.Customer as kunrg preserving type)       as PayerParty,

      @ObjectModel.foreignKey.association: '_SalesEmployee'
      cast(SalesEmployee.Personnel as sales_empl preserving type) as SalesEmployee,

      @ObjectModel.foreignKey.association: '_ResponsibleEmployee'
      cast(ResponsibleEmployee.Personnel as resp_empl preserving type) as ResponsibleEmployee,
      
      //Sales Employee ID & Responsible Employee ID

      cast(SalesEmployee.Personnel as sales_empl preserving type) as SalesEmployeeWorkAgreement,
      cast(ResponsibleEmployee.Personnel as resp_empl preserving type) as ResponsibleEmployeeWorkAgrmt, 

      _SoldToParty,
      _BillToParty,
      _ShipToParty,
      _PayerParty,
      _SalesEmployee,
      _ResponsibleEmployee
};