Skip to Content
Technical Articles

Relatório de romaneio

Quando a transportadora vem buscar a carga na empresa, existe a necessidade de mandar um documento com todas as notas fiscais que foram embarcadas e algumas informações como valor, volumetria, peso e cliente “Romaneio”.

Essa informação serve para facilitar o trabalho da transportadora na organização das entregas.

Montei um cubo para coletar as informações do banco Hana.

@AccessControl.authorizationCheck: #CHECK
@AbapCatalog.compiler.compareFilter: true
@DataAging.noAgingRestriction: true
@EndUserText.label: 'Romaneio'
@AbapCatalog.sqlViewName: 'ZCROMANEIO'
@Analytics.dataCategory: #CUBE
@Search.searchable: false
//ajust
define view ZC_ROMANEIO
  as select from I_BillingDocumentPartner as I_BillingDocumentPartner
  association [0..1] to I_Customer               as _I_Customer_1            on  _I_Customer_1.Customer = I_BillingDocumentPartner.Supplier
  association [0..*] to I_BillingDocumentItem    as _I_BillingDocumentItem_2 on  _I_BillingDocumentItem_2.BillingDocument = I_BillingDocumentPartner.BillingDocument
  association [1..1] to I_BillingDocumentPartner as _CKE_toBase              on  _CKE_toBase.BillingDocument = I_BillingDocumentPartner.BillingDocument
                                                                             and _CKE_toBase.PartnerFunction = I_BillingDocumentPartner.PartnerFunction
{
      @EndUserText.label: 'Billing Document'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
  key I_BillingDocumentPartner.BillingDocument                                                                          as BillingDocument,
      @EndUserText.label: 'Partner Function'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
  key I_BillingDocumentPartner.PartnerFunction                                                                          as PartnerFunction,
      @EndUserText.label: 'Vendor'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
      I_BillingDocumentPartner.Supplier                                                                                 as Supplier,
      @EndUserText.label: 'Name of Customer'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
      @Semantics.text: true
      _I_Customer_1.CustomerName                                                                                        as CustomerName,
      @EndUserText.label: 'Billing Date'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
      I_BillingDocumentPartner._BillingDocument.BillingDocumentDate                                                     as BillingDocumentDate,
      @EndUserText.label: 'Document Currency'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
      @Semantics.currencyCode: true
      I_BillingDocumentPartner._BillingDocument.TransactionCurrency                                                     as TransactionCurrency,
      @EndUserText.label: 'Gross weight'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
      @Semantics.quantity.unitOfMeasure: 'ItemWeightUnit'
      @Aggregation.default: #SUM
      _I_BillingDocumentItem_2.ItemGrossWeight                                                                          as ItemGrossWeight,
      @EndUserText.label: 'Net weight'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
      @Semantics.quantity.unitOfMeasure: 'ItemWeightUnit'
      @Aggregation.default: #SUM
      _I_BillingDocumentItem_2.ItemNetWeight                                                                            as ItemNetWeight,
      @EndUserText.label: 'Weight unit'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
      @Semantics.unitOfMeasure: true
      _I_BillingDocumentItem_2.ItemWeightUnit                                                                           as ItemWeightUnit,
      @EndUserText.label: 'Volume'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
      @Semantics.quantity.unitOfMeasure: 'ItemVolumeUnit'
      @Aggregation.default: #SUM
      _I_BillingDocumentItem_2.ItemVolume                                                                               as ItemVolume,
      @EndUserText.label: 'Volume unit'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
      @Semantics.unitOfMeasure: true
      _I_BillingDocumentItem_2.ItemVolumeUnit                                                                           as ItemVolumeUnit,
      @EndUserText.label: 'Region'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
      I_BillingDocumentPartner._BillingDocument.Region                                                                  as Region,
      @EndUserText.label: 'Partner Function Name'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
      @Semantics.text: true
      I_BillingDocumentPartner._PartnerFunction._Text.PartnerFunctionName                                               as PartnerFunctionName,
      @EndUserText.label: 'Name of Customer'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
      @Semantics.text: true
      I_BillingDocumentPartner._BillingDocument._PayerParty.CustomerName                                                as CustomerName_3,
      @EndUserText.label: 'Customer'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
      I_BillingDocumentPartner._BillingDocument._PayerParty.Customer                                                    as Customer,
      @EndUserText.label: 'City'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
      I_BillingDocumentPartner._BillingDocument._PayerParty.CityName                                                    as CityName,
      @EndUserText.label: 'Reference'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
      I_BillingDocumentPartner._BillingDocument.DocumentReferenceID                                                     as DocumentReferenceID,
      @EndUserText.label: 'Net Value'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
      @Semantics.amount.currencyCode: 'TransactionCurrency'
      @Aggregation.default: #SUM
      _I_BillingDocumentItem_2.NetAmount                                                                                as NetAmount,
      @EndUserText.label: 'Tax Amount'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
      @Semantics.amount.currencyCode: 'TransactionCurrency'
      @Aggregation.default: #SUM
      _I_BillingDocumentItem_2.TaxAmount                                                                                as TaxAmount,
      @EndUserText.label: 'Number of Packages'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      @Consumption.filter.mandatory: false
      @Consumption.filter.multipleSelections: false
      @Aggregation.default: #SUM
      cast(_I_BillingDocumentItem_2._ReferenceDeliveryDocumentItem._DeliveryDocument.TotalNumberOfPackage as abap.int4) as TotalNumberOfPackage,
      @EndUserText.label: 'Material'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      _I_BillingDocumentItem_2.Material                                                                                 as material,
      @EndUserText.label: 'Document Type'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      I_BillingDocumentPartner._BillingDocument.BillingDocumentType                                                     as BillingDocumentType,
      @EndUserText.label: 'Document is Cancelled'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      I_BillingDocumentPartner._BillingDocument.BillingDocumentIsCancelled                                              as BillingDocumentIsCancelled,
      @EndUserText.label: 'Document is Temporary'
      @ObjectModel.text.element: null
      @Consumption.hidden: false
      I_BillingDocumentPartner._BillingDocument.BillingDocumentIsTemporary                                              as BillingDocumentIsTemporary,
      @ObjectModel.text.element: null
      @Consumption.hidden: true
      _CKE_toBase                                                                                                       as _CKE_toBase
}

E montei a query para consumir as informações.

@AbapCatalog.sqlViewName : 'ZCROMANEIOQ'
@Analytics.query: true
@OData.publish: true
@EndUserText.label: 'Romaneio'
define view ZC_ROMANEIOQ
  as select from ZC_ROMANEIO
{

    //ajust
  @EndUserText.label: 'Transportadora'

  CustomerName,
  @AnalyticsDetails.query.axis:#ROWS
  @EndUserText.label: 'Nota Fiscal'
  DocumentReferenceID,
  @AnalyticsDetails.query.axis:#ROWS
  @EndUserText.label: 'ID Cliente'
  Customer,
  @AnalyticsDetails.query.axis:#ROWS
  @EndUserText.label: 'Cliente'
  CustomerName_3,
  @AnalyticsDetails.query.axis:#ROWS
  @EndUserText.label: 'Data de Faturamento'

  BillingDocumentDate,
  @AnalyticsDetails.query.axis:#ROWS
  @EndUserText.label: 'UF'
  Region,
  @AnalyticsDetails.query.axis:#ROWS
  @EndUserText.label: 'Cidade'
  CityName,
  @DefaultAggregation: #FORMULA
  @AnalyticsDetails.query.formula: '$projection.TotalNumberOfPackage / $projection.cont'
  @EndUserText.label: 'QtdePacotes'
  @AnalyticsDetails: {   exceptionAggregationSteps: [{  exceptionAggregationBehavior : #SUM, exceptionAggregationElements: ['DocumentReferenceID']   }]  }
  @AnalyticsDetails.query.decimals: 0
  0 as QtdePacotes,
  @EndUserText.label: 'Qtd Caixas'
  @AnalyticsDetails.query.decimals: 0
  @DefaultAggregation: #SUM
  @Consumption.hidden : true
  TotalNumberOfPackage,
  @DefaultAggregation: #FORMULA
  @AnalyticsDetails.query.formula: '$projection.NetAmount + $projection.TaxAmount'
  @EndUserText.label: 'Valor'
  0 as Valor,
  @AnalyticsDetails.query.decimals: 3
  ItemVolume,
  @AnalyticsDetails.query.decimals: 3
  @EndUserText.label: 'Peso Bruto'
  ItemGrossWeight,
  @AnalyticsDetails.query.decimals: 3
  @EndUserText.label: 'Peso Líquido'
  ItemNetWeight,
  @Consumption.hidden : true
  NetAmount,
  @EndUserText.label: 'Tipo de Parceiro'
  PartnerFunctionName,
  @EndUserText.label: 'ID Transportadora'
  Supplier,
  @Consumption.hidden : true
  TaxAmount,
  @EndUserText.label: 'Material'
  material,
  @EndUserText.label: 'Document Type'
  BillingDocumentType,
//  @EndUserText.label: 'Document is Cancelled'
//  BillingDocumentIsCancelled,

  @DefaultAggregation: #FORMULA
  @Consumption.hidden : true
  @EndUserText.label: 'cont'
  @AnalyticsDetails: {   exceptionAggregationSteps: [{  exceptionAggregationBehavior : #SUM, exceptionAggregationElements: ['material']   }]  }
  1 as cont

}
where
  (
    PartnerFunctionName = 'Agente de frete'
  )
  and
  (
    BillingDocumentIsCancelled = '#'
  )
    and
  (
    BillingDocumentType != 'S1'
  )
      and
  (
    BillingDocumentType != 'S2'
  )

 

Como o objetivo do relatório é para imprimir e mandar com a transportadora, não vi necessidade de utilizar o SAP Analytics Cloud.

Utilizei somente o View Browser “Business Role – SAP_BR_ANALYTICS_SPECIALIST”

Veja na imagem abaixo o relatório.

Com esse relatório atendemos uma necessidade que não existe de forma standard no S4/Hana.

/
2 Comments
You must be Logged on to comment or reply to a post.