Jump to content
Sign in to follow this  
djchaney3

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.

Share this post


Link to post
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.

 

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
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 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...