I_BR_NFDocument

DDL: I_BR_NFDOCUMENT SQL: IBRNFDOCUMENT Type: view BASIC

Brazil Nota Fiscal Document Data

I_BR_NFDocument (Basic)

Package: Explore, extend and adapt the SAP S/4HANA Cloud Private Edition with built-in and side-by-side extension capabilities.

Country or Region-Specific Functions for Finance

I_BR_NFDocument is a Basic CDS View that provides data about "Brazil Nota Fiscal Document Data" in SAP S/4HANA. It reads from 1 data source (j_1bnfdoc) and exposes 181 fields with key field BR_NotaFiscal. It has 30 associations to related views.

SAP Help Documentation

CategoryElectronic Documents
StatusReleased
Purpose
This CDS view provides the prerequisites for answering business questions about relevant aspects of nota fiscal document data.

Prerequisites
You have authorizations to access relevant nota fiscal data.

Structure
The key field is BR_NotaFiscal. . Measures and attributes Some important measures and attributes are: Nota Fiscal Partner Function ( BR_NFPartnerFunction ) Nota Fiscal Partner ( BR_NFPartner ) Nota Fiscal Partner Name 1 ( BusinessPartnerName1 ) Nota Fiscal Partner Name 2 ( BusinessPartnerName2 ) Partner Is One Time Account ( PartnerIsOneTimeAccount ) Nota Fiscal Partner Type ( BR_NFPartnerType )

View on SAP Help Portal →

SAP API Hub

StateC1
Line of BusinessCountry or Region-Specific Functions for Finance
Application ComponentFI-LOC-LO-BR
CapabilitiesData Source in SQL Select, Data Source for Defining CDS Entities
PackageCountry or Region-Specific Functions for Finance for SAP S/4HANA Cloud Private Edition
Description <p>This CDS view provides the prerequisites for answering business questions about relevant aspects of nota fiscal document data.</p>

Documentation

Data Sources (1)

SourceAliasJoin Type
j_1bnfdoc j_1bnfdoc from

Associations (30)

CardinalityTargetAliasCondition
[0..1] I_UnitOfMeasure _SugarcaneCurMnthQtyUnit $projection.SugarcaneCurMnthQtyUnit = _SugarcaneCurMnthQtyUnit.UnitOfMeasure
[0..1] I_UnitOfMeasure _SugarcaneLastMnthQtyUnit $projection.SugarcaneLastMnthQtyUnit = _SugarcaneLastMnthQtyUnit.UnitOfMeasure
[0..1] I_UnitOfMeasure _SugarcaneSumBothMnthsQtyUnit $projection.SugarcaneSumBothMnthsQtyUnit = _SugarcaneSumBothMnthsQtyUnit.UnitOfMeasure
[0..1] I_UnitOfMeasure _BR_NFShippingUnit $projection.BR_NFShippingUnit = _BR_NFShippingUnit.UnitOfMeasure
[0..1] I_UnitOfMeasure _HeaderWeightUnit $projection.HeaderWeightUnit = _HeaderWeightUnit.UnitOfMeasure
[0..1] I_Currency _SalesDocumentCurrency $projection.SalesDocumentCurrency = _SalesDocumentCurrency.Currency
[0..1] I_BR_NFDirection _BR_NFDirection _BR_NFDirection.BR_NFDirection = $projection.BR_NFDirection
[0..1] I_BR_NFModel _BR_NFModel _BR_NFModel.BR_NFModel = $projection.BR_NFModel
[0..1] I_BR_FreightPayer _BR_FreightPayer _BR_FreightPayer.FreightPayer = $projection.FreightPayer
[0..1] I_BR_NFeDocumentStatus _BR_NFeDocumentStatus _BR_NFeDocumentStatus.BR_NFeDocumentStatus = $projection.BR_NFeDocumentStatus
[0..1] I_BR_NFeDestination _BR_NFeDestination _BR_NFeDestination.BR_NFeDestination = $projection.BR_NFeDestination
[0..1] I_BR_NFeIntermediatorTrans _BR_NFeIntermediatorTrans _BR_NFeIntermediatorTrans.BR_NFeIntermediatorTransaction = $projection.BR_NFeIntermediatorTransaction
[0..1] I_CompanyCode _CompanyCode _CompanyCode.CompanyCode = $projection.CompanyCode
[0..1] I_BR_NFPartnerType _BR_NFPartnerType _BR_NFPartnerType.BR_NFPartnerType = $projection.BR_NFPartnerType
[0..1] I_BR_PartnerPlaceType _BR_PartnerPlaceType _BR_PartnerPlaceType.BR_NFPartnerPlaceType = $projection.BR_NFPartnerPlaceType
[0..1] I_BR_NFeCustomerPresence _BR_NFeCustomerPresence _BR_NFeCustomerPresence.BR_NFeCustomerPresence = $projection.BR_NFeCustomerPresence
[0..1] I_BR_CollectionPaymentForm _BR_PaymentForm _BR_PaymentForm.PaymentForm = $projection.BR_PaymentForm
[0..1] I_BR_CTeFiscalDocPartner _BR_CTeFiscalDocPartner _BR_CTeFiscalDocPartner.BR_CTeFiscalDocumentPartner = $projection.BR_CTeFiscalDocumentPartner
[0..1] I_BR_CTeTransportationMode _BR_CTeTransportationMode _BR_CTeTransportationMode.BR_CTeTransportationMode = $projection.BR_CTeTransportationMode
[0..1] I_BR_CTeServiceType _BR_CTeServiceType _BR_CTeServiceType.BR_CTeServiceType = $projection.BR_CTeServiceType
[0..1] I_BR_CTeDocumentType _BR_CTeDocumentType _BR_CTeDocumentType.BR_CTeDocumentType = $projection.BR_CTeDocumentType
[0..1] I_BR_CTePartnerServiceTaker _BR_CTePartnerServiceTaker _BR_CTePartnerServiceTaker.BR_CTePartnerServiceTaker = $projection.BR_CTePartnerServiceTaker
[0..1] I_BR_NFIsCreatedManually _BR_NFIsCreatedManually _BR_NFIsCreatedManually.BR_NFIsCreatedManually = $projection.BR_NFIsCreatedManually
[0..1] I_MeansOfTransportType _MeansOfTransportType _MeansOfTransportType.MeansOfTransportType = $projection.MeansOfTransportType
[0..1] I_BR_NFIssuer _BR_NFIssuer _BR_NFIssuer.BR_NFIssuedBy = $projection.BR_NFIssuedBy
[0..1] I_BR_NFPartner _BR_NFPartner _BR_NFPartner.BR_NotaFiscal = $projection.BR_NotaFiscal and _BR_NFPartner.BR_NFPartnerFunction = $projection.BR_NFPartnerFunction
[0..1] I_BR_NFDocumentType _BR_NFDocumentType _BR_NFDocumentType.BR_NFDocumentType = $projection.BR_NFDocumentType
[0..1] I_Supplier _Vendor _Vendor.Supplier = $projection.BR_NFPartner
[0..1] I_Customer _Customer _Customer.Customer = $projection.BR_NFPartner
[0..1] I_BR_NFPartner _BR_NFPartnerBusProposeCpl _BR_NFPartnerBusProposeCpl.BR_NotaFiscal = $projection.BR_NotaFiscal and _BR_NFPartnerBusProposeCpl.IsBusinessPurposeCompleted = 'X'

Annotations (14)

NameValueLevelField
AbapCatalog.sqlViewName IBRNFDOCUMENT view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #MANDATORY view
VDM.lifecycle.contract.type #PUBLIC_LOCAL_API view
EndUserText.label Brazil Nota Fiscal Document Data view
VDM.viewType #BASIC view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.modelingPattern #NONE view
ClientHandling.algorithm #SESSION_VARIABLE view
Metadata.ignorePropagatedAnnotations true view
AccessControl.personalData.blocking #REQUIRED view
AbapCatalog.preserveKey true view

Fields (181)

KeyFieldSource TableSource FieldDescription
KEY BR_NotaFiscal Document Number
BR_NFPartnerFunction j_1bnfdoc parvw Nota Fiscal Partner Function
BR_NFPartner j_1bnfdoc parid Partner ID (Customer, Vendor, Business Place)
BR_NFPartnerName1 j_1bnfdoc name1 PA text
BR_NFPartnerName2 j_1bnfdoc name2 Name2/First nme
BR_NFPartnerName3 j_1bnfdoc name3 Name 3
BR_NFPartnerName4 j_1bnfdoc name4 Name 4
PartnerIsOneTimeAccount j_1bnfdoc parxcpdk Indicator: Is the account a one-time account?
BR_NFPartnerType Type
BR_NFPartnerStreetName j_1bnfdoc stras Street and House Number
BusinessPartnerHouseNumber j_1bnfdoc house_num1 House Number
BPHsNmbrSuplmntTxt j_1bnfdoc house_num2 House number supplement
BR_NFPartnerCityName j_1bnfdoc ort01 Province
BR_NFPartnerRegionCode j_1bnfdoc regio Region (State, Province, County)
BR_NFPartnerDistrictName j_1bnfdoc ort02 District
BR_NFPartnerCountryCode j_1bnfdoc land1 Country/Region Key
BR_NFPartnerPostalCode j_1bnfdoc pstlz Postal Code
BR_NFPartnerIsNaturalPerson Natural Person
BR_NFPartnerCNPJ CNPJ Number
BR_NFPartnerCPF CPF number
PhoneNumber j_1bnfdoc telf1 Addresses: telephone no.
BR_NFPartnerStateTaxNumber j_1bnfdoc stains State Tax Number
BR_NFPartnerMunicipalTaxNumber j_1bnfdoc munins Municipal Tax Number
BR_NFPartnerStateTaxNumberST j_1bnfdoc iest_partner State Tax Number of Partner (SubTrib)
BR_NFPartnerCNAE j_1bnfdoc cnae_partner CNAE Code of Partner
BR_NFPartnerTaxRegimenCode j_1bnfdoc crt_partner Tax Regimen Code (CRT) of Partner
BR_PartnerCFOPCategory j_1bnfdoc indust Customer's CFOP category
BR_SUFRAMACode j_1bnfdoc isuf SUFRAMA Subscription of Partner
BR_SPEDTaxCategory j_1bnfdoc itmf_pco_category Tax Category
ReportingIncgOrOutgDate j_1bnfdoc itmf_repdat TMF Reporting Date
BR_NFPartnerTaxJurisdiction j_1bnfdoc txjcd Tax Jurisdiction
BR_NFObservationText j_1bnfdoc observat Legal Books Mod. 1 + 2: Header text for observations column
MeansOfTransportType Means of Transport
MeansOfTransport Transport ID
IncotermsClassification j_1bnfdoc inco1 Incoterms (Part 1)
IncotermsTransferLocation j_1bnfdoc inco2 Incoterms (Part 2)
ShippingPoint j_1bnfdoc vstel Shipping Point / Receiving Point
BR_NFShippingUnitBrand Shipping Unit Mark
BR_NFShippingUnitNumber Shipping Unit Number
BR_NFNumberOfPackages Number of Packages
BR_NFShippingUnit Shipping Unit
BR_NFArrivalOrDepartureDate j_1bnfdoc dsaient Goods Departure or Arrival Date
HeaderWeightUnit j_1bnfdoc gewei Unit of Weight
HeaderNetWeight Net Weight
HeaderGrossWeight Gross Weight
BR_NFArrivalOrDepartureTime Departure/Arrival Time
BR_WhldgICMSForTranspCFOP CFOP of ICMS Withholding for Transportation
BR_WhldgICMSForTranspCity j_1bnfdoc rettransp_cmunfg City Code
CreatedByUser User who created the document
CreationDate Document Creation Date
CreationTime Document Creation Time
LogicalSystem Logical System
LastChangedByUser User who last changed the document
LastChangeDate Date when document was changed
LastChangeTime Time when the document was last changed
PaymentTerms Terms of Payment Key
BR_NFIsPrinted Nota Fiscal Was Printed
BR_NFIsCreatedManually Manually Created
BR_NFIsIncomingIssdByCust j_1bnfdoc entrad Nota Fiscal Entrada
BR_NFIsCanceled Nota Fiscal Cancelled
BR_NFIsChargingInvoice NF is a fatura
BR_NFDirection Movement Direction
BR_NFType Nota Fiscal Type
BR_NFDocumentType Document Type
BR_NFModel Nota Fiscal Model
BR_NFNumber Nota Fiscal Number
BR_NFSeries Nota Fiscal Series
BR_NFSubSeries j_1bnfdoc subser Sub series
BR_NFSituationCode j_1bnfdoc cod_sit Status Code of Fiscal Document
BR_NFIssuedBy Nota Fiscal Issued By
BR_NFIsContingency Contingency Indicator for Nota Fiscal
BR_NFAuthznProtocolNumber j_1bnfdoc authcod Protocol Number
BR_NFAuthznProtocolNumber16 j_1bnfdoc authcod16 Protocol Number
BR_NFAuthenticationDate Processing Date
BR_NFAuthenticationTime Processing Time
BR_NFeXMLVersion j_1bnfdoc xmlvers XML Version
SupplierInvoice j_1bnfdoc nfat Invoice Number
BR_NFOriginalAmount Invoice Original Amount
BR_NFDiscountAmount Invoice Discount Amount
BR_NFNetAmount Invoice Net Amount
BR_NFCommitmentNote j_1bnfdoc xnemp Commitment Note
SugarcaneHarvest Harvest ID
SugarcaneRefMonthYear Reference Month/Year
SugarcaneCurMnthQtyUnit Unit of Measurement
SugarcaneCurrentMonthQty Current Month Amount
SugarcaneLastMnthQtyUnit Unit of Measurement
SugarcaneLastMnthQuantity Last Month Amount
SugarcaneSumBothMnthsQtyUnit Unit of Measurement
SugarcaneSumBothMonthsQty Sum of Both Months
SugarcaneSuppliesAmount Supplies Amount
SugarcaneTotalDeductionAmount Total Deduction
SugarcaneSuppliesNetAmt Supplies Net Amount
BR_NFeDocumentStatus Document Status
BR_NFIsFinalConsumer j_1bnfdoc ind_final NF-e Final Consumer Identification
BR_NFeCustomerPresence Customer Presence
BR_NFeDestination Destination
CompanyCode j_1bnfdoc bukrs Company Code
BR_NFPostingDate Posting Date
BusinessPlace Business Place
BR_BusinessPlaceCNPJ Business Place CNPJ
BusinessPlaceStateTaxNumber State Tax Number
BR_BusPlaceStateTaxNumberST State Tax Number (ST)
BusPlaceMunicipalTaxNumber Municipal Tax Number
BR_BusinessPlaceCNAE Business Place CNAE
BusinessPlaceTaxRegimenCode Business Place CRT
BR_NFTotalAmount j_1bnfdoc nftot Total value including all taxes
SalesDocumentCurrency j_1bnfdoc waerk SD Document Currency
AccountingDocument Accounting Document
BR_NFFiscalYear j_1bnfdoc gjahr Settlement Year
BR_NFWithholdingAmount Withholding Amount
BR_PaymentForm Payment Form Indicator
FreightPayer Freight Mode
BR_ANTTCarrierRegistration Cargo Carrier ID
BR_NFeNumber Nine-Digit Number
WagonID Wagon ID
FerryBoatID Ferryboat ID
BR_NFExportShipmentPlace j_1bnfdoc xlocembarq Shipment Place (Export)
BR_NFExportShipmentRegion Shipment Region
BR_NFExportDispatchLocation Dispatch Location
BR_NFIssueDate Document Date
BR_NFIsMunicipal Municipal Fiscal Document
BR_NFOperationTypeDesc Operation Type
BR_IsNFe Electronic Fiscal Document
BR_NFCancellationDate Cancellation Date
BR_NFHasFollowOnDocument Follow-On Document
BR_NFReferenceDocument
LicensePlate j_1bnfdoc placa Vehicle License Plate
VehicleRegion j_1bnfdoc uf1 Region of Vehicle
BR_UtilsNFNumber Number for Non-Electronic Documents
BR_NFPartnerPlaceType Nota Fiscal Partner Place Type
ChangeAmount Change Amount
BR_NFFiscalCouponDocModel j_1bnfdoc mod Fiscal Coupon Document Model
BR_NFOperationOrderNumber j_1bnfdoc ncoo Operation Order Counter Number
BR_NFPartnerForeignIdn Foreign Identification
BR_NFIsCalculatedByTaxService Tax Calculated by External Tax Calculation Engines
BR_NFeIntermediatorTransaction Intermediator Indicator
BR_NFeIntermediatorRegistry Intermediator Identification Registry
BR_NFeIntermediatorCNPJ CNPJ of the Intermediator
BR_CTeMainProductTransported Main Product
BR_CTeTotalGoodsAmount Total Amount of Goods
BR_CTePartnerServiceTaker j_1bnfdoc cte_serv_taker CT-e Partner as Service Taker
BR_CTeFiscalDocumentPartner j_1bnfdoc cte_partner CT-e Partner in Fiscal Document
BR_CTeServiceType j_1bnfdoc serv_tp Service Type Indicator
BR_CTeTransportationMode Transportation Mode
BR_CTeEstimatedDeliveryDate j_1bnfdoc pln_dt_dlv Estimated Delivery Date
BR_CTeIsTruckFullyLoaded j_1bnfdoc ftl_ind Full Truck Load Indicator
BR_CTeJurisdictionCodeOrigin j_1bnfdoc cte_strt_lct Jurisdiction Code of the Point of Origin
BR_CTeJurisdictionCodeDest j_1bnfdoc cte_end_lct Jurisdiction Code of the Final Destination
BR_NFSNumber j_1bnfdoc prefno Service NF-e Number
BR_NFHasServiceItem j_1bnfdoc nfesrv Service NF/NF-e
AccessControlDPPCTe
AccessControlDPP
_SugarcaneCurMnthQtyUnit _SugarcaneCurMnthQtyUnit
_SugarcaneLastMnthQtyUnit _SugarcaneLastMnthQtyUnit
_SugarcaneSumBothMnthsQtyUnit _SugarcaneSumBothMnthsQtyUnit
_BR_NFShippingUnit _BR_NFShippingUnit
_HeaderWeightUnit _HeaderWeightUnit
_SalesDocumentCurrency _SalesDocumentCurrency
_BR_NFDirection _BR_NFDirection
_BR_NFModel _BR_NFModel
_BR_FreightPayer _BR_FreightPayer
_BR_NFeDocumentStatus _BR_NFeDocumentStatus
_BR_NFeDestination _BR_NFeDestination
_BR_NFeIntermediatorTrans _BR_NFeIntermediatorTrans
CompanyCodeName _CompanyCode CompanyCodeName Name of Company Code or Company
_BR_NFPartnerType _BR_NFPartnerType
_BR_PartnerPlaceType _BR_PartnerPlaceType
_BR_NFeCustomerPresence _BR_NFeCustomerPresence
_BR_CTePartnerServiceTaker _BR_CTePartnerServiceTaker
_BR_CTeTransportationMode _BR_CTeTransportationMode
_BR_CTeServiceType _BR_CTeServiceType
_BR_CTeDocumentType _BR_CTeDocumentType
_BR_CTeFiscalDocPartner _BR_CTeFiscalDocPartner
_BR_NFIsCreatedManually _BR_NFIsCreatedManually
_MeansOfTransportType _MeansOfTransportType
_BR_NFIssuer _BR_NFIssuer
_BR_PaymentForm _BR_PaymentForm
_BR_NFPartner _BR_NFPartner
_Vendor _Vendor
_Customer _Customer
_BR_NFDocumentType _BR_NFDocumentType

Derived SQL interpretation, reconstructed from the parsed view metadata (data sources, associations, and field mappings). SAP annotations are omitted and the structure is reformulated as SQL — this is a functional approximation, not the verbatim SAP source.

-- Derived SQL interpretation of CDS view I_BR_NFDocument.
-- Reconstructed from parsed metadata (data sources, associations, fields).
-- SAP annotations are omitted and the structure is reformulated as SQL;
-- this is a functional approximation, not the verbatim SAP source. Some join
-- conditions may be unavailable and a few CDS constructs are kept as-is.
-- SQL view name: IBRNFDOCUMENT

CREATE VIEW I_BR_NFDocument AS
SELECT
  cast(j_1bnfdoc.docnum as logbr_docnum preserving type) AS BR_NotaFiscal,
  j_1bnfdoc.parvw AS BR_NFPartnerFunction,
  j_1bnfdoc.parid AS BR_NFPartner,
  j_1bnfdoc.name1 AS BR_NFPartnerName1,
  j_1bnfdoc.name2 AS BR_NFPartnerName2,
  j_1bnfdoc.name3 AS BR_NFPartnerName3,
  j_1bnfdoc.name4 AS BR_NFPartnerName4,
  j_1bnfdoc.parxcpdk AS PartnerIsOneTimeAccount,
  cast(j_1bnfdoc.partyp as logbr_nfpartnertype preserving type) AS BR_NFPartnerType,
  j_1bnfdoc.stras AS BR_NFPartnerStreetName,
  j_1bnfdoc.house_num1 AS BusinessPartnerHouseNumber,
  j_1bnfdoc.house_num2 AS BPHsNmbrSuplmntTxt,
  j_1bnfdoc.ort01 AS BR_NFPartnerCityName,
  j_1bnfdoc.regio AS BR_NFPartnerRegionCode,
  j_1bnfdoc.ort02 AS BR_NFPartnerDistrictName,
  j_1bnfdoc.land1 AS BR_NFPartnerCountryCode,
  j_1bnfdoc.pstlz AS BR_NFPartnerPostalCode,
  cast(j_1bnfdoc.stkzn as logbr_nfnaturalperson preserving type) AS BR_NFPartnerIsNaturalPerson,
  cast(j_1bnfdoc.cgc as logbr_nfpartnercnpj preserving type) AS BR_NFPartnerCNPJ,
  cast(j_1bnfdoc.cpf as logbr_nfpartnercpf preserving type) AS BR_NFPartnerCPF,
  j_1bnfdoc.telf1 AS PhoneNumber,
  j_1bnfdoc.stains AS BR_NFPartnerStateTaxNumber,
  j_1bnfdoc.munins AS BR_NFPartnerMunicipalTaxNumber,
  j_1bnfdoc.iest_partner AS BR_NFPartnerStateTaxNumberST,
  j_1bnfdoc.cnae_partner AS BR_NFPartnerCNAE,
  j_1bnfdoc.crt_partner AS BR_NFPartnerTaxRegimenCode,
  j_1bnfdoc.indust AS BR_PartnerCFOPCategory,
  j_1bnfdoc.isuf AS BR_SUFRAMACode,
  j_1bnfdoc.itmf_pco_category AS BR_SPEDTaxCategory,
  j_1bnfdoc.itmf_repdat AS ReportingIncgOrOutgDate,
  j_1bnfdoc.txjcd AS BR_NFPartnerTaxJurisdiction,
  j_1bnfdoc.observat AS BR_NFObservationText,
  cast(j_1bnfdoc.traty as logbr_traty preserving type) AS MeansOfTransportType,
  cast(j_1bnfdoc.traid as logbr_traid preserving type) AS MeansOfTransport,
  j_1bnfdoc.inco1 AS IncotermsClassification,
  j_1bnfdoc.inco2 AS IncotermsTransferLocation,
  j_1bnfdoc.vstel AS ShippingPoint,
  cast(j_1bnfdoc.shpmrk as logbr_shpmrk preserving type) AS BR_NFShippingUnitBrand,
  cast(j_1bnfdoc.shpnum as logbr_shpnum preserving type) AS BR_NFShippingUnitNumber,
  cast(j_1bnfdoc.anzpk as logbr_anzpk preserving type) AS BR_NFNumberOfPackages,
  cast(j_1bnfdoc.shpunt as logbr_shpunt preserving type) AS BR_NFShippingUnit,
  j_1bnfdoc.dsaient AS BR_NFArrivalOrDepartureDate,
  j_1bnfdoc.gewei AS HeaderWeightUnit,
  cast(j_1bnfdoc.ntgew as logbr_ntgew_15 preserving type) AS HeaderNetWeight,
  cast(j_1bnfdoc.brgew as logbr_brgew_15 preserving type) AS HeaderGrossWeight,
  cast(j_1bnfdoc.hsaient as logbr_dep_arr_time preserving type) AS BR_NFArrivalOrDepartureTime,
  cast(j_1bnfdoc.rettransp_cfop as logbr_transport_whldg_cfop preserving type) AS BR_WhldgICMSForTranspCFOP,
  j_1bnfdoc.rettransp_cmunfg AS BR_WhldgICMSForTranspCity,
  cast(j_1bnfdoc.crenam as logbr_crenam preserving type) AS CreatedByUser,
  cast(j_1bnfdoc.credat as logbr_credat preserving type) AS CreationDate,
  cast(j_1bnfdoc.cretim as logbr_cretim preserving type) AS CreationTime,
  cast(j_1bnfdoc.awsys as logbr_logsystem preserving type) AS LogicalSystem,
  cast(j_1bnfdoc.chanam as logbr_chanam preserving type) AS LastChangedByUser,
  cast(j_1bnfdoc.chadat as logbr_chadat preserving type) AS LastChangeDate,
  cast(j_1bnfdoc.chatim as logbr_chatim preserving type) AS LastChangeTime,
  cast(j_1bnfdoc.zterm as logbr_dzterm preserving type) AS PaymentTerms,
  cast(j_1bnfdoc.printd as logbr_nfprinted preserving type) AS BR_NFIsPrinted,
  cast(j_1bnfdoc.manual as logbr_manual preserving type) AS BR_NFIsCreatedManually,
  j_1bnfdoc.entrad AS BR_NFIsIncomingIssdByCust,
  cast(j_1bnfdoc.cancel as logbr_nfcancelled preserving type) AS BR_NFIsCanceled,
  cast(j_1bnfdoc.fatura as logbr_nffatura preserving type) AS BR_NFIsChargingInvoice,
  cast(j_1bnfdoc.direct as logbr_nfdirection preserving type) AS BR_NFDirection,
  cast(j_1bnfdoc.nftype as logbr_nftype preserving type) AS BR_NFType,
  cast(j_1bnfdoc.doctyp as logbr_nfdocumenttype preserving type) AS BR_NFDocumentType,
  cast(j_1bnfdoc.model as logbr_model preserving type) AS BR_NFModel,
  cast(ltrim(j_1bnfdoc.nfnum, '0') as logbr_nfnumb) AS BR_NFNumber,
  cast(j_1bnfdoc.series as logbr_nf_series preserving type) AS BR_NFSeries,
  j_1bnfdoc.subser AS BR_NFSubSeries,
  j_1bnfdoc.cod_sit AS BR_NFSituationCode,
  cast(j_1bnfdoc.ind_emit as logbr_nfissuer preserving type) AS BR_NFIssuedBy,
  cast(j_1bnfdoc.conting as logbr_nfcontingency preserving type) AS BR_NFIsContingency,
  j_1bnfdoc.authcod AS BR_NFAuthznProtocolNumber,
  j_1bnfdoc.authcod16 AS BR_NFAuthznProtocolNumber16,
  cast(j_1bnfdoc.authdate as logbr_authdate preserving type) AS BR_NFAuthenticationDate,
  cast(j_1bnfdoc.authtime as logbr_authtime preserving type) AS BR_NFAuthenticationTime,
  j_1bnfdoc.xmlvers AS BR_NFeXMLVersion,
  j_1bnfdoc.nfat AS SupplierInvoice,
  cast(j_1bnfdoc.vorig as logbr_invoiceoriginalamount) AS BR_NFOriginalAmount,
  cast(j_1bnfdoc.vdesc as logbr_invoicediscountamount) AS BR_NFDiscountAmount,
  cast(j_1bnfdoc.vliq as logbr_invoicenetamount) AS BR_NFNetAmount,
  j_1bnfdoc.xnemp AS BR_NFCommitmentNote,
  cast(j_1bnfdoc.safra as logbr_harvest_id preserving type) AS SugarcaneHarvest,
  cast(j_1bnfdoc.ref_month_year as logbr_ref_month_year preserving type) AS SugarcaneRefMonthYear,
  cast('kg' as msehi) AS SugarcaneCurMnthQtyUnit,
  cast(j_1bnfdoc.qtotmes as logbr_currentmonthamount) AS SugarcaneCurrentMonthQty,
  cast('kg' as msehi) AS SugarcaneLastMnthQtyUnit,
  cast(j_1bnfdoc.qtotant as logbr_lastmonthamount) AS SugarcaneLastMnthQuantity,
  cast('kg' as msehi) AS SugarcaneSumBothMnthsQtyUnit,
  cast(j_1bnfdoc.qtotger as logbr_sumofbothmonths) AS SugarcaneSumBothMonthsQty,
  cast(j_1bnfdoc.vfor as logbr_suppliesamount) AS SugarcaneSuppliesAmount,
  cast(j_1bnfdoc.vtotded as logbr_totaldeduction) AS SugarcaneTotalDeductionAmount,
  cast(j_1bnfdoc.vliqfor as logbr_suppliesnetamount) AS SugarcaneSuppliesNetAmt,
  cast(j_1bnfdoc.docstat as logbr_nfedocstatus preserving type) AS BR_NFeDocumentStatus,
  j_1bnfdoc.ind_final AS BR_NFIsFinalConsumer,
  cast(j_1bnfdoc.ind_pres as logbr_nfe_indpres preserving type) AS BR_NFeCustomerPresence,
  cast(j_1bnfdoc.id_dest as logbr_nfe_iddest preserving type) AS BR_NFeDestination,
  j_1bnfdoc.bukrs AS CompanyCode,
  cast(j_1bnfdoc.pstdat as logbr_pstdat preserving type) AS BR_NFPostingDate,
  cast(j_1bnfdoc.branch as logbr_branc_ preserving type) AS BusinessPlace,
  cast(j_1bnfdoc.cnpj_bupla as logbr_cnpj_bupla preserving type) AS BR_BusinessPlaceCNPJ,
  cast(j_1bnfdoc.ie_bupla as logbr_stains_bupla preserving type) AS BusinessPlaceStateTaxNumber,
  cast(j_1bnfdoc.iest_bupla as logbr_staist_bupla preserving type) AS BR_BusPlaceStateTaxNumberST,
  cast(j_1bnfdoc.im_bupla as logbr_munins_bupla preserving type) AS BusPlaceMunicipalTaxNumber,
  cast(j_1bnfdoc.cnae_bupla as logbr_cnae_bupla preserving type) AS BR_BusinessPlaceCNAE,
  cast(j_1bnfdoc.crt_bupla as logbr_crt_bupla preserving type) AS BusinessPlaceTaxRegimenCode,
  j_1bnfdoc.nftot AS BR_NFTotalAmount,
  j_1bnfdoc.waerk AS SalesDocumentCurrency,
  cast(j_1bnfdoc.belnr as logbr_belnr_d preserving type) AS AccountingDocument,
  j_1bnfdoc.gjahr AS BR_NFFiscalYear,
  cast(j_1bnfdoc.witha as logbr_withholding_amount preserving type) AS BR_NFWithholdingAmount,
  cast(j_1bnfdoc.indpag as j_1bnfe_indpag preserving type) AS BR_PaymentForm,
  cast(j_1bnfdoc.modfrete as logbr_freight_mode preserving type) AS FreightPayer,
  cast(j_1bnfdoc.rntc as logbr_nat_cargo_carrier preserving type) AS BR_ANTTCarrierRegistration,
  cast(ltrim(j_1bnfdoc.nfenum, '0') as logbr_nfnum9 preserving type) AS BR_NFeNumber,
  cast(j_1bnfdoc.vagao as logbr_wagon_id preserving type) AS WagonID,
  cast(j_1bnfdoc.balsa as logbr_ferryboad_id preserving type) AS FerryBoatID,
  j_1bnfdoc.xlocembarq AS BR_NFExportShipmentPlace,
  cast(j_1bnfdoc.ufembarq as logbr_shipment_place_uf preserving type) AS BR_NFExportShipmentRegion,
  cast(j_1bnfdoc.xlocdespacho as logbr_nfe_dispatch preserving type) AS BR_NFExportDispatchLocation,
  cast(j_1bnfdoc.docdat as logbr_docdat preserving type) AS BR_NFIssueDate,
  cast(municipal as logbr_municipal preserving type) AS BR_NFIsMunicipal,
  cast(j_1bnfdoc.natop as logbr_op_nature_desc preserving type) AS BR_NFOperationTypeDesc,
  cast(j_1bnfdoc.nfe as logbr_nfe preserving type) AS BR_IsNFe,
  cast(j_1bnfdoc.candat as logbr_candat preserving type) AS BR_NFCancellationDate,
  cast(j_1bnfdoc.subseq as logbr_subseq preserving type) AS BR_NFHasFollowOnDocument,
  ltrim(j_1bnfdoc.docref, '0') AS BR_NFReferenceDocument,
  j_1bnfdoc.placa AS LicensePlate,
  j_1bnfdoc.uf1 AS VehicleRegion,
  cast(ltrim(j_1bnfdoc.nfnum_utilities, '0') as logbr_nfnum) AS BR_UtilsNFNumber,
  cast(j_1bnfdoc.partner_role as logbr_part_role preserving type) AS BR_NFPartnerPlaceType,
  cast(j_1bnfdoc.v_troco as logbr_vtroco) AS ChangeAmount,
  j_1bnfdoc.mod AS BR_NFFiscalCouponDocModel,
  j_1bnfdoc.ncoo AS BR_NFOperationOrderNumber,
  cast(j_1bnfdoc.foreignid as logbr_foreignid preserving type) AS BR_NFPartnerForeignIdn,
  cast(j_1bnfdoc.tax_services_calc as logbr_tax_service_calculated preserving type ) AS BR_NFIsCalculatedByTaxService,
  cast(j_1bnfdoc.indintermed as logbr_nfe_indintermed preserving type ) AS BR_NFeIntermediatorTransaction,
  cast(j_1bnfdoc.idcadinttran as logbr_nfe_idcadinttran preserving type ) AS BR_NFeIntermediatorRegistry,
  cast(j_1bnfdoc.cnpjintermed as logbr_nfe_cnpjintermed preserving type ) AS BR_NFeIntermediatorCNPJ,
  cast(j_1bnfdoc.main_product as logbr_main_prod_cte preserving type) AS BR_CTeMainProductTransported,
  cast(j_1bnfdoc.total_ref_amt as logbr_goods_total_amnt_cte preserving type) AS BR_CTeTotalGoodsAmount,
  j_1bnfdoc.cte_serv_taker AS BR_CTePartnerServiceTaker,
  j_1bnfdoc.cte_partner AS BR_CTeFiscalDocumentPartner,
  j_1bnfdoc.serv_tp AS BR_CTeServiceType,
  cast(j_1bnfdoc.transp_mode as logbr_transportation_mode preserving type) AS BR_CTeTransportationMode,
  j_1bnfdoc.pln_dt_dlv AS BR_CTeEstimatedDeliveryDate,
  j_1bnfdoc.ftl_ind AS BR_CTeIsTruckFullyLoaded,
  j_1bnfdoc.cte_strt_lct AS BR_CTeJurisdictionCodeOrigin,
  j_1bnfdoc.cte_end_lct AS BR_CTeJurisdictionCodeDest,
  j_1bnfdoc.prefno AS BR_NFSNumber,
  j_1bnfdoc.nfesrv AS BR_NFHasServiceItem,
  _CompanyCode.CompanyCodeName AS CompanyCodeName
FROM j_1bnfdoc
LEFT OUTER JOIN I_UnitOfMeasure AS _SugarcaneCurMnthQtyUnit ON SugarcaneCurMnthQtyUnit = _SugarcaneCurMnthQtyUnit.UnitOfMeasure  -- association [0..1]
LEFT OUTER JOIN I_UnitOfMeasure AS _SugarcaneLastMnthQtyUnit ON SugarcaneLastMnthQtyUnit = _SugarcaneLastMnthQtyUnit.UnitOfMeasure  -- association [0..1]
LEFT OUTER JOIN I_UnitOfMeasure AS _SugarcaneSumBothMnthsQtyUnit ON SugarcaneSumBothMnthsQtyUnit = _SugarcaneSumBothMnthsQtyUnit.UnitOfMeasure  -- association [0..1]
LEFT OUTER JOIN I_UnitOfMeasure AS _BR_NFShippingUnit ON BR_NFShippingUnit = _BR_NFShippingUnit.UnitOfMeasure  -- association [0..1]
LEFT OUTER JOIN I_UnitOfMeasure AS _HeaderWeightUnit ON HeaderWeightUnit = _HeaderWeightUnit.UnitOfMeasure  -- association [0..1]
LEFT OUTER JOIN I_Currency AS _SalesDocumentCurrency ON SalesDocumentCurrency = _SalesDocumentCurrency.Currency  -- association [0..1]
LEFT OUTER JOIN I_BR_NFDirection AS _BR_NFDirection ON _BR_NFDirection.BR_NFDirection = BR_NFDirection  -- association [0..1]
LEFT OUTER JOIN I_BR_NFModel AS _BR_NFModel ON _BR_NFModel.BR_NFModel = BR_NFModel  -- association [0..1]
LEFT OUTER JOIN I_BR_FreightPayer AS _BR_FreightPayer ON _BR_FreightPayer.FreightPayer = FreightPayer  -- association [0..1]
LEFT OUTER JOIN I_BR_NFeDocumentStatus AS _BR_NFeDocumentStatus ON _BR_NFeDocumentStatus.BR_NFeDocumentStatus = BR_NFeDocumentStatus  -- association [0..1]
LEFT OUTER JOIN I_BR_NFeDestination AS _BR_NFeDestination ON _BR_NFeDestination.BR_NFeDestination = BR_NFeDestination  -- association [0..1]
LEFT OUTER JOIN I_BR_NFeIntermediatorTrans AS _BR_NFeIntermediatorTrans ON _BR_NFeIntermediatorTrans.BR_NFeIntermediatorTransaction = BR_NFeIntermediatorTransaction  -- association [0..1]
LEFT OUTER JOIN I_CompanyCode AS _CompanyCode ON _CompanyCode.CompanyCode = CompanyCode  -- association [0..1]
LEFT OUTER JOIN I_BR_NFPartnerType AS _BR_NFPartnerType ON _BR_NFPartnerType.BR_NFPartnerType = BR_NFPartnerType  -- association [0..1]
LEFT OUTER JOIN I_BR_PartnerPlaceType AS _BR_PartnerPlaceType ON _BR_PartnerPlaceType.BR_NFPartnerPlaceType = BR_NFPartnerPlaceType  -- association [0..1]
LEFT OUTER JOIN I_BR_NFeCustomerPresence AS _BR_NFeCustomerPresence ON _BR_NFeCustomerPresence.BR_NFeCustomerPresence = BR_NFeCustomerPresence  -- association [0..1]
LEFT OUTER JOIN I_BR_CollectionPaymentForm AS _BR_PaymentForm ON _BR_PaymentForm.PaymentForm = BR_PaymentForm  -- association [0..1]
LEFT OUTER JOIN I_BR_CTeFiscalDocPartner AS _BR_CTeFiscalDocPartner ON _BR_CTeFiscalDocPartner.BR_CTeFiscalDocumentPartner = BR_CTeFiscalDocumentPartner  -- association [0..1]
LEFT OUTER JOIN I_BR_CTeTransportationMode AS _BR_CTeTransportationMode ON _BR_CTeTransportationMode.BR_CTeTransportationMode = BR_CTeTransportationMode  -- association [0..1]
LEFT OUTER JOIN I_BR_CTeServiceType AS _BR_CTeServiceType ON _BR_CTeServiceType.BR_CTeServiceType = BR_CTeServiceType  -- association [0..1]
LEFT OUTER JOIN I_BR_CTeDocumentType AS _BR_CTeDocumentType ON _BR_CTeDocumentType.BR_CTeDocumentType = BR_CTeDocumentType  -- association [0..1]
LEFT OUTER JOIN I_BR_CTePartnerServiceTaker AS _BR_CTePartnerServiceTaker ON _BR_CTePartnerServiceTaker.BR_CTePartnerServiceTaker = BR_CTePartnerServiceTaker  -- association [0..1]
LEFT OUTER JOIN I_BR_NFIsCreatedManually AS _BR_NFIsCreatedManually ON _BR_NFIsCreatedManually.BR_NFIsCreatedManually = BR_NFIsCreatedManually  -- association [0..1]
LEFT OUTER JOIN I_MeansOfTransportType AS _MeansOfTransportType ON _MeansOfTransportType.MeansOfTransportType = MeansOfTransportType  -- association [0..1]
LEFT OUTER JOIN I_BR_NFIssuer AS _BR_NFIssuer ON _BR_NFIssuer.BR_NFIssuedBy = BR_NFIssuedBy  -- association [0..1]
LEFT OUTER JOIN I_BR_NFPartner AS _BR_NFPartner ON _BR_NFPartner.BR_NotaFiscal = BR_NotaFiscal AND _BR_NFPartner.BR_NFPartnerFunction = BR_NFPartnerFunction  -- association [0..1]
LEFT OUTER JOIN I_BR_NFDocumentType AS _BR_NFDocumentType ON _BR_NFDocumentType.BR_NFDocumentType = BR_NFDocumentType  -- association [0..1]
LEFT OUTER JOIN I_Supplier AS _Vendor ON _Vendor.Supplier = BR_NFPartner  -- association [0..1]
LEFT OUTER JOIN I_Customer AS _Customer ON _Customer.Customer = BR_NFPartner  -- association [0..1]
LEFT OUTER JOIN I_BR_NFPartner AS _BR_NFPartnerBusProposeCpl ON _BR_NFPartnerBusProposeCpl.BR_NotaFiscal = BR_NotaFiscal AND _BR_NFPartnerBusProposeCpl.IsBusinessPurposeCompleted = 'X'  -- association [0..1]
;