cancel
Showing results for 
Search instead for 
Did you mean: 

Personas: How to make sure the correct selection of a variant from a list?

Former Member
0 Kudos

Hi Personas experts,

I have a case where user can press a button to get a list of variants and user wants to pick up the specific one he created ahead from the list.

There can be the cases where the variant has or hasn't been setup when using the Personas app. If I record the actions and use it in script, I want to make a sort of "check" to see if the selected variant from the variant list is correct or not, so I can show user a note.

Or even more complicated situation: suppose my newly created variant is at the top of the list at beginning, but after a while, some other variants may be created too in the list. I am not sure if my variant position in the list will be changed then.

Questions:

Q1: When a list of variants is shown, how can I make a script to select a specific variant by name, say, to select "myVariant"?

Q1: What to do if the wanted variant doesn't exist in the list, or its original position in the list has changed?

Thanks very much in adnvance!

Dong Zhu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi all,

Thanks for all replys. Just want to close this thread. Looking at the possibilities, there seems no other ways than graping the content (CopyTable) into an array and do JS coding searching the array (this is my original thought). I was looking if there would be some other methods that can be applied directly to manipulate the table object in Personas. So we have to do manual check.

Set this to close.

Thanks again,

Dong

Former Member
0 Kudos

Hi Dong Zhu,

How you are selected the exact variant from the table after finding the exact line in which the variant is available in JavaScript.

How you used the exact variant line in the table selection?

Could you please let me know?

Thank you,

Arunkumaran

Former Member
0 Kudos

Hi Arunkumaran,

It is not possible to do selection in a "dynamic" list which contains changable numbers of items. However, if your list contains a fixed numbe rof items, eg, 8 items, and you want to let script to make a selection - here is a "hack" way to do: create 8 hidden buttons each will make a selection of an item with given index. Then create another button where in JS, do searching based on given item name. Once the index (or position) is found in the JS, call the corresponding button to do the selection action. This will work as long as the list has fixed number of items.

Will this helps?

Br,

Dong

Answers (2)

Answers (2)

Former Member
0 Kudos

I hope there will be a better way than writing a script to handle the dynamic variants- Screen and table variants. Do we have any examples on these scripts?

nmkarthikeya
Active Participant
0 Kudos

Is there any specific tcode which you have in mind? Does your button pick up a particular variant and fill up the relevant fields or it opens the list of variants to be picked up?

Regards,

Karthikeya

Former Member
0 Kudos

Hi,

I am using iw28. After that, click the variant icon, then remove the initial, execute it:

now I have a list of variants which includes the one that was created before. Now come to my questions as in my original post. The difficulty in Personas 2.0 is that the row of the item in list should be a fixed value.

Br,


Dong

nmkarthikeya
Active Participant
0 Kudos

To check whether a variant exists or not you can write a webrfc and check in the relevant table whether it exists or not, based on the output you can show a note to user.

     What do you mean by list? Is it something custom one which you have only in Personas screen?

sorry for so may questions, I am unable to visualize it, some images might help

Regards,

Karthikeya

Former Member
0 Kudos

Hi,

Thanks for quick reply.

After the steps I described, SAP GUI shows a table whose first column shows several names of the variants that user has created. Eg, if user has created some variants, called Var1, Var2, Var3, then he will see a "list" or table like:

Var1

Var2

Var3

Say I want to select Var2 (No.2 from top)  to execute. Then I should select Var2 from the table, then click the execute icon. If I record the action in script button, it only shows which row of the table is clicked. The problem is that if a new variant, say Var0, is added in the table later, the table may look like:

Var0

Var1

Var2

Var3

If I still use the same script button, it will select no.2 which is Var1 now, but I want to select Var2.

I think I can grape the column of the table by scripting and do a loop search in JS to find the right row of Var2.

Here I just want to see if there can be better ideas for doing this. Thx.

Dong

tamas_hoznek
Product and Topic Expert
Product and Topic Expert
0 Kudos

Indeed your solution would be to grab the table content using the Copy Table command and parse it using JavaScript.