Jump to content

SAP - Selecting Columns - (Moved)


Recommended Posts

Hello all,

I am new to Autoit, I have been coding in VBA for a while now and now I am trying to do some .exe files. 

I am trying to write a program to do the following:

  • open SAP
  • Go to a company TCODE
  • Once in the TCODE I need to hide Columns and Filter by one column

I am not sure how to select a column and hide it, or how to select it and apply a filter.

Here is my current code (I blocked out company data)

#include <Constants.au3>
#include <SAP.au3>
;
; AutoIt Version: 3.0
; Language:       English
; Platform:       Win10
; Author:         
;
; Script Function:
;   Opens TCODE ZFAS within SAP.
;

;-Begin-----------------------------------------------------------------

; Open SAP
Run("C:\Program Files (x86)\SAP\FrontEnd\SAPgui\sapgui.exe /H/saperp.xxxxxxx.com")

; Wait 1 second to allow SAP to open
WinWaitActive ("[CLASS:SAP_FRONTEND_SESSION]","SAP",1)

Send ("UserName") 
Send ("{TAB}")
Send ("Password") 
Send ("{ENTER}")

; Attach to the session window
_SAPSessAttach("[CLASS:SAP_FRONTEND_SESSION]")

; Put the value "/nZFAS" into the command field.
_SAPObjValueSet("tbar[0]/okcd", "/nZFAS")
_SAPVKeysSend("Enter")

; Press the Multiple Selection button.
_SAPObjSelect("usr/btn%_PARBPL_%_APP_%-VALU_PUSH")

; Attach to the selection window
_SAPSessAttach("Multiple Selection for Work center")

; Put the Work Center into the lower and upper field.
_SAPObjValueSet("usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,0]","76")
_SAPObjValueSet("usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,1]","76R")

_SAPVKeysSend("F8")

; Attach to the session window
_SAPSessAttach("[CLASS:SAP_FRONTEND_SESSION]")

_SAPVKeysSend("F8")

Sleep (5000)

_SAPObjSelect

 

Any help would be appreciated.

Link to comment
Share on other sites

1 hour ago, djchaney3 said:

Hello all,

I am new to Autoit, I have been coding in VBA for a while now and now I am trying to do some .exe files. 

I am trying to write a program to do the following:

  • open SAP
  • Go to a company TCODE
  • Once in the TCODE I need to hide Columns and Filter by one column

I am not sure how to select a column and hide it, or how to select it and apply a filter.

Here is my current code (I blocked out company data)

#include <Constants.au3>
#include <SAP.au3>
;
; AutoIt Version: 3.0
; Language:       English
; Platform:       Win10
; Author:         
;
; Script Function:
;   Opens TCODE ZFAS within SAP.
;

;-Begin-----------------------------------------------------------------

; Open SAP
Run("C:\Program Files (x86)\SAP\FrontEnd\SAPgui\sapgui.exe /H/saperp.xxxxxxx.com")

; Wait 1 second to allow SAP to open
WinWaitActive ("[CLASS:SAP_FRONTEND_SESSION]","SAP",1)

Send ("UserName") 
Send ("{TAB}")
Send ("Password") 
Send ("{ENTER}")

; Attach to the session window
_SAPSessAttach("[CLASS:SAP_FRONTEND_SESSION]")

; Put the value "/nZFAS" into the command field.
_SAPObjValueSet("tbar[0]/okcd", "/nZFAS")
_SAPVKeysSend("Enter")

; Press the Multiple Selection button.
_SAPObjSelect("usr/btn%_PARBPL_%_APP_%-VALU_PUSH")

; Attach to the selection window
_SAPSessAttach("Multiple Selection for Work center")

; Put the Work Center into the lower and upper field.
_SAPObjValueSet("usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,0]","76")
_SAPObjValueSet("usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,1]","76R")

_SAPVKeysSend("F8")

; Attach to the session window
_SAPSessAttach("[CLASS:SAP_FRONTEND_SESSION]")

_SAPVKeysSend("F8")

Sleep (5000)

_SAPObjSelect

 

Any help would be appreciated.

 

Link to comment
Share on other sites

  • Moderators

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Did you have a look at the SAP UDF to automate the SAP GUI?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...