cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a search help for a field in Screen Personas?

Former Member
0 Kudos

   I just started learning to use a Screen Personas, and I want to know how to add a search help for a field.

   I found a property in the help document named "IsLookupSupported". Is it the key?  But I saw it was gray in the field I created, and its value is "false". I could not change it.


Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Currently there is not an easy way to add search help functionality to custom fields in Personas. However, Tamas has created a workaround using webRFCs and some minimal ABAP code changes. His blog can be found here:

http://scn.sap.com/community/gui/blog/2014/01/17/search-help-for-a-custom-field-in-personas

Former Member
0 Kudos

Thank you Cheryl. I read his blog and followed him. But there is a problem. The first function worked, but the second did not. Curiously, I called the function on the step 5, but it prompted me "Calling the given WEBRFC failed" with the step 2 of the script. I tested the function Z_WEBRFC_READ_DATA_SH and it works well.

Here is the script button:

{"Id":"3deaadeb-7655-4d1a-9b82-df269a920cb1","Actions":[{"ActionCategory":"0","Action":"4099","ControlID":"ses[0]\/wnd[1]\/usrUSRAREA\/loopcntSAPLSDH40600\/ctxtG_SIMFIELDSVALUE[0]","Content":"selvalue"},{"ActionCategory":"0","Action":"1","ControlID":"ses[0]\/wnd[1]\/tbar[0]\/btn[12]","Content":""},{"ActionCategory":"0","Action":"4103","ControlID":"ses[0]","Content":""},{"ActionCategory":"0","Action":"4104","ControlID":"ses[0]","Content":"args.rand = Math.random();"},{"ActionCategory":"0","Action":"4105","ControlID":"ses[0]","Content":"http:\/\/sap.suv.com:8000\/sap\/bc\/webrfc?_FUNCTION=Z_WEBRFC_READ_DATA_SH&_rand={rand}"},{"ActionCategory":"0","Action":"4100","ControlID":"Personas\/f4b26cf4-842a-49f9-a095-668ed7b14aa1","Content":"fieldname"},{"ActionCategory":"1","Action":"4353","ControlID":"Personas\/f4b26cf4-842a-49f9-a095-668ed7b14aa1","Content":"GSDM"},{"ActionCategory":"2","Action":"4100","ControlID":"Personas\/94106d02-2a0a-4355-9b9b-29987c32efd8","Content":"selvalue"},{"ActionCategory":"1","Action":"4353","ControlID":"Personas\/f4b26cf4-842a-49f9-a095-668ed7b14aa1","Content":"YHM"},{"ActionCategory":"2","Action":"4100","ControlID":"Personas\/244eddf2-c06c-43a5-b754-9e8d6233f2fe","Content":"selvalue"}]}

Former Member
0 Kudos

In Step 6 it looks like you are trying to paste a variable called "fieldname" but there is no other reference to that variable in your script. Are you missing a step where you set the fieldname variable to a certain value, or copy the value from somewhere?

tamas_hoznek
Product and Topic Expert
Product and Topic Expert
0 Kudos

You have a typo in step 2. Remove [0] after tbar.

The correct button reference should look like this: ses[0]/wnd[1]/tbar/btn[12]

Wasn't the error message 'Control not found' rather than a reference to the webRFC?

0 Kudos

Hi Xin,

first make sure that your webrfc is returning correct json string.

Paste your webrfc url in your browser and see what is being returned.

Please see the following examples:

Regards,

Sushant

0 Kudos

Hi Tamas,

Just a slight correction.

Well the is correct id is ses[0]/wnd[1]/tbar[0]/btn[12]

ONLY THIS ID was changed in one of the kernel patch couple of months back to accommodate future enhancements. Obviously, we had some issues for customers who had recorded their script before that.

For example, Steve posted the following and mentioned about a single issue which was the change in id when he upgraded his kernel.

But in the recent note release, changes were made to detect the OLD id and change to the new one.

In short, if you had a script recorded earlier with old id, it will not impact your script.

Regards,

Sushant

tamas_hoznek
Product and Topic Expert
Product and Topic Expert
0 Kudos

Ah, thanks Sushant... I was not aware of this and the system I built my prototype in was on ver. 1.0 SP2

It just seemed strange that an error would complain about the WebRFC and still point to step 2... didn't make sense to me so that's why I looked at that step and saw the difference.

Former Member
0 Kudos

Hi, Tamas,

I found the reason. The function Z_WEBRFC_READ_DATA_SH had a string concatenation error.

CONCATENATE '{"results":[{"key": "shlpname", "value": "' l_shlp '"},"key": "fieldname", "value": "' l_field '"}]}' INTO htmldoc-line.


The correct code is like:

CONCATENATE '{"results":[{"key": "shlpname", "value": "' l_shlp '"},{"key": "fieldname", "value": "' l_field '"}]}' INTO htmldoc-line.

Another question is, I can't get any words in Chinese from WebRFC. It returns error when I try it. How can I configure it?

Xin

Former Member
0 Kudos

Thank you Sushant, you are right. I found the string returned miss a "{". So I add it into the function and it works well now.

tamas_hoznek
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thanks for catching this, Xin. I corrected the code in the blog post. Must have been a copy&paste error on my end, because this was always working fine in my prototype.

As for the question about having Chinese text in the response, unfortunately I can't help with that since I have not dealt with such a scenario before. Hopefully someone else will be able to chime in with ideas.

Answers (1)

Answers (1)

former_member181931
Contributor
0 Kudos

Thread moved to SAP GUI space. The Chinese speaking community, where you previously posted this question, is for content in Chinese only.

Thanks,
Laure