cancel
Showing results for 
Search instead for 
Did you mean: 

Personas 2.0: ME51N: How to set a value to all the cells of a column in a table?

Former Member
0 Kudos

Hi Personas 2.0 experts,

Here is the usecase: start tcode "ME51N", expend the icon "Item Overview" to display the table. I added a text field where user will type a free text. Then by pressing a button, I want the free text to be copied into all the lines of a column of the table, eg, into each line of column "Requested by".

Anyone know hwo to do this? I know how to get info from a table, but not write info into the table.

Thanks a lot!

Dong Zhu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The problem, in Personas 2 at least, is the "all lines" bit. There's no way to build a loop in Personas 2 that can iterate over all the lines in a table to write to it. You can do this in Personas 3, but not in Personas 2.

The best you can do is unroll the loop - assume a maximum number of rows in the table and write code like:


if cell in row 1 exists

     paste into row 1

if cell in row 2 exists

     paste into row 2

if cell in row 3 exists

     paste into row 3

...

It isn't pretty, but it should work if you pick a large enough number.

If the requisition might have more rows than fit on the screen at once, and so you have to scroll to get to a 2nd or 3rd screenful, this gets more complex, and I'm not sure I'd recommend it.

Again, Personas 3 can manage this. You don't have long to wait... 🙂

Steve.

Former Member
0 Kudos

Hi Steve,

Thanks very much for the reply. The Personas 3.0 is definitely better but we cannot wait for that, so far I have to use Personas 2.0, unfortunately.

Just for now, could you please provide more detail of script code, for a simple case, say I want to press a script button, then text "value 1" and "value 2" will be written to the first line and second line of the column "Short Text" in the table (of Item Overview) of tcode "ME51N"?

I can see the id of the column but how I can enter a value in a cell using script? Thanks so much!

Dong Zhu

Former Member
0 Kudos

Just record yourself putting a value in a cell and you should get what you need. Somewhere in the id in the recording you'll see a row number, so after recording the first one you can just copy/paste the id and change that row number for the next ones.

Steve.

Former Member
0 Kudos

Hi Steve,

Thanks a lot! I guess I was doing just one cell first why I did not see any script recorded. Later I did a nit more action filling more cells and I got the script recorded.

All in all it has to be a "static id" of the cell that cannot be variable. I have to apply the copy/paste to each specific cell with given row and column numbers.

Set to answered.

Dong

Answers (0)