Moving fields between tabs

Screens with tabs are common in complex transactions dealing with lots of different fields.  The tabs represent one  way of grouping similar fields together. The user does not always appreciate  this logical ordering, being more interested in simply finding a way to reach the relevant fields without clicking through all tabs.    

With GuiXT and InputAssistant you can customize tabbed screens, but it requires advanced knowhow. The main reason for its not being as simple as one might wish is that R/3 uses the tabs not only on the frontend layer, as one of the ways to present the data, but it connects the tab structure with the application logic.  This is the main reason why you will need some understanding of the transaction logic if, for example, you want to move some fields from one tab to another. There is the danger that your solution will work for a certain path through the transaction, but with a different path it won’t work. So take care not to create excessive complexity that will result in heaps of InputScript logic. 

Example 1

We start with a typical example. Let’s assume that in order entry (transaction VA01) some fields should be moved from the somewhat hidden tab “Purchase order data” to the first tab “Sales”.

Sap Guixt tabs01 Moving fields between tabs
 VA01 Standard, Navigation to “Purchase order data”

We are interested in establishing a faster data entry for the fields

  • Name
  • Reference
  • Purchase order type (SCHR=Written or TELE=telephone)

Sap Guixt tabs02 Moving fields between tabs
VA01 Standard, Tab  “Purchase order data”

The solution that we discuss here looks as follows:

Sap Guixt tabs03 Moving fields between tabs
VA01 with GUiXT:  “Purchase order data” on 1st tab

You can also see that we represent the purchase order type as 2 radiobuttons instead of coded input.

The implementation here has the advantage that both the fast data entry through our new fields and the standard VA01 tab “Purchase order data” can be used. The input in any of the fields is automatically carried over to the other field. It is no small achievement to be able to guarantee this, even in the case of input after error messages and warnings, and you need the GuiXT element “Link” in order to implement a relatively short solution.

Here are the scripts that you will need (2 GuiXT scripts  and an InputScript). You can  find additional comments in the scripts, and also further on in this article.

SAPMV45A.E4001.TXT
//———————————————————————————–
// Example: Order entry with VA01, 3 purchase order fields moved to “Sales” tab
//———————————————————————————–
// The solution implemented here allows the use of both the new entry fields 
// and the standard entry fields
// In order to keep all fields synchronized,
// even after re-input on error or warning messages,
// the “Link” command is used in the scripts instead of “Set”
//———————————————————————————–
// Requires GuiXT version 2001 Q3 07 and upwards
// Example based on R/3 IDES 4.6C 
//———————————————————————————–

if Q[Transaction=VA01] and Q[Page=Sales]

  Set V[Order_Sold_to] “&[Sold-to party]“
  Set V[Order_Ship_to] “&[Ship-to party]“

  // Reset all fields if new order
  if not V[Order_Sold_to] and not V[Order_Ship_to]
    Set V[Order_*] ” “
  endif

  // Work with “Offset” depending on field within tab 
  // to select right screen area 
  Offset F[Deliver.plant]+(0,46)

  Box (0,0) (6,34) “Purchase order data”
  InputField (1,1) “Name” (1,12) “Size=20″ “Name=Order_Name”
  InputField (2,1) “Reference” (2,12) “Size=12″ “Name=Order_Reference” 

  Radiobutton (4,1) “by letter/fax” “Name=Order_Type” “Value=SCHR” 
  Radiobutton (5,1) “by telephone”  “Name=Order_Type” “Value=TELE” 

  // Update processing: Fill in purchase order data first
  On “/11″ “Fcode=KBES” “Process=Order_Update.txt”
  On “/Menu=1,6″ “Fcode=KBES” “Process=Order_Update.txt”

  // Equate F3 with Cancel (F12) to avoid update on popup screen
  // (normal F3 could be simulated as well if necessary)
  On “/3″ “Fcode=/12″
  On “/Menu=3,5″ “Fcode=/12″

endif

SAPMV45A.E4002.TXT
if  Q[Page=Purchase order data]
  Link [Your reference]      V[Order_Reference]
  Link [Name]                V[Order_Name] 
  Link [Purchase order type] V[Order_Type]
endif

Order_Update.txt
// Show errors on standard screens
No return on error

// Skip information “Sales area redetermined”
Screen sapmsdyp.0010
  Enter

Screen sapmv45a.4002
  Link [Your reference] V[Order_Reference]
  Link [Name] V[Order_Name] 
  Link [Purchase order type] V[Order_Type]

  Enter /11

Comments

  1. Be sure to use at least GuiXT 2001 Q3 07, since the “Link” command is not avialbale in earlier versions
  2. We restrict the script to transaction VA01 and to the tab “Sales”
  3. It pays to give thought to finding the right place to reset the variables. The initial screen of a transaction is sometimes a good place, but not always: In VA01, for example, the use
    r stays on the 2nd (main) screen after completing the order entry. SInce R/3 then clears the fields “Sold-to party” and “Ship-to party”, this is a good environment for clearing your variables as well. It might also make sense in certain cases to keep some of the values that the user has entered.
  4. The “Offset” command allows us to move the whole group of new entry fields to a different place on the screen without fuss. In addition, since “Offset” refers to a field on the tab, the new fields are assigned to this area of the screen as well. This is especially important in the case of scrollable areas of a screen.
  5. The update can be done by /11 or CTRL+S or clicking on the update icon. These 3 possibilities result in a /11 function code. A 4th possibility for the user is to click on “Save” in the menu, which is the reason for the ON /Menu=1,6. 
  6. It is somewhat complicated to handle the update option in the F3 popup. Here we have chosen the simple way of assigning /12 to /3, which makes no appreciable difference for the user. 
  7. The “Link” commands set the value of the variables to the input fields, and also update the variables automatically as soon as the user enters a new value.
  8. The information “Sales area redetermined” is normally shown when the user hits Enter the first time. If the user presses the update button immediately after entering the data, then this additional popup is skipped over.

 

Example 2

We enhance example 1 so that it will also work for transaction VA02 (Change purchase order) and transaction VA03 (Display purchase order). The technique is quite similar to what we discussed already in example 1. In addition, we first navigate to the “Purchase order data screen” using the command 

Enter “=KBES” “Process=Order_get_additional_fields.txt”

 in order to fill the variables  V[Order_Reference], V[Order_name], V[Order_type].  

 

SAPMV45A.E0102.TXT

// 1st screen VA02/VA03 
//
  Reset variables
Set V[Order_*] ” “

SAPMV45A.E4001.TXT

// Example: Order entry with VA01/VA02/VA03 , 3 purchase order fields moved to “Sales” tab
//———————————————————————————–
// The solution implemented here allows the user to use both the new entry fields 
// and the standard entry fields
// In order to keep all fields synchronized,
// even after re-input on error or warning messages,
// the “Link” command is used in the scripts instead of “Set”
//———————————————————————————–
// Requires GuiXT version 2001 Q3 07 and upwards
// Example based on R/3 IDES 4.6C 
//———————————————————————————–

if Q[Transaction=VA01] and Q[Page=Sales]

  Set V[Order_Sold_to] “&[Sold-to party]“
  Set V[Order_Ship_to] “&[Ship-to party]“

  // Reset all fields if new order
  if not V[Order_Sold_to] and not V[Order_Ship_to]
   Set V[Order_*] ” “
  endif

  // Work with “Offset” depending on field within tab 
  // to select right screen area 
  Offset F[Deliver.plant]+(0,46)

  Box (0,0) (6,34) “Purchase order data”
  InputField (1,1) “Name” (1,12) “Size=20″ “Name=Order_Name”
  InputField (2,1) “Reference” (2,12) “Size=12″ “Name=Order_Reference” 

  Radiobutton (4,1) “by letter/fax” “Name=Order_Type” “Value=SCHR” 
  Radiobutton (5,1) “by telephone” “Name=Order_Type” “Value=TELE” 

  // Update processing: Fill in purchase order data first
  On “/11″ “Fcode=KBES” “Process=Order_Update.txt”
  On “/Menu=1,6″ “Fcode=KBES” “Process=Order_Update.txt”

  // Equate F3 with Cancel (F12) to avoid update on popup screen
  // (could be handled as well if necessary)
  On “/3″ “Fcode=/12″
  On “/Menu=3,5″ “Fcode=/12″

endif

if Q[Transaction=VA02] and Q[Page=Sales]

  // Read additional fields
  if not V[Order_additional_fields_done=X]
    Set V[Order_additional_fields_done] “X”
    Enter “KBES” “Process=Order_get_additional_fields.txt”
  endif

  // Work with “Offset” depending on field within tab 
  // to select right screen area 
  Offset F[Deliver.plant]+(0,46)

  Box (0,0) (6,34) “Purchase order data”
  InputField (1,1) “Name” (1,12) “Size=20″ “Name=Order_Name”
  InputField (2,1) “Reference” (2,12) “Size=12″ “Name=Order_Reference” 

  Radiobutton (4,1) “by letter/fax” “Name=Order_Type” “Value=SCHR” 
  Radiobutton (5,1) “by telephone” “Name=Order_Type” “Value=TELE” 

  // Update processing: Fill in purchase order data first
  On “/11″ “Fcode=KBES” “Process=Order_Update.txt”
  On “/Menu=1,6″ “Fcode=KBES” “Process=Order_Update.txt”

  // Equate F3 with Cancel (F12) to avoid update on popup screen
  // (could be handled as well if necessary)
  On “/3″ “Fcode=/12″
  On “/Menu=3,5″ “Fcode=/12″

endif

if Q[Transaction=VA03] and Q[Page=Sales]

  // Read additional fields
  if not V[Order_additional_fields_done=X]
    Set V[Order_additional_fields_done] “X”
    Enter “KBES” “Process=Order_get_additional_fields.txt”
  endif

  // Work with “Offset” depending on field within tab 
  // to select right screen area 
  Offset F[Deliver.plant]+(0,46)

  Box (0,0) (6,34) “Purchase order data”
  Text (1,1) “Name” 
  Text (1,12) “&[Order_Name]” “-Border” “Size=20″
  Text (2,1) “Reference” 
  Text (2,12) “&[Order_Reference]” “-Border” “Size=12″

  if V[Order_Type=SCHR]
    Text (4,1) “Purchase order by letter/fax”
  endif
  if V[Order_Type=TELE]
    Text (5,1) “Purchase order by telephone”
  endif

endif

 

Order_get_additional_fields.txt
Screen sapmv45a.4002
  Set V[Order_Reference] “&F[Your reference]“ 
  Set V[Order_Name]      “&F[Name]“ 
  Set V[Order_Type]      “&F[Purchase order type]“ 

  // Return to overview
  Enter “/3 “

 

 

Moving fields between tabs