Purpose Read an ALV grid |
Solution
Example
We read PM operations via IW37N and display them in a SAP GUI table: ![]() GuiXT script
Pushbutton
(toolbar)
"Load operations"
_
process="load_operations.txt"
if
V[opcount>0]
Table
(2,2)
(30,135)
name="operations"
rows="&V[opcount]"
_
fixedcolumns=6
title="&V[opcount]
operations
selected"
Column
"Order"
name="aufnr"
size=8
Column
"Description"
name="ktext"
size=40
Column
"Operation"
name="vornr"
size=8
Column
"Short text"
name="ltxa1"
size=40
Column
"Workplace"
name="arbpl"
size=10
Column
"Syst.State"
name="sttxt"
size=20
endif Input script load_operations.txt
Enter
"/niw37n"
// Selection of Orders and
Operations
Screen
RI_ORDER_OPERATION_LIST.1000
Title
"Please wait... Reading operations"
Set
F[Period]
"25.02.2000"
Set
F[Period to]
"31.12.2017"
Enter
"/8"
// Execute
// List of Orders and
Operations
Screen
SAPLSLVC_FULLSCREEN.0500
Title
"Please wait... Reading operations"
Enter
"==%PC"
// popup screen
Screen
SAPLSPO5.0110
Title
"Please wait... Reading operations"
// SAP displays the text in this general
// popup via an HTML control
// we can disable the control
// avoiding that the popup becomes visible
// for a short moment
Disable
controls
// save Windows clipboard content
CopyText
toText="cbbackup"
-fromClipboard
// select "clipboard" option
Set
R[In the clipboard]
"X"
Enter
Screen
SAPLSLVC_FULLSCREEN.0500
Title
"Please wait... Reading operations"
// read the clipboard into a text variable
CopyText
toText="temp"
-fromClipboard
// restore the clipboard
CopyText
fromText="cbbackup"
-toCLipboard
// clear all values
Clear
V[operations.*]
// skip
3
header rows
Set
V[k]
4
// table row index
Set
V[n]
0
label
next_row
CopyText
fromText="temp"
toString="s"
line="&V[k]"
if
Q[ok]
// increase row index
Set
V[n]
&V[n]
+ 1
CopyText
fromString="s"
toText="cells"
CopyText
fromText="cells"
toString="operations.cell.aufnr.&V[n]" _
CopyText
fromText="cells"
toString="operations.cell.ktext.&V[n]" _
CopyText
fromText="cells"
toString="operations.cell.vornr.&V[n]"
_
CopyText
fromText="cells"
toString="operations.cell.ltxa1.&V[n]" _
CopyText
fromText="cells"
toString="operations.cell.arbpl.&V[n]" _
CopyText
fromText="cells"
toString="operations.cell.sttxt.&V[n]" _
Set
V[k]
&V[k]
+ 1
goto
next_row
endif
Set
V[opcount]
&V[n]
Return |
Components |