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FORE,
 PR_PRVDEVP,
 PR_PRVSERR,
 PR_PRVTS,
 PR_PRVLOST,
 PR_PRVSALE,
 PR_PRVEXPT,
 PR_PRVDEMD,
 PR_TRNOORD,
 PR_ALTOORD,
 PR_CONTFLG,
 PR_OVERFLG,
 PR_OVERUNT,
 PR_OVERCST,
 PR_OVERCUR,
 PR_OVERMAX,
 PR_MFGOUT,
 PR_PROCALT,
 PR_FORMETH,
 PR_INVMETH,
 PR_EXCUNTL,
 PR_EXCAFTR,
 PR_REBATE,
 PR_TRANPTD,
 PR_TRANLST,
 PR_REPCARY,
 PR_EXCLEAD,
 PR_NONSTCK,
 PR_COMPROD,
 PR_CMBLOCN,
 PR_CMBSUPL,
 PR_CMBSUB,
 PR_ACCTYP1,
 PR_ACCTYP2,
 PR_ACCTYP3,
 PR_ACCTYP4,
 PR_ACCTYP5,
 PR_ACCTYP6,
 PR_ACCTYP7,
 PR_ACCTYP8,
 PR_ACCTYP9,
 PR_CARCOUN,
 PR_USERA1,
 PR_USERA2,
 PR_USERA3,
 PR_USERN1,
 PR_USERN2,
 PR_USERN3,
 PR_DISOTHO,
 PR_DISUNT7,
 PR_DISUN7O,
 PR_DISUNT8,
 PR_DISUN8O,
 PR_DISUNT9,
 PR_DISUN9O
            
FROM K_PRODSED
LEFT JOIN K_PRODUCT
                     ON PD_COMP = PR_COMP
                         AND PD_ACTLOCN = PR_LOCN
                         AND PD_PROD = PR_PROD
                         AND PD_ACTSUPL = PR_SUPL
                         AND PD_ACTSUB = PR_SUPLSUB
WHERE PR_TEMPORY = 0 and PR_ALTSRCE = 0 and PR_DELTCNT = 0; 

LABEL ON TABLE K_BTCHCMB IS 'Combined PRODSED-PRODUCT';