Quantcast
Channel: SCN: Message List - Scripting Languages
Viewing all 1708 articles
Browse latest View live

Re: How to scroll GUI table in VB

$
0
0

My way of executing .vbs is to drag .vbs file and drop it on QP03 transaction SAP screen.

Double clicking .vbs file opens that file using VbsEdit.

Program fails even if I use play back function of the SAP GUI.

 

 

Sorry for asking this novice question but what's the meaning of 0 below here?

Set connection = application.Children(0)

Set session = Connection.Children(0)

 

what happens if I have 1..

Set connection = application.Children(1)

Set session = Connection.Children(1)


 

 

 

Thank you!


How to open a file "into SAP"

$
0
0

Hello,

I have to import files into SAP "data storage" (cv01n).

 

One step is to select the file.

In script it looks like this:

 

      'Open Browser to select the requested file

      Session.findById("wnd[0]/usr/tabsTAB_MAIN/tabpTSFILES/ssubSCR_MAIN:SAPLCV110:0103/btnPB_FILE_BROWSER").press

      'Check in File

      Session.findById("wnd[0]/usr/tabsTAB_MAIN/tabpTSFILES/ssubSCR_MAIN:SAPLCV110:0103/btnPB_CHECKIN").press

 

SAP-CV01N.png

My questions are:

Is it possible to define the path which the <FILE_BROWSER> will open?

Is there a possibility to define even the filename in advance or even "complete the open command" automatically?

 

In my script I have all the information available, but the user must navigate in the dialog to the right file and confirm it.

For better comfort, I look for a solution to overcome that.

 

Is there a "HELP", where I could find something about this topis?

 

Thanks for reading and thinking, Franz

Re: How to open a file "into SAP"

$
0
0

Hi Franz

 

im not a scripting expert but i give u my view

 

you can default the folder where you desire configuring the sapgui parameters (of course this will be for everything and not only that transaction...)

 

and if i would be you, i would enhance that dynpro adding a button linked to a custom transaction that upload automatically the file from the path you want

 

hope this help

regards

a

Re: How to scroll GUI table in VB

$
0
0

Hello,

 

you can open different connections to an SAP system or to different SAP systems. Each connection has a number, e.g. you connect to system NSP and NSQ, NSP is connection 0 and NSQ is connection 1. With each connection you can open different sessions. Each session has also a number, e.g.0 for the first session, 1 for second etc. You see the session number (+ 1) in the status bar.

 

Unbenannt.JPG

You need the definitve number in your code if you don't use drag'n'drop or SAP scripting recorder. On this way you identify your target connection and session where do you want to execute your SAP GUI script.

 

Cheers

Stefan

Re: How to open a file "into SAP"

$
0
0

Hi Andrea,

good point about the default folder. I will check if this can be activated as temp-setting by a script.

 

Much more I like your point to add a button to the GUI to do the job.

But I have no idea how this can be done by scripts.

(My scripts are excetuted as EXCEL-VBA)

 

best regards, Franz

Re: How to open a file "into SAP"

$
0
0

Hi Franz

 

sorry for the late reply

 

What i was suggesting it's not a something to be done by scripts but i dirty customization of the dynpro of your standard transaction. (there could be also an enhancement for this that its more sap standard but i have to seek for it...)

 

Let me know if you want try this path

cheers

a

Re: How to open a file "into SAP"

$
0
0

Hi Andrea,

I think your reply is more in time as I could expect.

 

I do not have access to dynpro customization.

For me, the only way to improve interaction between user and SAP is the use of scripts.

 

I appreciate your offer to search for other solutions, but if you didn´t use scripting so far and you do not have a good information source, we should close this topic by now for you. It will cost probably more time for you as you would like to invest and the outcome is quite open.

 

Thanks a lot for your time, Franz

Re: How to open a file "into SAP"


SAP GUI Script Development tool on Windows 7 and SAP GUI 7.30

$
0
0

Hi members,

 

I have the following question pertaining to the standard SAP GUI Script development tool. I hope someone has hit this already and can provide an answer.

 

Is there a way to enable the SAP Script Development tool (the Merlin character which allows you to do click tests and examine GUI properties and SAP transaction) if you run SAP GUI for Windows 7.30 and Windows 7?

 

I did my homework and searched the SCN. I already know about:

  • Microsoft KB 969168 Microsoft Agent-enabled programs do not work in Windows 7; I installed the hotfix on my Win 7 computer, but it does not help
  • SAP Note 1633639 - Script Development Tool disabled from Windows 7; give you a background of the issue but refers to SAP GUI 7.20
  • I know about Scripting Tracker Lite and Bebo, both tools made and promoted by Stefan Schnell; I use them but switching back and forth between 2 apps is not optimal. Also you have to rescan all the active connections when you change the screen and this takes time if you run 6 connections/ Still good they exist.

 

I did not find any info for Windows 7 and SAP GUI 7.30

Thanks a bunch.

Re: How to scroll GUI table in VB

$
0
0

Sorry for my delayed response..as I was away for thanks giving holiday.

 

 

 

My QP03 screen looks like this….

I’m trying to search for text from column Short text insp. char

Untitled.png

 

 

I modified your code to collect search text dynamically via popup.

But my search is not yielding right text or entry line.

Untitled1.png

 

Here is my code so far…

'-Begin-----------------------------------------------

'-Directives----------------------------------------
OptionExplicit

'-Variables-----------------------------------------
Dim SapGuiAuto, application, connection, session
Dim WshShell, i, j, fldtxt
Dim ContentToFind


'-Main----------------------------------------------
IfNotIsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
EndIf

IfNotIsObject(connection) Then
Set connection = application.Children(0)
EndIf

IfNotIsObject(session) Then
Set session = connection.Children(0)
EndIf

Set WshShell = CreateObject("WScript.Shell")

    ContentToFind = InputBox("Enter search text") 

    i = session.findById("wnd[0]/usr/tblSAPLQPAATC_PLMK").RowCount

For j = 1To i

      fldtxt = session.findById("wnd[0]/usr/tblSAPLQPAATC_PLMK/txtPLMKB-KURZTEXT[11,0]").Text

If fldtxt = ContentToFind Then
ExitFor
EndIf

      WshShell.AppActivate _
"Txn - QP03 Display Inspection Plan: Characteristic Overview"
      WshShell.SendKeys "+{DOWN}"

Next

MsgBox fldtxt & " found in line " & CStr(j)

'-End-------------------------------------------------

Re: How to scroll GUI table in VB

$
0
0

Hi just an off topic question. How do paste syntax highlighted VB in color as you are doing ..I'm using excel VBA? What are you copying  from..

Re: How to scroll GUI table in VB

$
0
0

Im using Vbsedit  to run vbs code. Vbsedit automatically highlights syntax.

 

 

Thanks.

Re: How to open a file "into SAP"

$
0
0

Hello Franz.

 

I will check if I can reproduce this sceario in my sandbox System. If yes, then I can send you some USER32 API-coding which can control this FileOpen-dialog.

 

Have a good day

 

Holger

Vba Work in diferent SAP mods

$
0
0

Hello, please i need help with a vba code, im currently working with iw32 transaction to count materials in te cost centers of the diferent areas, and ive developed a code to simplify this process; however i want to be able to open an amount of sap mods and be able to work with each of them at once, but evry time i open a new mod, the macro keeps on working with the previous one, can anybody help me with this!

 

Thanks

Re: Vba Work in diferent SAP mods

$
0
0

AFAIK, we can only execute one session at a time.

 

From the SAP Scripting API Help File:

 

The GuiApplication represents the process in which all SAP GUI activity takes place. If the scripting component is accessed by attaching to a SAPlogon process, then GuiApplication will represent SAPlogon. GuiApplication is a creatable class. However, there must be only one component of this type in any process.

 

Though, you can switch between different sessions by assigning the ID of a GuiSession windows to a the GuiSession object variable in VBA.


Re: Vba Work in diferent SAP mods

$
0
0

Thanks a lot Sayuti, I guess ill have to manage.

Re: Vba Work in diferent SAP mods

$
0
0

Hello. May I misunderstand your request, but you can adopt VBA coding to more than one session at a time. Therefore you can Loop over all open sessions. During this you just Need to skip a session which is busy. This can be checked with 'Busy'-property on a session.

 

The only additional requirement is to have an seperate Excel instance run. As you can´t run both in one instance.

 

If you can give me more Details about your expectations I can ggive some more Detail Information how this can be done.

 

Holger

Re: Vba Work in diferent SAP mods

$
0
0

Agree with Holger.

 

You can open multiple sessions of SAP and run the script on each session sequentially, but not all at once. You can probably use a FOR loop to go through each open session.

 

Example if multiple sessions on a single connection:

 

Dim i As Integer

 

For i = 0 to SAPConnection(0).Children.Count - 1

     Set SAPSession = SAPConnection(0).Children(CLng(i))

     .

     ..

     (Your material counts procedure here)

     ..

     .

Next i

 

The Busy property is pretty useful if you need to wait for a particular respond from the SAP server, but frankly, I have not been successful in using it lol.

Re: Vba Work in diferent SAP mods

$
0
0


Thanks Holger you understood what i meant to explain, and also thanks for replying again Sayuti, Ive managed to run the macro without having any error messags but it still doesnt work as i want to, it just work with one session,  how can i make this work for evry session that I open?

If Not IsObject(App1) Then
   Set SapGuiAuto = GetObject("SAPGUI")
   Set App1 = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(Connection) Then
   Set Connection = App1.Children(0)
End If
If Not IsObject(session) Then
   Set session = Connection.Children(0)
End If
If IsObject(WScript) Then
   WScript.ConnectObject session, "on"
   WScript.ConnectObject App1, "on"
End If
session.findById("wnd[0]").maximize
session.createSession

  

 

Dim i As Integer
For i = 0 To Connection.Children.Count

     Set sapSession = Connection.Children(CLng(i))


session.findById("wnd[0]/tbar[0]/okcd").Text = "/n iw32"
session.findById("wnd[0]").sendVKey 0

Next i

Re: Vba Work in diferent SAP mods

$
0
0

Dim i As Integer
For i = 0 To Connection.Children.Count
     Set sapSession = Connection.Children(CLng(i))

sapsession.findById("wnd[0]/tbar[0]/okcd").Text = "/n iw33"
sapsession.findById("wnd[0]").sendVKey 0
Next i

 

you have to use the correct object

sapSession instead of session

Viewing all 1708 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>