ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

RPA-Connect to session

2022-01-21 09:32:21  阅读:281  来源: 互联网

标签:Scripting GUI RPA session Connect SAP scripting user


How to work with SAP (robocorp.com)

How to work with SAP

Robocorp supports automating SAP. The RPA.SAP library is based on the SapGuiLibrary that enables automating the SAP GUI application.

 

<iframe height="100%" src="https://www.youtube.com/embed/6dR5iOkhgGY" width="100%"></iframe>

 

Enable SAP Scripting Engine

SAP scripting must be enabled on the server and on the client.

SAP user with the required authorization should set the sapgui/user_scripting for the system. It is also recommended to set sapgui/user_scripting_per_user to allow scripting on per user basis and then set the authorization object S_SCR for defined users.

Server

Set two parameters (sapgui/user_scripting and sapgui/user_scripting_per_user):

  • Execute saplogon.exe.
  • Log in to access SAP Easy Access.
  • From the transaction dropdown, select and run RZ11.
  • Enter sapgui/user_scripting as the parameter name.
  • Press the Display button.
  • Press the Change Parameter Value button.
  • Set New value to TRUE.
  • Click the save icon.
  • Add the sapgui/user_scripting_per_user parameter the same way and set it to TRUE.
  • Log out.
  • Log in.

SAP GUI Scripting Security Guide (PDF):

In some cases, it is not possible to enable SAP GUI Scripting for lack of a dedicated application server. This implies that users who are allowed to use SAP GUI Scripting work on the same server as others, so the support cannot be enabled for the server.

The problem can be solved by setting the rights to run SAP GUI Scripting per user. The new profile parameter sapgui/user_scripting_per_user allows the administrator then to enable SAP GUI Scripting support for specific users. Unless the administrator explicitly changes the value, this parameter is set to FALSE. If the profile parameter is set to TRUE the following happens:

  • On the login screen SAP GUI Scripting is available for every user.
  • After login, SAP GUI Scripting only remains available for those users that have the authorization for the Execute(16) action of the authorization object S_SCR in class BC_A.

Client

After user scripting is enabled on the server, each user with S_SCR authorization can enable the scripting in the SAP GUI client:

  • Press the Customise Local Layout button.
  • Select Options.
  • Navigate to Accessibility & Scripting -> Scripting.
  • Check Enable scripting.
  • Uncheck both of the notification options if they are checked.
  • Click OK.

Opening a connection / Before running automation

Start the SAP Logon Pad application. Use the Connect To Session keyword to connect to the SAP Session.

After successful connection, use the Open Connection keyword to open a new connection from the SAP Logon Pad or Connect To Existing Connection to connect to a connection that is already open.

Here's an example for logging into SAP:

 
*** Settings ***
Library    RPA.SAP    WITH NAME    SAP
Library    RPA.Desktop.Windows    WITH NAME    Windows

*** Keywords ***
SAP Gui Login
    Disable Screenshots On Error
    Windows.Open Executable    ${EXE_PAD}    ${TITLE_PAD}
    Connect To Session
    ${secrets}=    Get Secret    sap
    SAP.Open Connection    ${secrets}[connection]
    SAP.Input Text    ${FIELD_CLIENT}    ${secrets}[client]
    SAP.Input Text    ${FIELD_USER}    ${secrets}[user]
    SAP.Input Password    ${FIELD_PASSWORD}    ${secrets}[password]
    SAP.Send Vkey    0
  • ${EXE_PAD}: An absolute filepath to saplgpad.exe
  • ${TITLE_PAD}: The window title of the saplgpad.exe application once it has started
  • ${FIELD_CLIENT}: A locator for the Client input field, wnd[0]/usr/txtRSYST-MANDT
  • ${FIELD_USER}: A locator for the User input field, wnd[0]/usr/txtRSYST-BNAME
  • ${FIELD_PASSWORD}: A locator for the Password input field, wnd[0]/usr/pwdRSYST-BCODE

Also check the SAP Logon & Login example by Robocorp community member RoboHeart!

Locating or specifying elements

Specify elements starting from the window ID, for example, wnd[0]/tbar[1]/btn[8]. In some cases, the SAP ID contains backslashes. Escape these backslashes by adding another backslash in front of them.

Check the SAP - MM01 - Create Material example by Robocorp community member RoboHeart!

Screenshots (on error)

The RPA.SAP library has an option for automatic screenshots on error. This option is enabled by default. Use Disable Screenshots On Error to skip the screenshot functionality.

Alternatively, this option can be set when importing the library:

 
*** Settings ***
Library    RPA.SAP    screenshots_on_error=True    screenshot_directory=None

Example robots

Learn more about the libraries mentioned on this page:

2021年4月28日

标签:Scripting,GUI,RPA,session,Connect,SAP,scripting,user
来源: https://www.cnblogs.com/ricoo/p/15828956.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有