Skip to Content
0

How to add object instances from the collection into a string field separated by comma ?

Jan 06, 2017 at 01:07 PM

110

avatar image

I have a detail screen with a drop down selection for the names , an add button to retrieve the selected name from the drop down list and display it in a string field . I have added a add transaction to the add button where the selected names are being added into an separate collection and then making them to display it on the string field separated by comma. Problem i am facing is that ,i am able to display first object and last object instance of the collection in the string but not the others . I have used update rule in the string field property to accomplish this .

pom2.jpg (243.8 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Bill Froelich
Jan 13, 2017 at 03:48 PM
0

You will want to have a subaction that loops over your selected customers collection after you add the currently selected entry to the collection. This subaction will process each entry in the collection and add them to a temporary string field on the main object. The field on the screen will simply point to the temporary string field that contains the concatenated values.

Another option would be to initially populate the temp field as an empty string when you open the screen. Then every time you add it to the selected customers collection you call a second transaction to append the selected customer to the end of the temp string which the screen is displaying.

--Bill

Show 4 Share
10 |10000 characters needed characters left characters exceeded

Hello Bill,

Thanks for response , i was able to add instances of the collection onto the string field separated by commas

successfully

. The rule remains same for updating the string field , where i am storing the instances chosen from the list collection field in separate property and concatenating it with last object of that collection.

Problem is while clearing one instance from the string filed. I am able to clear all, but not single instance from the string field , where concatenation rule is applied. Is there a way to remove last but one instance from the collection or choose at -least?

string field

0

You could do sub string operations on it or just clear it and rebuild from the collection of selected items after removing the item from the collection.

--Bill

0

Actually i am storing the instance valve selected from the list collection field and showing on the text field in storeSelectedNames string property which is seperated by comma and valve selected from the list collection which would turn out to be the last object of the collection is made to concatenate with the the storeSelectedNames property which has values previously selected by the user.

During clearing out instances one at a time, i have added a another rule to clear the instance of last object from the string field ie storeSelectedName property, second transaction to delete the last object from the collection itself. ,

Problem is when i am running the delete transaction , i am successfully able to delete the instance from the collection and remove string valve from the storeSelctedName property, after that again the update rule starts and concatenate last object of the collection with the storeSelectedName which turns out to be the last object concatenating with last object. I need to define a rule or condition in which i can delete or select second to last object of the collection and apply it to delete it from storeSelectedName property.

0

Not quite sure I follow where / why there is an update rule running. There isn't really a way to select the second to last object easily unless you know the id already.

I would go with rebuilding the full list on delete to make it easy on yourself.

--Bill

1
Chung Yu
Jan 13, 2017 at 03:37 PM
0

Hi Kushal,

Since you wanted to use selected name from the Customer's screen for the Concatenation, did you try using the current Customer screen's selected name property.

Regards,

Chung Yu

SAP Senior Support Engineer

Share
10 |10000 characters needed characters left characters exceeded