cancel
Showing results for 
Search instead for 
Did you mean: 

Naming Convention for Script In Personas 2.0

former_member193190
Participant
0 Kudos

Hi Experts

Is there any specific standards for Naming Convention for the scripting in Personas2.0 / 3.0 which we could follow?

Thanks!

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

Agree with Steve, in Personas 2.0 (unlike Personas 3.0 where one can really write a long REAL JS code), script button consists of a lot SAP-privide "command" by clicking the icons, the REAL JS code is only in one of the command. Thus the JS code in a script button is normally small - contribute to single functionality (like a function), we tended to create a lot of buttons to do each job and have a main buttton to call them - that's why I mentioned the hidden button naming.

If you really are looking for naming for script, it does not sound so importatnt in Personas 2.0 (my opinion) and for JS code I follow the JS convention. But as Steve said, if there are better ways of doing things, we'd like to hear. With better rules people from all over the world can understand eachother's codes, that's great!

Dong

former_member193190
Participant
0 Kudos

We do understand the Naming convention for the script file name but i also want to understand the Naming Convention to be used in the code that we are writing within the script

Former Member
0 Kudos

Ah, OK!

Again, the answer is no, aside from the usual JavaScript capitalisation conventions. Scripts tend to be small and self-contained, and so there's generally no need for a lot of structure to the names. There often aren't many objects created in a script in any case.

Of course, if you are writing more complex scripts it might help to have some naming conventions. I've never felt the need, personally. This might make a good blog, if you wanted to do some experimentation and write it up for the rest of us .

Steve.

former_member193190
Participant
0 Kudos

Thanks Everyone!!

Former Member
0 Kudos

Just my experiences for script buttons:

I use to give those hidden buttons with name like

H1:call some tcode

Then all the visible buttons that call the hidden buttons to do something, are named as

ACT: fetch data

So by looking at the name, I can see what they are used for. Also in JS, I will add comment like call button H1. Then it will be easier to find which buttons are called.

Br,


Dong

Former Member
0 Kudos

That's a really good point. All those hidden buttons make script maintenance a bit difficult, and giving the button a descriptive name really helps...

Steve.

Former Member
0 Kudos

Thx.

Dong

Carifaine
Active Participant
0 Kudos

I personally preferred to save my scripts as local files in a central directory available to other developers. So we used <tcode>_<descriptive_name> as naming convention. Though, as Steve already stated, there is no need to do so because scripts are mostly bound to specific transactions. You could think of a few scripts like "back" or "exit" which you could save at a central directory to perform actions you would need on a lot of flavors due to your ui guideline e.g.

Former Member
0 Kudos

There isn't.

In Personas 2, scripts don't have names - they are simply attached to script buttons - so there's no need for one anyway!

In personas 3, scripts do have names, but the names aren't relevant outside the flavour in which they live and typically you don't have more than a handful of scripts in a flavour so for both of those reasons name management isn't a big deal. I just give my scripts reasonably descriptive names, and don't think too hard about it.

Steve.