<?xml version="1.0"?>
<ownershipDocument>
    <schemaVersion>X0101</schemaVersion>

    <documentType>3</documentType><periodOfReport>2003-07-17</periodOfReport>
    <noSecuritiesOwned>0</noSecuritiesOwned>

    <issuer>
        <issuerCik>0000835541</issuerCik>
        <issuerName>SOLECTRON CORP</issuerName>
        <issuerTradingSymbol>SLR</issuerTradingSymbol></issuer><reportingOwner><reportingOwnerId>
            <rptOwnerCik>0001244320</rptOwnerCik>
            <rptOwnerName>ONETTO MARC A</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>  </rptOwnerStreet1>
            <rptOwnerStreet2>  </rptOwnerStreet2>
            <rptOwnerCity>  </rptOwnerCity>
            <rptOwnerState>  </rptOwnerState>
            <rptOwnerZipCode>  </rptOwnerZipCode>
        </reportingOwnerAddress>
            <reportingOwnerRelationship>
<isDirector>0</isDirector><isOfficer>1</isOfficer><isTenPercentOwner>0</isTenPercentOwner><isOther>0</isOther><officerTitle>Executive Vice President WWOPS</officerTitle></reportingOwnerRelationship></reportingOwner><nonDerivativeSecurity><securityTitle><value>Common Stock</value></securityTitle><transactionAmounts><transactionShares><value>400000</value><footnoteId id="F1"/></transactionShares></transactionAmounts><ownershipNature><directOrIndirectOwnership><value>D</value></directOrIndirectOwnership><natureOfOwnership><value/></natureOfOwnership></ownershipNature></nonDerivativeSecurity><derivativeSecurity><securityTitle><value>Nonstatutory Stock Option (right to buy)</value></securityTitle><conversionOrExercisePrice><value>4.24</value></conversionOrExercisePrice><exerciseDate><value>2003-07-18</value></exerciseDate><expirationDate><value>2013-06-18</value></expirationDate><underlyingSecurity><underlyingSecurityTitle><value>Common Stock</value></underlyingSecurityTitle><underlyingSecurityShares><value>750000</value><footnoteId id="F2"/></underlyingSecurityShares></underlyingSecurity><ownershipNature><directOrIndirectOwnership><value>D</value></directOrIndirectOwnership><natureOfOwnership><value/></natureOfOwnership></ownershipNature></derivativeSecurity><derivativeSecurity><securityTitle><value>Nonstatutory Stock Option (right to buy)</value></securityTitle><conversionOrExercisePrice><value>4.24</value></conversionOrExercisePrice><exerciseDate><value>2003-07-18</value></exerciseDate><expirationDate><value>2013-06-18</value></expirationDate><underlyingSecurity><underlyingSecurityTitle><value>Common Stock</value></underlyingSecurityTitle><underlyingSecurityShares><value>850000</value><footnoteId id="F3"/></underlyingSecurityShares></underlyingSecurity><ownershipNature><directOrIndirectOwnership><value>D</value></directOrIndirectOwnership><natureOfOwnership><value/></natureOfOwnership></ownershipNature></derivativeSecurity><footnotes><footnote id="F1">Restricted Stock grant of 400,000 common shares with a Repurchase Right by Solectron which expires 100% on June 18, 2007.  The shares are subject to a Company Repurchase Option in the event of certain early termination events and also subject to accelerated vesting in certain circumstances.</footnote><footnote id="F2">Non-statutory stock option grant of 750,000 shares pursuant to Solectron's Amended and Restated 2002 Stock Option Plan with a vesting schedule of 1/48 monthly commencing June 18, 2003, subject to accelerated vesting in certain circumstances.</footnote><footnote id="F3">Non-statutory stock option grant of 850,000 shares pursuant to a stand-alone stock option agreement similar but not a part of the Amended and Restated 2002 Stock Option Plan with a vesting schedule of 1/48 monthly commencing June 18, 2003, subject to accelerated vesting in certain circumstances.</footnote></footnotes><ownerSignature><signatureName>by Victoria Miranda as Attorney in Fact</signatureName><signatureDate>2003-07-24</signatureDate></ownerSignature></ownershipDocument>

