In S/4HANA cost elements become part of the chart of accounts. They are maintained in general account master data. Primary cost elements are created in S/4HANA SAP FIORI using the “Manage the GL account Master Data” app.
In this video tutorial, the presenter shows the steps required to create secondary cost element in SAP Fiori.