on 05-02-2013 12:17 AM
Hi All,
I am working on automating Goods Issue (GI) for more than one reservation via SAP Personas and have stumbled on a situation where my result from MB25 transaction is a list of Reservations and this can be 1 or many. I want to know if we can represent the "TextBox:WebGUI" as a table?
Thanks in advance,
Aravindan K
Hi Aravindan,
You can only add the controls in the image below as custom controls to the screen. So, it is not possible to add a TableView or ALV Grid. However, if you don't really need it as a table but just a big text box that contains multiple lines from a table, then yes this is possible. You need the CopyTable action to copy the content of a table and then you use a Calculate in JavaScript action to concatenate all table cells in a string (use \n for linebreaks) and last but not least you paste the string using the Paste Value action.
Cheers,
Tobias.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aravindan,
Personas does not have a "loop" function for scripts. So, there is no simple way to loop a sequence of script actions. However, there are two approaches you could go which might have a similar effect.
Hope this helps.
Cheers,
Tobias.
PS: I will try to create a How To showing these two options and then post it on SCN but this will most likely happen after SAPPHIRE.
Hello,
In the scenario above, would there be any issue with creating a set of "looped" script buttons?
1.1) Script copies table to args.table
1.2) Script creates args.row_iterator with value 1
1.3) Script hits button 2
2.1) Button 2 checks if args.row_iterator >= args.table # of rows (javascript)
2.No.1) Write the table line
2.No.2) Push Button 3
2.Yes) No Action
3.1) args.row_iterator = args.row_iterator+1
3.2) Push Button 2
Admittedly, performance might be terrible, but it seems like that would create a looping function; would it not?
Rob
It is my experience that a button script does not stop executing when a secondary button is pushed within the script, even when the push is the last command in the sequence. Therefore, a sequence like pushing Button1 -> Button2 -> Button3 -> Button 2 would fail because Button 2 is still executing from the first push.
Has anyone else had any luck creating a sort of "button-pushing loop" with scripting?
Hi Sushant,
Currently I am working on HR module and working on address infotype. We have a scenario where the user can have multiple emergency addresses at a given point of time.If I could copy the table and then process it in a loop,I can save some efforts in displaying the data on screen.
I have yet to start actual work as I have to check whether I can achieve this.
Regards
Abhi
If you copy the table, you can manipulate it in javascript; that would let you display multiple entries, by using the join() function; unfortunately, I've found that I have to either reference the prototype object for the array, or load all the data into a new, declared array:
Something like:
ar ar = new Array();
while (ar.length<args.input_table.length) {
ar.push(args.input_table[parseInt(ar.length)][0].toString());
};
args.output_string = ar.join();
That will work for a one-dimensional string array; usually, I've found I need to use the first array to find the column I want, and a second array for the actual data:
ar ar = new Array();
while (ar.length<args.arg_table.length) {
ar.push(args.arg_table[parseInt(ar.length)][0].toString())
};
var len = ar.indexOf("FIELD_HEADER");
var ar2 = args.arg_table[len];
args.s2 = ar2.join();
Often, I'm trying to find a unique value (or return an error), so I modify slightly:
var ar = new Array();
while (ar.length<args.arg_table.length) {
ar.push(args.arg_table[parseInt(ar.length)][0].toString())
};
var len = ar.indexOf("FIELD_HEADER");
var ar2 = args.arg_table[len];
var out_val = ar2[1];
var i=1;
while( i<ar2.length) {
if (ar2[parseInt(i)].toString() != out_val.toString()) {
out_val = "Error!"};
i=i+1;
};
args.s2 = out_val.toString();
Hopefully that helps.
Hi Sushant,
did you get a chance to have a look at the problem mentioned? Getting error when trying to copy table (Not ALV) ?
One more Q is, I am trying to do date calculations in Personas using JavaScript. However, if I use statement args.new_date = new Date(); new_date variable has a value System.Windows.Browser.ScriptObject naturally further steps fail. Anu suggestions on this?
Regards
Abhi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.