Skip to Content

unable to pass Text Data from Data work bench to Text Collection of Custom BO. Resulting with Error

Hi Experts,

I'm unable to pass Text Data from Data work bench to Text Collection of Custom BO. Result Ending with Error no Record getting created for Custom BO.

Let me explain the Scenario I need to create records via Data Work Bench. I'll be passing complete record with notes(The Text Data).

To pass Text Data receiving from Data Work Bench to Text Collection I'm using ABSL code

Business Object Details

businessobject transaction{

[Label(" Transaction ID")] [AlternativeKey] element Activity_ID_Number : ID;

[Label("Transaction Type")] element Transaction_Type : CodeList_InspectionTypeCode;

[Label(" Status")] element Status : CodeList_InspectionStatusCode;

[Label(" Planned Start Date")] element Start_Date : Date;

[Label(" Planned End Date")] element End_Date : Date;

[Label("Account ID")] element AccountNumber : BusinessPartnerInternalID;

[Label("New Notes")] element NewNotes : LANGUAGEINDEPENDENT_Text; // Since in Custom BO Data in Business Object can max be 255 Characters therefore it’ll be use to pass data to Text Collection

association ToCustomer to Customer;

[DependentObject(AttachmentFolder)] node Attachment;

[DependentObject(TextCollection)] node Text;

}

ABSL Code Details

Logic: Since there is a Restriction that Custom BO Fields can Max hold 255 Character if more than that while saving it'll get truncated . To hold more than 255 Character need to use Text Collection (please refer this link for reference . https://archive.sap.com/discussions/thread/3404546)

Therefore Logic I've used if New Notes field is holding data then it should create instance of Text Collection Node & also its Child node and then pass the data to Text Collection-->Text -->TextContent-->Text-->Content

Then clear New Notes Field.

Event Before Save

import ABSL;

if(!this.NewNotes.IsInitial())

{

if(!this.Text.IsSet())

{ var textnode = this.Text.Create();

if(textnode.IsSet())

{

var textassociation = textnode.Text.Create();

if(!textassociation.TextContent.IsSet())

{

var textfield = textassociation.TextContent.Create();

if(textfield.Text.content.IsInitial())

{

texttfield.Text.content = this.NewNotes;

}

}

}

}

this.NewNotes.Clear();

}

ABSL Code is executing without error(checked in debugger) but when seeing in Data workbench--> Monitor. It is showing Error. When trying to open error a Blank Page is showing. Not getting clue what went wrong

Please help me in this.

Regards

Nabarun Barua

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Feb 16, 2017 at 12:50 PM

    Hi,

    Well, If you are using Text collection node to store text then why do you need to use the additional element NewNoteS?? As it is custom BO, you should directly use the Text collection object to upload your text data. There is no need to write any code.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Saurabh,

      Actually reason behind using NewNotes was, Text Collection is not coming in my Custom Business Object's Root in Data Work Bench or in O Data Service Text Collection is a seperate Node and my Busines Object is Seperate Node. Since it's coming as a different Node and user wants to populate single sheet with all the records with notes data and should be able to save data in my Business Object so we've to use New Notes field.

      Regards

      Nabarun Barua

  • Mar 01, 2017 at 11:11 AM

    Hi All,

    Issue was resolved , it is Standard that Text collection Data is uploaded separately. Now able to upload text in Text Collection.

    Regards

    Nabarun Barua

    Add comment
    10|10000 characters needed characters exceeded