Device-to-device (D2D) communication has been a potential solution to improve spectral efficiency of cellular systems due to frequency resource sharing. This paper considers D2D communications underlaying an uplink cellular system enabling sparse code multiple access (SCMA) technology, where the base station (BS) can decode the signals of cellular users without mutual interference. The demands for high data rate as well as low latency in massive connectivity is the main challenging requirement in D2D communications, along with ensuring the quality of service (QoS) for the on-running cellular user equipment (CUEs). To tackle the problem, the BS is designed to first assigns the codewords in a codebook to CUEs based on the lower bound of the achievable CUE rates, so that the sum rate (SR) of CUEs is maximized. With the usage of mutual-interference suppression in the SCMA-enabled system, the BS then attempts to maximize the SR of D2Ds in a transmission block through a joint power and resource allocation subject to the QoS requirements for both CUEs and D2Ds. This task is formulated as a mixed-integer non-convex programming. We propose a low-complexity two-phase algorithm of joint heuristic and inner approximation method to efficiently solve the problem. The numerical results verify that the codebook assignment problem based on the lower bound of SR is easily solved, and the proposed algorithm to maximize the SR of D2Ds outperforms existing methods.