Purpose You need to read certain strings or enter values in an ABAP list
Some SAP transactions use ABAP lists to display values or let the user select values. The sreen number for such lists is "0120" and no screen elements are displayed in the GuiXT window.
Solution
To read strings, use the predefined variables V[_listline(1), V[_listline(2)], ... with an appropriate line number. Example:
SetV[fname]"&V[_listline(5)](4,20)"
The line number can be specified as a variable:
SetV[fname]"&V[_listline(&V[k])](4,20)"
To write strings, use Setlist[...], for example
Setlist[&V[k],1,1]"X"
Example The following InputScript automates transaction SE16, where the field selection is implemented as an ABAP list.
GuiXT
// script parameters
Parameter TABLE "MARC"
Parameter FIELDS "MATNR,WERKS,MMSTA,MATGR"
Parameter FROM "40"
Parameter TO "70"
// list of fields to display in SE16, we add a closing ,
Set text[fieldlist] "&U[FIELDS],"
// start transation SE16
Enter "/nse16"
Screen SAPLSETB.0230
Set F[DATABROWSE-TABLENAME] "&U[TABLE]"
Enter
// generated screen, its name depends on the table name
Screen *
Set F[I1-LOW] "&U[FROM]"
Set F[I1-HIGH] "&U[TO]"
// to field selection
Enter "=FELD"
Screen SAPLSETB.0120
// clear field list
Enter "/14"
label select_fields
Screen SAPLSETB.0120
// skip list header lines
Set V[k] 3
label check_fname
// no more list lines to process on this page?
if not V[_listline(&V[k])]
goto scroll
endif
// pick up field name
Set V[fname] "&V[_listline(&V[k])](4,20)"
// field name in field list?
replaceText fieldlist from="&V[fname]," to=""
// yes, tick checkbox in list
if Q[ok]
Set list[&V[k],1,1] "X"
// no field left?
if not text[fieldlist]
goto done
endif
endif
// next line
Set V[k] &V[k] + 1
goto check_fname
label scroll
// any lines left?
if V[_listlastvisiblerow<&V[_listlastrow]]
Enter "/23" // scroll
goto select_fields
endif
label done
// back from field selection
Enter "/6"
// generated screen, depends on the table name
Screen *
// display results
Enter "/8"