Hello Guru's of Scripting.
We have a requirement to download inspection lot information for 4500+ plants using transaction QA33. We cannot use all plants at a time to get result output. I would like to run this report in parts. example: 20 plants at a time.
QA33 screen with plant selection:
Multiple selection for plant:
Here is my code so far:
_______________________________________________________________________________________________________________________________**********************************************************************************************************************************************************************************
//Counter
Set V[i] 1
//Input file that contains more than 4500 plants
Parameter mat_file1 "C:\Documents and Settings\Desktop\ip2.txt"
//Intermediate file to copy 20 plants at a time
Parameter mat_file3 "C:\Users\Desktop\myfile.txt"
//create myfile.txt text file on C:\Users\Desktop\ location before running program
OpenFile "&U[mat_file3]" -Output
OpenFile "&U[mat_file1]"
label Read_File
ReadFile "&U[mat_file1]" C
if not Q[ok]
CloseFile "&U[mat_file1]"
CloseFile "&U[mat_file2]"
CloseFile "&U[mat_file3]"
Return "Job done!" "&U[mat_file1]"
endif
// loops
//1st loop to make sure the total no of records do not exceed 4500
If V[i<4500]
AppendFile "&U[mat_file3]" C
Set V[i] "&V[i]" + 1
//Checking to make sure we append only 20 plants at a time.
//These 20 plants are added to myfile.txt
if V[i=21]
//myfile has 20 file it goes to transaction qa33 screen
Goto next_step
endif
goto Read_File
endif
label next_step
//Deletes default values from selection fields
Set F[%_QL_ENSTD_%_APP_%-TEXT] ""
Set F[%_QL_ENSTD_%_APP_%-TO_TEXT] ""
Set F[Plant] ""
Set F[Maximum No. of Hits] ""
// Inspection Lot Selection
Screen RQEEAL10.1000
//Clicked on multiple selection button
Enter "=%043" // Multiple selection.6
// Multiple Selection for Order
Screen SAPLALDB.3000
//This is equivalent to clicking on delete button from multiple selection
Enter "/16" //delete contents
// Multiple Selection for Plant
Screen SAPLALDB.3000
//Copy 20 plants from myfile to text t1
Copytext fromFile="&U[mat_file3]" toText="t1"
//Copy those 20 plants from t1 to clipboard
Copytext fromText="t1" -toclipboard
//Next step is to click on paste icon on dynamic selection
Enter "/24" //copy from clipboard
// Multiple Selection for Material
Screen SAPLALDB.3000
Enter "/8"
// Inspection Lot Selection
Screen RQEEAL10.1000
Enter "/8" // Execute
// Display data for inspection lot: Worklist for Inspection Lots
Screen SAPLSLVC_FULLSCREEN.0500
Enter "/Menu=1,4,3" // Local file...
// Save list in file...
Screen SAPLSPO5.0110
Set R[Spreadsheet] "X"
Enter
// Display data for inspection lot: Worklist for Inspection Lots
Screen SAPLSFES.0200
Set F[DY_PATH] "C:\Users\Desktop"
Set F[DY_FILENAME] "temp.txt"
Enter "/7" // Extend
// Display data for inspection lot: Worklist for Inspection Lots
Screen SAPLSLVC_FULLSCREEN.0500
Enter "/3"
Set V[i] 1
//OpenFile "&U[mat_file3]" -Output
Set V[t2] ""
Copytext fromText="t2" toFile="C:\Users\Desktop\myfile.txt"
// Display data for inspection lot: Worklist for Inspection Lots
CloseFile "&U[mat_file3]" -Output
//Screen SAPLSLVC_FULLSCREEN.0500
// Enter "/nqa33"
goto Read_File
******************************************************************************************************************************************************************************____________________________________________________________________________________________________________________________
Problem part of the code:
Copytext fromFile="&U[mat_file3]" toText="t1"
Copytext fromText="t1" -toclipboard
Enter "/24" //copy from clipboard
When I debug this code ..I see empty value for t1 or clipboard.
I have tried several Copytext options but no solution so far.
Please help me with this issue.
GuiXT solution OR VBScript but I want it to be able to paste 20 values.
I really appreciate you'r time and effort in this regard.
SAP Krazy