Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

CSV File Upload for Custom BO?

Hello everyone,

I'm wondering if it's possible to create a custom BO and corresponding WorkCentre, where one can input a CSV file (for example), and have an ABSL script strip the values out and process them. I know the SAP built-in file upload facility only takes XML thanks to this thread --- http://scn.sap.com/thread/3551730 --- but it is possible/feasible to build your own miniature one? No problem if it's not, I just want to know what's feasible. Thanks in advance.

Lewis

Tags:
replied

Hi Lewis,

it is much easier as you think with the CSV.

If you call the "ToString()" on the BinaryObject.content from the File and the Content is a String the "real" string will be returned.

Rough Example

Test Data

Short ABSL to raise the text lines to the UI

import ABSL;

if(this.AttachmentFolder.IsSet()){

    foreach(var doc in this.AttachmentFolder.Document){

        raise CSVScreenOutput.Create("I", "Processed Document", doc.Name);

        var docContent = doc.FileContent.BinaryObject.content.ToString();

        var line = 1;

        var startLine =  0;

        var endLine = -1;

        while(true){

            endLine = docContent.Find("\n", startLine);

            if(endLine == -1){

                break;

            }

            raise CSVScreenOutput.Create("I", "Document Line " + line.ToString() + " Content", docContent.Substring(startLine, endLine - startLine - 1));

            line = line + 1;

            startLine = endLine + 1;

        }

    }

}

Result

Beste regards

Tobias

2 View this answer in context
Not what you were looking for? View more on this topic or Ask a question