Copying a text into a text variable on the VA01 screen.

In transaction VA01 'Sales Order entry', and on the items overview Tab (where the user enters each item) we currently have a GuiXT button that takes the users to the item texts fields. Here they can enter texts for each item. We have been trying to develop another button on the Items Overview tab which will display the text the user entered for that item. This button would call a script which would go to the text screen, set a variable with the contents and display the contents in a text box back in the Items Overview tab.

The problem we are having is that we cannot read the contents of the text object e.g.:

Enter control="TableTreeControl" item="0001" event="22" is all we are getting. It is always item 0001.

Is what we are trying to do possible with GuiXT, and if so, how?

In order to copy the text into a text variable, please use the CopyText statement. Since the text edit control on the VA01 screen has no screen element name, please use the coordinates. Any coordinates within the text edit control will work. I have just tested the operation with


// GuiXT script  "sapmv45a.e4001.txt"


Pushbutton (toolbar) "Display item text" process="display_text.txt"


Box (7,83) (15,120) "Item text"

TextBox (8,84) (15,120) name="t1" -readonly



// InputScript "display_text,txt"

 

// Clear text

Set V[empty] ""

CopyText fromString="empty" toText="t1"


// goto item text

Enter "=PTEX_SUB"

 

// 1st text category

Screen SAPMV45A.4003

  Set V[myindex] 1

  Enter "=TP_FIRST"



// Text display

Screen SAPMV45A.4003

  CopyText fromScreen=(5,30) toText="t1"

  Enter "/3"


This will work fine if you  display only the first text category. In the case of several text categories, it becomes more difficult. The tree control on the left hand side can be handled by "SAP GUI Scripting" or by the "Native COntrol Interface" of GUiXT Controls. If the text categories are always the same, with the same order, you can scroll through them with  "=TP_NEXT".


The following script will read the text with a parameterized text category index:


// GuiXT script  "sapmv45a.e4001.txt"

Pushbutton (toolbar) "Display text Cat1" process="display_text.txt"

   using INDEX = "1"

Pushbutton (toolbar) "Display text Cat2" process="display_text.txt"

   using INDEX = "2"


Box (7,83) (15,120) "Item text"

TextBox (8,84) (15,120) name="t1" -readonly


// InputScript "display_text,txt"

Parameter INDEX  1

 

// Clear text

Set V[empty] ""

CopyText fromString="empty" toText="t1"


// goto item text

Enter "=PTEX_SUB"

 

// 1st text category

Screen SAPMV45A.4003

  Set V[myindex] 1

  Enter "=TP_FIRST"


// Text display

label textdisplay

Screen SAPMV45A.4003


  if V[myindex<&U[INDEX]

    Set V[myindex] &V[myindex] + 1

    Enter "=TP_NEXT"

    goto textdisplay

  endif

 

// copy text and returnt

  CopyText fromScreen=(5,30) toText="t1"

  Enter "/3"