cancel
Showing results forΒ 
Search instead forΒ 
Did you mean:Β 
Read only

SUB: Create Sales Order in S/4HANA from Excel via Build Apps + Integration Suite πŸ“ OVERVIEW OF FLOW

mohithvarma11
Explorer
0 Kudos
192

Hi Experts,

SAP Build App – User uploads Excel β†’ Presses Submit.

Integration Suite – Receives Excel data β†’ Maps β†’ Calls S/4HANA API.

Cloud Connector – Connects BTP (cloud) to on-prem S/4HANA system.

S/4HANA – API receives data, creates Sales Order.

As of now i need build apps design and integration flow creation

Accepted Solutions (0)

Answers (1)

Answers (1)

ArunJacob
Active Participant
0 Kudos

Hi Mohith,

A diagram like the below:-

ArunJacob_1-1743743508748.png

 

For the controller part:-

onUpload: function (oEvent) {
    const that = this;
    const file = oEvent.getParameter("files")[0];

    if (!file) {
        MessageToast.show("Please choose a file.");
        return;
    }

    const reader = new FileReader();
    reader.onload = function (e) {
        const data = e.target.result;

        // Parse the Excel file
        const workbook = XLSX.read(data, { type: "binary" });

        // Modify contents of the first sheet
        const firstSheetName = workbook.SheetNames[0];
        const worksheet = workbook.Sheets[firstSheetName];
        const json = XLSX.utils.sheet_to_json(worksheet, { defval: "" });

        // Example: Add a new column to each row
        const modifiedData = json.map((row, index) => {
            row["New Column"] = "Row " + (index + 1);
            return row;
        });

        // Convert JSON back to worksheet
        const newWorksheet = XLSX.utils.json_to_sheet(modifiedData);

        // Replace the original sheet
        workbook.Sheets[firstSheetName] = newWorksheet;

        // Generate new Excel file
        const wbout = XLSX.write(workbook, { bookType: 'xlsx', type: 'binary' });

        // Convert to Blob and trigger download
        const blob = new Blob([s2ab(wbout)], { type: "application/octet-stream" });
        saveAs(blob, "Modified_Excel.xlsx"); // Use FileSaver.js or your own downloader

        MessageToast.show("Excel processed and downloaded!");
    };

    reader.readAsBinaryString(file);
},

// Utility function to convert string to ArrayBuffer
function s2ab(s) {
    const buf = new ArrayBuffer(s.length);
    const view = new Uint8Array(buf);
    for (let i = 0; i < s.length; i++) view[i] = s.charCodeAt(i) & 0xff;
    return buf;
}

Please ensure 'xlsx.full.min.js' from SheetJS(link)

Thanks,

Jakes