InputAssistant Tutorial General topics 1 2 3
4 Fields on tab controls
5 6 continue

Often the fields of a transaction are displayed on several tabs.  For rapid data entry it might be useful to combine these fields on one single tab. This is a bit more complicated than rearranging fields on a screen, since the transaction’s logic plays an important part here.

You will find the essential techniques in this tutorial. The aim is  for transactions

  • AS01: Create Asset

  • AS02: Change Asset

  • AS03: Display Asset

to display the fields needed for net worth valuation on the “General” tab.  

Transaction AS02 (SAP 4.6C) looks like this:

Sap Guixt image.ia.8.01 Fields on tab controls

We want to display the fields in the red rectangle on the “General” tab. They will be deleted on the “Net worth tax” tab.  We will move the group box and fields “Real estate and similar rights”  to the top of the “Net worth tax” tab and rename this tab “Estates”. 

The new “General” tab now looks like this:

Sap Guixt image.ia.8.02 Fields on tab controls

You see that we have changed two fields into selections of radiobuttons (“Property indicator” and “Reason for valuation”).

How to proceed:

  • We change the layout of the two tabs (Delete  valuation fields on the “Net worth tax” tab, move “real estate and similar rights” fields to the top and insert new fields onto the “General” tab). 

  • With the help of special InputScripts we fill in the fields in Change and Display mode. When the tab “General” is opened for the first time we move to the “Net worth tax” tab via InputScript, fill in the values into our InputScript variables and return to the “General” tab. Please note that the InputScripts can access all fields even though they are no longer displayed on the tab.

  • In the same way we make sure that in Create and Change mode our new fields are read when we “save”.

  • We pay special attention to the handling of data entry mistakes. Error messages concerning our new entry fields are displayed on the “General” tab, so that mistakes can be corrected immediately. 

The scripts that we have used in this tutorial can be found in a .zip-file so that you can use them for your own tests: as_zip.zip. Please test with SAP 4.6C and GuiXT 2004 Q3 4 or later versions.

On the initial screens of AS01 and AS02/AS03 we delete all variables. Our special naming of these variables – all InputScript variables for the three transactions start with “AS_” – makes this operation easy:

// GuiXT Script saplaist.e0105.txt
// Delete variables of AS transactions  

Set V[AS_*] “” 

// GuiXT Script saplaist.e0100.txt
// Delete variables for AS01 / AS02 /AS03

Set V[AS_*] “”

Layout changes and calling up the right InputScripts are done in the GuiXT script for the AS01/AS02/AS03-screen saplaist.1000: 

// GuiXT Script “saplaist.e1000.txt
// Transactions AS01 / AS02 / AS03

// Some fields are transferred from the”Net worth value”
//  tab to the “General” tab

// InputScripts Used:
//
// AS_read.txt Read data
// AS_save.txt Save
// AS_check.txt Check
//——————————————-

// All V[AS_*] variables are initialized on entry screen of transaction

// To make sure that all variables are initialized, if
// asset number has changed in case of call from lists etc.

if not V[AS_asset=&F[Asset]]
  Set V[AS_*] “”
  Set V[AS_asset] “&F[Asset]“
endif

// Set read-only flag for display, to allow
// using the same InputField commands for all transactions

if Q[Transaction=AS03]
  Set V[AS_readonly] “-readonly”
endif

// Read values first time when change or display
if Q[Transaction=AS02] or Q[Transaction=AS03]

  if not V[AS_read=X]
    Set V[AS_read] “X”
    Enter process=”AS_read.txt”

    // Leave script since screen is not displayed
    Stop

  endif

endif

// Rename tab, since only real estate-fields are left
Text P[Net worth tax] “Estates”

// General Tab – display own fields
if Q[Page=General]

  // Suppress inner scrollbar
  NoScrollBar

  // Start just below last box
  offset G[Posting Information]+(5,0)

  box (0,0) (9,80) “Net worth value”

  pushbutton (1,78) “@0Q\Qdescription net worth value@” “=LTXTNETA”

  inputfield (1,1) “Classification key” (1,24) size=4   name=”AS_classification_key” “&V[AS_readonly]” techname=”ANLA-VMGLI”
  Text (1,30) “&V[AS_classification_key_text]” -border

  inputfield (2,1) “Net worth value” (2,24) size=16 name=”AS_man_value”   “&V[AS_readonly]” -numerical

  Box (4,1) (8,20) “Property indicator” 
  radiobutton (5,2) “Property” name=”AS_property_indicator” value=”1″   “&V[AS_readonly]“
  radiobutton (6,2) “Leasing” name=”AS_property_indicator” value=”2″   “&V[AS_readonly]“
  radiobutton (7,2) “Share” name=”AS_property_indicator” value=”3″   “&V[AS_readonly]“

  Box (4,30) (8,49) “Reason for valuation”
  radiobutton (5,31) “Assessed value” name=”AS_man_reason” value=”003″   “&V[AS_readonly]“
  radiobutton (6,31) “Rental value” name=”AS_man_reason” value=”001″   “&V[AS_readonly]“

endif

// “Net worth tax” tab; delete those fields that are now on the “General” tab
if Q[Page=Net worth tax]
  del G[Net worth valuation]
  pos G[Real estate and similar rights] (5,1)
endif

if Q[Transaction=AS01] or Q[Transaction=AS02]

  // When saving AS01/AS02 call own script
  on “/11″ process=”AS_save.txt”
  on “/Menu=1,7″ process=”AS_save.txt”

  // No save in pop-up, treat like /12
  on “/3″ fcode=”/12″
  on “/15″ fcode=”/12″

  // On “Enter” in “General” tab, check additional entries
  if Q[Page=General]
    on Enter process=”AS_check.txt”
  endif

endif

The InputScript “AS_read.txt” reads the valuation inputfields on the appropriate tab and goes back to the “General” tab. Textfields can also be read and displayed on the new tab.

// InputScript AS_read.txt

// Go to tab “Net worth tax”
Enter “=TAB05″

// AS02, Net worth valuation
Screen SAPLAIST.1000
  Set V[AS_classification_key] “&F[Classification key]“
  Set V[AS_classification_key_text] “&F[T092T-VMTXT]“
  Set V[AS_property_indicator] “&F[Property indicator]“
  Set V[AS_man_reason] “&F[Reason for man.val.]“
  Set V[AS_man_value] “&F[Man.net wrth val.]“

  Enter “=TAB01″

Similarly, “AS_save.txt” sets the additional fields into the standard fields before saving. In case of error messages we go back to the “General” tab.

// InputScript AS_save.txt
// Save in transactions AS02 and AS03

// Go to “Net worth tax”
Enter “=TAB05″

//”Net worth tax”
Screen SAPLAIST.1000

  // Remember old values to use them in case of error
  Set V[AS_corr_property_indicator] “&F[Property indicator]“
  Set V[AS_corr_man_value] “&F[Man.net wrth val.]“

  // Enter new values  
  Set F[Classification key] “&V[AS_classification_key]“
  Set F[Property indicator] “&V[AS_property_indicator]“ 
  Set F[Reason for man.val.] “&V[AS_man_reason]“
  Set F[Man.net wrth val.] “&V[AS_man_value]“

  // Save, on error continue
  Enter “/11″ OnError=Continue

  // Error message: Set back values, because of some errors
 
// Otherwise we might not be able to leave tab
  Set F[Property indicator] “&V[AS_corr_property_indicator]“
  Set F[Man.net wrth val.] “&V[AS_corr_man_value]

  // Go back to first tab with error message
  Message “&V[_lasterror]” -statusline

  Enter “=TAB01″

It is not necessary to check data entry with a separate InputScript as we did here (AS_check.txt), since the checking is done in any case when “saving”. But its more userfriendly to check entry data at the first “Enter”. 

 // InputScript AS_check.txt
// Check data entry

// // Go to tab “Net worth tax”
Enter “=TAB05″

// Net worth tax
Screen SAPLAIST.1000

  // Save old values to use them in case of error
  Set V[AS_corr_property_indicator] “&F[Property indicator]“
  Set V[AS_corr_man_value] “&F[Man.net wrth val.]“

  // Enter new values  
  Set F[Classification key] “&V[AS_classification_key]“
  Set F[Property indicator] “&V[AS_property_indicator]“
  Set F[Reason for man.val.] “&V[AS_man_reason]“
  Set F[Man.net wrth val.] “&V[AS_man_value]“

  // Enter
  Enter OnError=Continue
  goto error

// Net worth valuation
Screen SAPLAIST.1000

  // Read text
  Set V[AS_classification_key_text] “&F[T092T-VMTXT]“

  // Net worth value – standard treatment
  Set V[AS_man_value] “&F[Man.net wrth val.]“

  // Back to first tab
  Enter “=TAB01″

  // Leave script, entries are OK
  Leave

  // treatment of error message
  label error

  // Restore previous values
  Set F[Property indicator] “&V[AS_corr_property_indicator]“
  Set F[Man.net wrth val.] “&V[AS_corr_man_value] “

  // Back to first tab with error message
  Message “&V[_lasterror]” -statusline
  Enter “=TAB01″


 

Sap Guixt weiter Fields on tab controls

Fields on tab controls