Purpose Let the user enlarge an image by mouse
click
Solution
1: Display the enlarged image in a separate window Use the start= option of the
Image command. Specify the same
image file; it will be shown in a separate window when the user clicks
on the image.
Solution 2: Display the enlarged image within the SAP GUI window Use
the input= option of the
Image command. Specify an
InputScript that sets a status variable. In your GuiXT script, query the
status variable and display the image in a different size.
Additional option for both solutions You can display
additional small buttons for zooming in and out of the image
Example We display a product image in transaction MM03. For
simplicity, we assume that the product images are all located in a
network directory.
GuiXT Script (Solution 1)
GuiXT
if Q[transaction=MM03] and Q[Page=Basic data 1]
// build product image filename
Set V[imagefile] "\\imgserver\productimages\&F[Material].png"
Box (5,86) (12,100) "Product image"
Image (5.7,86) (10.8,136.7) "&V[imagefile]" -noStretch start="&V[imagefile]"
endif
When the user clicks on the image, it is shown in a separate
window:
GuiXT Script (Solution 2)
GuiXT
if Q[transaction=MM03] and Q[Page=Basic data 1]
// build product image filename
Set V[imagefile] "\\imgserver\productimages\&F[Material].png"
if V[product_image_enlarged=X]
Box (5,87) (29,156) "Product image"
Image (5.6,87.7) (29,269.1) "&V[imagefile]" -noStretch _
input="OK:/0,process=enlarge_image.txt"
else
Box (5,86) (12,100) "Product image"
Image (5.7,86) (10.8,136.7) "&V[imagefile]" -noStretch _
input="OK:/0,process=enlarge_image.txt"
endif
endif
InputScript "enlarge_image.txt" GuiXT
if V[product_image_enlarged=X]
Clear V[product_image_enlarged]
else
Set V[product_image_enlarged] "X"
endif
return
When
the user clicks on the image, it is enlarged within the SAP GUI window:
A click on the enlarged picture shows it again in the small size.
It probably
makes sense to reset the variable
V[product_image_enlarged]in the initial screen of MM03 so that the user always starts
with the small product image.
Components
GuiXT (+ InputAssistant for solution 2)