Register Login

How To Import from Text File Dialog on Multiple Selection screen

Updated May 19, 2018

In the CAOR transaction, I'm trying to record a script for the steps I perform to "Import from Text File" on a multiple selection for the Receiver Order field.

I have turned on the recorder, performed all the steps, and looked at the resulting InputScript.txt file.

I am not seeing the screen functions for the file picker dialog that opens for me to choose the text file.

The Input script only shows these two screen sections:
// Multiple Selection for Order
Screen SAPLALDB.3000
Enter "/23"

// Multiple Selection for Order
Screen SAPLALDB.3000
Enter "/8"

The filepicker dialog should be in between those two Screen commands, but the recorder didn't pick anything up.

What script commands or Screen functions do I need to supply the filepath and filename for my text file?

Thanks!


Comments

  • 12 Apr 2012 11:10 am Shalesh Singh Visen
    The file selection window is not recorded since it is not an SAP screen (dynpro), it is a native
    Windows screen.

    Instead of /23, read the text file with ReadFile and fill the table in screen SAPLALDB.3000
    with the values read from the file, and then /8.
  • 12 Apr 2012 11:11 am Shalesh Singh Visen
    Thanks for the quick response! I know I have a previous script for table reading, I'll just adapt that for table writing in this particular situation.
  • 13 Apr 2012 1:25 am Shalesh Singh Visen
    if your IT department has enabled scripting support, you could try for example the following:

    // Multiple Selection for Order
    Screen SAPLALDB.3000
    Enter "/23"

    start "c: mpOpenFile.vbs" parameters="c: mpTextFile.txt"

    // Multiple Selection for Order
    Screen SAPLALDB.3000
    Enter "/8" wait=2000

    The OpenFile.vbs contains the following:

    if wscript.arguments.count > 0 then
    Set wshell = CreateObject("WScript.Shell")
    Number = 0
    Do
    bWindowFound = wshell.AppActivate("Open")
    wscript.sleep 500
    Number = Number + 1
    If bWindowFound Or Number > 10 Then Exit Do
    Loop
    If bWindowFound Then
    wshell.AppActivate "Open"
    wscript.sleep 500
    'When the cursor should not stand in the name field, then the following should be activated:
    'Wshell.sendkeys "{TAB X}" 'X=1,2,3,4...
    'wscript.sleep 500
    wshell.SendKeys wscript.arguments(0)
    wscript.sleep 500
    wshell.SendKeys "{ENTER}"
    wscript.sleep 500
    End If
    End if
  • 13 Apr 2012 1:26 am Shalesh Singh Visen
    You can also use copytext…



    // Display Time Sheet Data

    Screen CATSSHOW.1000

    Enter "=%143" // Multiple selection.12



    // Multiple Selection for Order

    Screen SAPLALDB.3000

    Enter "/16" //delete contents



    // Multiple Selection for Order

    Screen SAPLALDB.3000

    Copytext fromFile="myfile.txt" toText="t1"

    Copytext fromText="t1" -toclipboard

    Enter "/24" //copy from clipboard



    // Multiple Selection for Order

    Screen SAPLALDB.3000

    Enter "/8" //copy to selection criteria



    If the user needs to choose the file include the IA function selectfile.
  • 19 Apr 2012 2:39 am Shalesh Singh Visen
    Thanks for your ideas! My IT dept is, so far, unwilling to enable scripting, so the Copyfile technique you suggested worked great, and certainly simplified my code from the table looping I had implemented earlier.
    I sometimes forget about the different techniques available in GuiXT, so this forum is great for reminding me about other approaches to solving a particular problem.

×