cancel
Showing results for 
Search instead for 
Did you mean: 

Copy values for use in new session SAP Personas

former_member105930
Active Participant
0 Kudos

Hi experts,

Is there a way in SAP Personas to be in one transaction, copy a value from that transaction, then on the press of a script button, open a new transaction in a new session (using /oME2N) but then paste the copied values into the new transaction?

My example is that I am in transaction MM03 Display material. I wish to copy the material number, open transaction ME2N Purchasing Documents per number, default some values and then paste the copied material number into the relevant field.

I get the new transaction to open correctly, but I am unable to then paste the copied value (I assume this is lost when the new session opens), and other default values that are in my script are also lost?

Can this be achieved?

thanks,

Ian

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ian,

the copied values stay alive as long as the script runs. You can paste the values into hidden fields on the screen with the script button. Then you can copy the values again in the script of the script button and use them in this script. But: I believe, you cannot access the fields in the new session. You will have to stay in the same session to manipulate the fields.

Regards

Björn

former_member105930
Active Participant
0 Kudos

Thanks Björn,

You have confirmed what I suspected to be the case. It looks like I will have to as you say, stay in the same session and leave my original display screen to go to the new transaction.

thanks for your assistance (again!)

Regards,

Ian

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Ian,

Maybe you can try it this way:

1. In 1st Tcode, "Paste Value" of your result into a hidden field on the Personas init screen.

2. Now do 2nd Tcode: first, "Copy Value" of the hidden field into a var, myVar.

3. In a script button, call the Tcode to go to the new screen, then do "Paste Value" of myVar into the field you want.

Does this help?

Dong Zhu

former_member105930
Active Participant
0 Kudos

Hi Dong,

Thank you for your reply. Yes I have tried as you say, but the values are lost when you open a new session (using /o).

Unless you are referring to using Java to store the values, which I have thought about, but I am a complete Java script novice at the moment, so I wouldnt know where to start

thanks,

Ian

nmkarthikeya
Active Participant
0 Kudos

Hi Ian,

May be you can try writing webrfc.

Before navigating to the new screen(using/o) you can call webrfc and store the value in a table and once you are in next screen call webrfc to fetch the data stored.

Hope this helps.

Regards,

Karthikeya

Former Member
0 Kudos

That will get very complicated very quickly. Don't forget you need to deal with multiple users doing this at the same time, or indeed the same user doing it in two separate sessions at (almost) the same time. You'll need a way to identify which stored value belongs to which session, and you'll need to lock the table during updates. It sounds like a lot of work to me.

Why are you opening ME2N in a new session? Perhaps there's a way to avoid that?

Steve.

nmkarthikeya
Active Participant
0 Kudos

yes that's true and i have faced it too. But you can always have username as primary key. If you have few fields to be saved then would it not work? same user in two session is a headache, best avoided than handled

Regards,

Karthikeya

former_member105930
Active Participant
0 Kudos

Yes its starting to sound like its simply best to open in the same session and be done with it.

The only reason I wanted to open it in a new session was so the user who is calling it from the Display Material Transaction MM03, did not lose the data from his current session.

I've implemented a workaround whereby I copy the Material Code within my script from the MM03 transaction and paste it to a hidden field in ME2n.

when the user then uses the back button, I have replaced standard back button with a script that then copies the hidden field, and opens transaction MM03 using the copied value as the material number.

Problem sorted, I just needed to think outside the box a bit more.

thanks again for you input Steve,

Ian

former_member105930
Active Participant
0 Kudos

Hi Karthikeya,

I have opted to open the new transaction in the same session with a script that copies the original value from MM03 Display material into the new transaction ME2n into a hidden field, so this can be copied again when the user exits out of ME2n.

thanks again for all of your assistance, I do appreciate it,

Ian

Former Member
0 Kudos

That's exactly the approach I was going to suggest. Personas gives you a lot more outside the box than you realise, sometimes

There's almost always an easier way, if you forget about how SAPgui works and think about how your users want to work. SAPgui-thinking is a straight jacket - break free!!!

Steve.